Skip to main content

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.

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. 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​

SettingValue
API base URLhttps://api.preview.divyam.ai/v1
API typeOpenAI Chat Completions
AuthenticationYour Divyam API key, which starts with divyam-sw-v1-
ModelAn 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 fieldWhat to enter
Connection nameA name you choose, such as Divyam
Base URLhttps://api.preview.divyam.ai/v1
API keyYour Divyam API key
ModelThe exact model ID, such as divyam-as/gpt-6-sol
API or protocolChat 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​

Use the right URL for the field

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.

API format

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:

  1. Run a normal task and check that the answer is what you expect.
  2. If your application keeps a conversation, send a follow-up and check that the answer uses the earlier messages.
  3. If it calls tools, check that the tool runs and that the final answer uses the tool's result.
  4. 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.

Local cost estimates

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​

SymptomWhat to do
HTTP 404The application expects a base URL and you entered the full URL, or the other way round. See Base URL or full URL.
Model not foundCopy the model ID from Models & Pricing, including the divyam-as/ prefix.
The app still uses the old connectionCheck 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.