Compat openai
OpenAI Chat Completions wire format; the OpenAI SDKs work unchanged
/v1/chat/completionsAuthorization
bearer In: header
Header Parameters
API version (YYYY-MM-DD); defaults to the key's pinned version
datereturns the route trace in x-aiml-route-trace
Value in
- "1"
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
OpenAI Chat Completions request; extra aiml object accepted (route, metadata, compat, provider_options)
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-5-mini", "messages": [ { "role": "user", "content": "hi" } ], "stream": false, "aiml": { "route": { "sort": "price" }, "metadata": { "app": "chatbot" } } }'{ "id": "chatcmpl-01J9ZK2K4Q7Q3M3QX1V0F1GATE", "object": "chat.completion", "created": 1789041540, "model": "openai/gpt-5-mini", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Hello! How can I help?" }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 812, "completion_tokens": 143, "total_tokens": 955 }, "aiml": { "request_id": "01J9ZK2K4Q7Q3M3QX1V0F1GATE", "provider": "openai", "endpoint_id": "ep_openai_gpt-5-mini_us", "cost": { "total_micro_usd": 489, "lines": [ { "kind": "input", "units": 812, "unit_price_nano": 250, "micro_usd": 203 }, { "kind": "output", "units": 143, "unit_price_nano": 2000, "micro_usd": 286 } ], "price_version": "pv_01J9ZK2K4Q7Q3M3QX1V0F1PV01" }, "warnings": [] }}/v1/embeddingsAuthorization
bearer In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://example.com/v1/embeddings" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/text-embedding-3-small", "input": [ "the prepaid ledger settles once per request" ], "dimensions": 512 }'{ "object": "list", "model": "openai/text-embedding-3-small", "data": [ { "object": "embedding", "index": 0, "embedding": [ 0.0123, -0.0456 ] } ], "usage": { "prompt_tokens": 9, "total_tokens": 9 }}/v1/completionsAuthorization
bearer In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-5-mini", "prompt": "Hello" }'{ "id": "cmpl-01J9ZK2K4Q7Q3M3QX1V0F1GATE", "object": "text_completion", "created": 1789041540, "model": "openai/gpt-5-mini", "choices": [ { "index": 0, "text": " world", "finish_reason": "stop" } ], "usage": { "prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2 }}/v1/responsesAuthorization
bearer In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/v1/responses" \ -H "Content-Type: application/json" \ -d '{ "model": "openai/gpt-5-mini", "input": "hi" }'{ "id": "resp_01J9ZK2K4Q7Q3M3QX1V0F1GATE", "object": "response", "model": "openai/gpt-5-mini", "output": [ { "type": "message", "role": "assistant", "content": [ { "type": "output_text", "text": "Hello! How can I help?" } ] } ], "usage": { "input_tokens": 812, "output_tokens": 143 }}