v1 · OpenAI compatible

API Reference

Everything you need to integrate D Route. Designed to mirror the OpenAI Chat Completions API — so your existing code just works.

Authentication

All requests need a Bearer token in the Authorization header. Generate a key from the dashboard.

curl https://api.droute.digiably.com/v1/models \ -H "Authorization: Bearer sk-dr-YOUR_KEY"

Keys are scoped per project. Rotate or revoke any time. Never commit keys to git — use environment variables.

Base URL

All endpoints use the same base. Replace YOUR_KEY in code samples with the value from your dashboard.

https://api.droute.digiably.com/v1

Your first request

This example uses the OpenAI Python SDK with auto routing — D Route picks the best model for the prompt.

from openai import OpenAI client = OpenAI( api_key="sk-dr-YOUR_KEY", base_url="https://api.droute.digiably.com/v1" ) resp = client.chat.completions.create( model="auto", messages=[{"role": "user", "content": "Hello D Route!"}] ) print(resp.choices[0].message.content)

POST/v1/chat/completions

Standard chat-completions endpoint, OpenAI-compatible.

Request body

FieldTypeDescription
modelstringModel ID (e.g. gpt-4o, claude-3-5-sonnet, auto)
messagesarrayList of {role, content} messages
streambooleanEnable SSE streaming (default false)
temperaturenumberSampling temperature 0–2
max_tokensintegerStop after N tokens
toolsarrayFunction-calling tool definitions

Streaming

Set stream: true and use the SDK's iterator. Tokens arrive in <50ms chunks.

stream = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Stream a haiku."}], stream=True, ) for chunk in stream: print(chunk.choices[0].delta.content or "", end="")

Vision inputs

Send an image URL or base64 data — supported on every vision model.

messages=[{ "role": "user", "content": [ {"type": "text", "text": "What's in this image?"}, {"type": "image_url", "image_url": {"url": "https://..."}} ] }]

Tool calling

Define functions as tools; the model returns tool_calls with arguments you dispatch.

tools=[{ "type": "function", "function": { "name": "get_weather", "parameters": { "type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"] } } }]

GET/v1/models

Returns the live list of models on D Route with availability and capability flags.

curl https://api.droute.digiably.com/v1/models \ -H "Authorization: Bearer sk-dr-YOUR_KEY" # {"object":"list","data":[{"id":"gpt-4o",...}, ...]}

POST/v1/embeddings

OpenAI-compatible embeddings endpoint. Currently powered by top embedding models from OpenAI, Voyage and BGE.

SDK · OpenAI

Works with the official OpenAI SDKs in Python, Node, Go, Java, .NET and Ruby. Just change base_url.

SDK · cURL

No SDK — use raw HTTP. POST JSON, parse the SSE stream line by line.

SDK · LangChain

from langchain_openai import ChatOpenAI llm = ChatOpenAI( api_key="sk-dr-YOUR_KEY", base_url="https://api.droute.digiably.com/v1", model="auto" ) llm.invoke("Tell me about Indian AI infrastructure.")

SDK · Claude Code

export ANTHROPIC_BASE_URL=https://api.droute.digiably.com export ANTHROPIC_API_KEY=sk-dr-YOUR_KEY claude