Chat Completions
POSTThe primary endpoint for all AI interactions. 100% compatible with the OpenAI Chat Completions API schema.
POST /v1/chat/completionsRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
| model | string | REQUIRED | Use "auto-route" for intelligent routing, or specify a provider directly (e.g., "claude-3.5-sonnet"). |
| messages | array | REQUIRED | Standard OpenAI message array with role/content pairs. |
| temperature | number | optional | Sampling temperature (0–2). Lower = more deterministic. |
| max_tokens | integer | optional | Maximum tokens in the completion response. |
| strategy | string | optional | Routing strategy override. See Routing Strategies page for options. |
| stream | boolean | optional | Enable Server-Sent Events streaming (default: false). |
Example Request
POST /v1/chat/completions
{
"model": "auto-route",
"messages": [
{ "role": "system", "content": "You are a Web3 security auditor." },
{ "role": "user", "content": "Audit this Solidity contract for reentrancy..." }
],
"temperature": 0.2,
"max_tokens": 4096,
"strategy": "cost-latency-balanced"
}Example Response
The response follows the standard OpenAI schema with an additional router_telemetry object unique to Meida.
200 OK
{
"id": "meida-chatcmpl-abc123",
"object": "chat.completion",
"created": 1723056000,
"model": "claude-3.5-sonnet",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "I've identified 2 critical vulnerabilities..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 842,
"completion_tokens": 1205,
"total_tokens": 2047
},
"router_telemetry": {
"selected_tier": "T4_PREMIUM",
"selected_provider": "anthropic/claude-3.5-sonnet",
"classification_ms": 3.8,
"arbitrage_ms": 7.2,
"total_routing_ms": 11.0,
"cost_saved_vs_default": "68%",
"fallback_triggered": false
}
}Router Telemetry Fields
The router_telemetry object is appended to every response and provides full transparency into routing decisions.
selected_tierThe tier level chosen by the arbitrage engine (T1–T4).
selected_providerThe exact provider/model combination that served the request.
classification_msTime spent on semantic classification (typically <4ms).
arbitrage_msTime spent on tier selection and cost comparison.
total_routing_msTotal overhead added by the Meida routing pipeline.
cost_saved_vs_defaultPercentage cost savings vs. always routing to the most expensive model.
fallback_triggeredWhether a failover reroute occurred during this request.