Connect an AI application
Connect an application that supports a custom OpenAI Chat Completions endpoint to Divyam. Start with the base URL, API key and model, then check its conversation, tool and streaming behavior using the steps below.
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. To choose another model, use this guide’s model selector when one is shown, or copy its current ID from Models and pricing. Check its context limit and supported features.
Connection values
| Setting | Value |
|---|---|
| API base URL | https://api.preview.divyam.ai/v1 |
| API type | OpenAI Chat Completions |
| Authentication | Your Divyam API key, which starts with divyam-sw-v1- |
| Model | An ID from Models & Pricing, such as divyam-as/gpt-6-sol |
Copy the full model ID, including the divyam-as/ prefix. Your application sends the model with every request, and that model sets the price you pay. Picking a model on the console's Getting Started page only changes the example shown there.
Keep the API key in your backend or in trusted connection settings. Never put it in browser JavaScript or commit it to a repository.
Apps with connection settings
Open your application's settings and add a custom provider or an OpenAI-compatible connection. Field names vary between applications. Note the current values first so you can go back later.
| Application field | What to enter |
|---|---|
| Connection name | A name you choose, such as Divyam |
| Base URL | https://api.preview.divyam.ai/v1 |
| API key | Your Divyam API key |
| Model | The exact model ID, such as divyam-as/gpt-6-sol |
| API or protocol | Chat Completions |
Save the connection and select it for the workflow you want to run. If someone else manages the application, send them these values.
Apps with a custom backend
In the part of your backend that calls the model, create the OpenAI client with the Divyam base URL and API key, and set the request's model to your Divyam model ID. Store these values in your existing configuration or secret settings, then restart or reload the application.
For code, see Python, Node.js or HTTP and curl.
Base URL or full URL
A base URL field takes https://api.preview.divyam.ai/v1. The application adds /chat/completions itself. If a field asks for the full completion URL, use https://api.preview.divyam.ai/v1/chat/completions. Adding /chat/completions to a field that already appends it gives HTTP 404.
This page covers Chat Completions connections. For a tool that uses a different API format, follow its integration guide.
Test your application
Your first request proves the connection. Before you rely on Divyam, run your application's own workflows through it:
- Run a normal task and check that the answer is what you expect.
- If your application keeps a conversation, send a follow-up and check that the answer uses the earlier messages.
- If it calls tools, check that the tool runs and that the final answer uses the tool's result.
- If it streams responses, check that the text appears as it's generated and the answer finishes.
Check your requests
Open the Divyam console and select Logs. Your requests appear there within a few seconds, newest first, with their status, token counts and latency. Usage and Credits & Billing catch up within a few minutes.
Some clients display zero when model prices are missing. Check Credits & Billing for Divyam charges. Local dollar limits depend on the client's price and usage data.
For filters, cached-token counts and the requested-versus-routed view, see Logs and usage.
Troubleshooting
| Symptom | What to do |
|---|---|
| HTTP 404 | The application expects a base URL and you entered the full URL, or the other way round. See Base URL or full URL. |
| Model not found | Copy the model ID from Models & Pricing, including the divyam-as/ prefix. |
| The app still uses the old connection | Check for configuration overrides, then restart or reload the application. |
For authentication, credit and other errors, see Troubleshooting.
Go back to your previous provider
To rotate a key, create a new one, update the application, send one request, then revoke the old key. See API keys.
To stop using Divyam, restore the application's previous connection values and revoke the Divyam key if nothing else uses it.