API reference
Divyam speaks the OpenAI Chat Completions API. Any OpenAI SDK or OpenAI-compatible application works by changing the base URL, the API key and the model.
Base URL
https://api.preview.divyam.ai/v1
An OpenAI SDK appends the operation, such as /chat/completions or /models, to this value. If a tool asks for the full request URL instead, use https://api.preview.divyam.ai/v1/chat/completions. Don't add a second /v1.
Authentication
Send your API key as a bearer token: Authorization: Bearer divyam-sw-v1-.... See API authentication and API keys.
Endpoints
| Method and path | What it does |
|---|---|
POST /v1/chat/completions | Create a chat completion. Streaming and tool calls follow the OpenAI format. |
GET /v1/models | List the models your API key can use. |
Set model to a Divyam model ID such as divyam-as/gpt-6-sol. The response's model field shows the model you requested, even when Divyam routes the request to a different backing model. See Models and pricing.
Divyam supports only the Chat Completions API. Applications that need the OpenAI Responses API or the native Anthropic Messages API can't connect yet.
Code examples
For ready-to-run requests in Python, Node.js and curl, see Code examples.
Errors
| Status | Meaning | What to do |
|---|---|---|
| 401 | The API key is missing, wrong or revoked. | Check the full key. See authentication errors. |
| 402 | Your account is out of credit. | Check Credits and billing. |
| 403 | Your plan doesn't allow this model or action. | Pick a model from Models and pricing. |
| 404 | Wrong path, or an unknown model ID. | Check the base URL and copy the full model ID. |
| 429 | Too many requests. | Retry after the delay in the response. |
| 502, 503 | The backing model is unavailable. | Retry later. |
For everything else, see Troubleshooting or email hello@divyam.ai.
OpenAPI document
Download the OpenAPI document to generate a client or import the API into a tool.