API Reference
AI Code Router exposes an HTTP API that matches the OpenAI chat completions interface. Send POST requests to our base URL with your API key; specify the model with the model parameter.
Base URL. https://api.aicoderouter.com/v1 (or the URL provided in your account).
Authentication. Set the Authorization header to Bearer YOUR_API_KEY. Create and manage keys in your account.
Chat completions. POST /v1/chat/completions. Body: model (required), messages (array of role and content), and optional fields such as max_tokens, temperature, stream. Model IDs are listed on the models page (e.g. gpt-5-2, gemini-3-1-pro).
Response. Same structure as OpenAI: choices array with message and finish_reason. For streaming, use stream: true and parse SSE events.
Errors. HTTP status and a JSON body with error and message. Common codes: 401 (invalid key), 429 (rate limit or insufficient credits), 502 (provider issue).
For a full parameter list and examples, see Documentation. For client libraries, see SDK.