API Overview
The primary way to connect to DDTokens is through OpenAI-compatible endpoints. For an existing OpenAI SDK project, you usually only need to replace the API key and base_url.
Basic Configuration
| Item | Value |
|---|---|
| Base URL | https://apiddt.com/v1 |
| Authentication | Authorization: Bearer <DDDT_API_KEY> |
| Default protocol | OpenAI Chat Completions |
Example Request
bash
curl "https://apiddt.com/v1/chat/completions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DDDT_API_KEY" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{ "role": "user", "content": "Hello!" }
]
}'Response Structure
A successful response usually includes:
id: the request or response identifier.model: the model that actually processed the request.choices: the model output.usage: input, output, and total token counts.
Different models and upstream providers may return additional fields. Production applications should depend only on the stable fields they actually need.
Compatibility Boundaries
DDTokens primarily provides OpenAI-compatible access. Model parameters, tool calls, multimodal capabilities, streaming output, and error formats may differ between providers.
For stable behavior:
- Pin the model ID.
- Test parameter compatibility with real requests before launch.
- Record request IDs, models, costs, and durations in your application.
- Configure a retry policy for retryable errors.