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": {}
}
| Field | Type | Required | Description |
|---|---|---|---|
protocolType | string | Yes | Protocol type key (e.g., kafka, graphql, scim_2, mongodb) |
prompt | string | Yes | Natural language description of what to generate |
currentDefinition | object | No | Existing definition for context (AI will consider this when generating) |
Response:
{
"definition": {
"topics": [
{
"name": "orders.created",
"partitions": 3,
"seedMessages": []
}
],
"autoCreateTopics": true
},
"tokens_used": 847
}
| Field | Type | Description |
|---|---|---|
definition | object | The AI-generated mock definition matching the protocol's schema |
tokens_used | number | Number 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.