Skip to main content

Code Examples

Divyam speaks the OpenAI Chat Completions API, so you call it with the official OpenAI SDKs or any HTTP client. You change three values: the base URL https://api.preview.divyam.ai/v1, your Divyam API key, and the model, such as divyam-as/gpt-6-sol.

Before you start

You need a Divyam account and an API key. If you don't have them yet, follow Getting Started first.

Replace the shortened divyam-sw-v1-... shown in examples with your complete API key.

The examples use divyam-as/gpt-6-sol. For another model, select its current ID in your harness or copy it from Models and pricing, and check its context limit and supported features.

Language or toolUse this when
PythonYou call models from Python with the OpenAI SDK.
Node.jsYou call models from a Node.js backend with the OpenAI SDK.
HTTP and curlYou use curl or your own HTTP client.

For every endpoint, field and error, see the API reference. To connect an app or tool instead of writing code, see Integrations.