Skip to main content

AI Service API

The AI Service provides AI-powered features including response generation, schema analysis, and smart suggestions.

Base URL (local): http://localhost:3004 Swagger UI: http://localhost:3004/api/docs

Capabilities

  • Generate mock responses from schemas
  • Analyze API patterns for suggestions
  • Natural language to mock configuration
  • Test data generation
  • Generate complete protocol mock definitions for 30+ protocol types

Protocol Definition Generation

Generate a complete protocol mock definition using AI.

Endpoint: POST /ai/protocol-generate

Authentication: Bearer token (JWT)

Request Body:

{
"protocolType": "kafka",
"prompt": "An e-commerce order processing system with order events, payment notifications, and inventory updates",
"currentDefinition": {}
}
FieldTypeRequiredDescription
protocolTypestringYesProtocol type key (e.g., kafka, graphql, scim_2, mongodb)
promptstringYesNatural language description of what to generate
currentDefinitionobjectNoExisting definition for context (AI will consider this when generating)

Response:

{
"definition": {
"topics": [
{
"name": "orders.created",
"partitions": 3,
"seedMessages": []
}
],
"autoCreateTopics": true
},
"tokens_used": 847
}
FieldTypeDescription
definitionobjectThe AI-generated mock definition matching the protocol's schema
tokens_usednumberNumber of AI tokens consumed
OpenAPI Spec

Auto-generated API docs from the OpenAPI spec will populate this section. Access the interactive Swagger UI at localhost:3004/api/docs.