Skip to main content

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 pathWhat it does
POST /v1/chat/completionsCreate a chat completion. Streaming and tool calls follow the OpenAI format.
GET /v1/modelsList 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.

note

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​

StatusMeaningWhat to do
401The API key is missing, wrong or revoked.Check the full key. See authentication errors.
402Your account is out of credit.Check Credits and billing.
403Your plan doesn't allow this model or action.Pick a model from Models and pricing.
404Wrong path, or an unknown model ID.Check the base URL and copy the full model ID.
429Too many requests.Retry after the delay in the response.
502, 503The 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.