Dualyne documentation
Dualyne gives you every major AI model through one OpenAI-compatible endpoint. If your code already calls OpenAI, you only change two values.
https://api.dualyne.com/v1Quickstart
1. Connect a wallet and create a key in the dashboard. 2. Set it as an environment variable. 3. Point your SDK at Dualyne.
export DUALYNE_KEY="dly_live_..."
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.dualyne.com/v1", api_key=os.environ["DUALYNE_KEY"])
reply = client.chat.completions.create(
model="claude-swift",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)Authentication
Send your key as a bearer token on every request. Keys belong to the wallet that created them and stop working the moment you revoke them.
Authorization: Bearer dly_live_...Never put a key in front-end code or a public repository. If a key leaks, revoke it in the dashboard and create a new one. Dualyne stores only a hash of each key, so a lost key can't be shown again.
Chat completions
POST/v1/chat/completions
| Field | Type | Description |
|---|---|---|
model | string | Model id from the models list, for example gemini |
messages | array | Conversation turns with role and content |
stream | boolean | Send tokens as they are generated |
max_tokens | integer | Upper limit on the answer length (capped per tier, see below) |
tools | array | Function definitions the model may call |
Other OpenAI fields such as temperature, response_format and stream_options pass through unchanged. Tool calling and JSON mode work on models whose provider supports them. The response's model field names the exact model version that answered. n must be 1.
Models
GET/v1/models returns every model your key can use. Explorer wallets see fast models; Holder and Builder see the full catalog.
| Model id | Provider | Runs on | Tier |
|---|---|---|---|
claude-swift | Anthropic | Claude Haiku 4.5 | Explorer |
claude-balanced | Anthropic | Claude Sonnet 4.5 | Holder |
claude-deep | Anthropic | Claude Opus 4.5 | Holder |
gpt | OpenAI | GPT-5 | Holder |
gemini | Gemini 2.5 Pro | Holder | |
llama | Meta | Llama 3.3 70B Instruct | Explorer |
deepseek | DeepSeek | DeepSeek V3.1 | Explorer |
mistral | Mistral | Mistral Small 3.2 24B | Explorer |
Each id is a stable name for a model family. When a newer version replaces the one listed under "Runs on", this table and the catalog update, and your code keeps working without changes.
Streaming
Set "stream": true to receive server-sent events. Each event carries a small piece of the answer; the last one is data: [DONE]. Lines starting with : are keep-alive comments and can be ignored (the OpenAI SDKs do this for you).
for chunk in client.chat.completions.create(model="gpt", messages=msgs, stream=True):
print(chunk.choices[0].delta.content or "", end="")curl -N https://api.dualyne.com/v1/chat/completions \
-H "Authorization: Bearer $DUALYNE_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "claude-swift", "stream": true,
"messages": [{"role": "user", "content": "Hello"}]}'To get token counts at the end of a stream, send "stream_options": {"include_usage": true}. The final chunk then carries usage and an empty choices list, so check the list before reading from it.
Limits and billing
| Tier | Requests per day | Max answer length | Keys | Cost |
|---|---|---|---|---|
| Explorer | 20 | 1,000 tokens | 1 | Free |
| Holder | 250 | 4,000 tokens | 5 | Free, funded by the treasury |
| Builder | No cap | Model limit | Unlimited | Model cost + 15%, prepaid in USDG or ETH |
Allowances reset at 00:00 UTC. Explorer and Holder responses include x-dualyne-remaining so your app can see how many requests are left today. A larger max_tokens than your tier allows is lowered to the cap. Each key can send up to 120 requests a minute.
Builder wallets top up with USDG or ETH from the dashboard. Each request reserves its worst-case cost (model price + 15%) and is then charged the real amount; the difference goes straight back to your balance. The dashboard lists every top-up and what each key spent.
Free tiers share a daily budget paid for by the treasury. On the rare day it runs out, free requests return 429 until 00:00 UTC; Builder requests keep working.
Errors
| Status | Meaning | What to do |
|---|---|---|
400 | The request body is invalid | Read the message; it names the field |
401 | Key missing, wrong or revoked | Check the key or create a new one |
402 | Builder credit too low for this request | Top up in the dashboard, or lower max_tokens |
403 | Model not in your tier | Hold the token or top up credits |
404 | Unknown model id | Use an id from GET /v1/models |
429 | Daily allowance used up, too many requests per minute, or free capacity briefly full (budget_busy) | Wait for the time in the Retry-After header, or top up credits |
502 | The model provider failed | Retry once, or switch models |
Errors use the OpenAI format, so SDKs raise them as normal exceptions:
{
"error": {
"message": "Daily allowance used up (20 requests for Explorer). It resets at 00:00 UTC.",
"type": "rate_limit_error",
"code": "quota_exceeded"
}
}