Quick Start
Get started with Dragonfly market routing in 3 steps.
Create an account
Sign up at dragonfly.dev β you get $1 free credit.
Create access key + routing profile
Go to Dashboard β Access Keys and bind a routing strategy.
Make your first matched request
Use any OpenAI-compatible SDK and route through market policy.
curl https://dragonfly-api.com/v1/chat/completions \
-H "Authorization: Bearer sk-df-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-chat",
"messages": [{"role": "user", "content": "Hello!"}]
}'Authentication
All requests require a Bearer token in the Authorization header.
Authorization: Bearer sk-df-xxxxxxxxxxxxxxxxxxxxGet your access key from the Dashboard.
First request failed?
Key creation stays locked until email verification completes.
Open verification401s usually mean the request is using an old key, a partial copy, or the wrong prefix.
Open buyer keysUse the live starter model instead of cached or outdated examples.
Open quick startNo eligible seller channel was healthy enough for the current constraints.
Open playgroundChat Completions
Create a chat completion. OpenAI-compatible.
/v1/chat/completionsRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID (e.g. deepseek/deepseek-chat) |
| messages | array | Yes | Array of message objects with role and content |
| temperature | number | No | Sampling temperature (0-2). Default: 1 |
| top_p | number | No | Nucleus sampling. Default: 1 |
| max_tokens | integer | No | Maximum tokens to generate |
| stream | boolean | No | Stream response via SSE. Default: false |
| stop | string|array | No | Stop sequences |
| frequency_penalty | number | No | Frequency penalty (-2 to 2). Default: 0 |
| presence_penalty | number | No | Presence penalty (-2 to 2). Default: 0 |
| tools | array | No | Function calling tools (OpenAI format) |
| tool_choice | string|object | No | Tool selection mode |
Request Example
curl https://dragonfly-api.com/v1/chat/completions \
-H "Authorization: Bearer sk-df-xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-chat",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is 2+2?"}
],
"temperature": 0.7,
"max_tokens": 1024
}'Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1709000000,
"model": "deepseek/deepseek-chat",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "2 + 2 = 4"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 8,
"total_tokens": 33
}
}Market Routing
Dragonfly operates a market where third-party providers contribute API keys at discounted prices. Routing-Strategy
Routing-Strategy Header
| Parameter | Type | Required | Description |
|---|---|---|---|
| market-only | default | No | Use marketplace seller capacity only. Fails with 503 if no eligible seller is available. Requires accepted Trading Terms. |
The default strategy is market-only.
If no eligible seller is available, the API returnsmarket_unavailable(503).
Note: market-only requires that you accept the Trading Terms in your Dashboard.
curl https://dragonfly-api.com/v1/chat/completions \
-H "Authorization: Bearer sk-df-xxx" \
-H "Content-Type: application/json" \
-H "Routing-Strategy: market-only" \
-d '{
"model": "deepseek/deepseek-chat",
"messages": [{"role": "user", "content": "Hello!"}]
}'Session Stickiness (Optional)
When using market routing, you can pass an X-Session-Id header to keep consecutive requests routed to the same provider key. This is useful for multi-turn conversations where provider-level context caching may improve latency.
X-Session-Id: my-chat-session-123Performance Preferences
Latency/throughput constraints are soft by default (affect ranking, not hard rejection). Use hard headers only when strict filtering is required.
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Max-Price | header | No | Max acceptable input-side price (hard filter). |
| X-Max-TTFT-Ms | header | No | Preferred max TTFT (soft preference). |
| X-Min-Throughput-TPS | header | No | Preferred minimum throughput (soft preference). |
| X-Hard-Max-TTFT-Ms | header | No | Strict max TTFT filter. |
| X-Hard-Min-Throughput-TPS | header | No | Strict minimum throughput filter. |
| X-Privacy-Mode | header | No | Privacy filter: trusted_only. |
Provider Controls
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-Provider-Only | header | No | Comma-separated provider allowlist (hard filter). |
| X-Provider-Ignore | header | No | Comma-separated provider denylist (hard filter). |
| X-Provider-Order | header | No | Comma-separated provider preference order (soft ranking). |
Route Diagnostics Headers
Successful market responses include debug headers for tracing route decisions. These headers are used by the Playground route diagnostics panel.
| Parameter | Type | Required | Description |
|---|---|---|---|
| X-DF-Market-Route | response header | No | seller. |
| X-DF-Market-Provider | response header | No | Matched provider slug. |
| X-DF-Market-Listing-Id | response header | No | Matched listing ID (seller route). |
| X-DF-Market-Request-Id | response header | No | Matching request ID. |
| X-DF-Upstream-Model | response header | No | Resolved upstream model. |
| X-DF-Market-Ask-Input | response header | No | Input ask price used by settlement. |
| X-DF-Market-Ask-Output | response header | No | Output ask price used by settlement. |
| X-DF-Market-Fee-Profile-Id | response header | No | Applied fee profile ID if available. |
List Models
List all available models.
/v1/modelscurl https://dragonfly-api.com/v1/models{
"object": "list",
"data": [
{
"id": "deepseek/deepseek-chat",
"object": "model",
"owned_by": "deepseek",
"pricing": { "input": 0.0005, "output": 0.0015 }
}
]
}Audio Speech (TTS)
Generate speech from text. Powered by MiniMax.
/v1/audio/speech| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | minimax/speech-02-hd or minimax/speech-02-turbo |
| input | string | Yes | Text to speak |
| voice | string | No | Voice ID. Default: alloy |
| speed | number | No | Speed (0.25-4.0). Default: 1.0 |
curl https://dragonfly-api.com/v1/audio/speech \
-H "Authorization: Bearer sk-df-xxx" \
-H "Content-Type: application/json" \
-d '{"model": "minimax/speech-02-hd", "input": "Hello world", "voice": "alloy"}' \
--output speech.mp3Models & Pricing
Prices per million tokens.
DeepSeek
| Model ID | Input | Output | Context | Capabilities |
|---|---|---|---|---|
| deepseek/deepseek-chat | $0.50 | $1.50 | 128K | Chat, Code |
| deepseek/deepseek-reasoner | $2.00 | $8.00 | 128K | Reasoning |
MiniMax
| Model ID | Input | Output | Context | Capabilities |
|---|---|---|---|---|
| minimax/minimax-m2.5 | $0.80 | $2.40 | 1M | Chat |
| minimax/minimax-m2.5-highspeed | $0.40 | $1.20 | 1M | Chat (fast) |
| minimax/speech-02-hd | β | β | β | TTS (HD) |
| minimax/speech-02-turbo | β | β | β | TTS (fast) |
Rate Limits
| Plan | Requests/min | Tokens/min |
|---|---|---|
| Free | 10 | 40,000 |
| Starter | 60 | 200,000 |
| Pro | 300 | 1,000,000 |
| Enterprise | Unlimited | Unlimited |
Rate limit headers are included in every response: X-RateLimit-Remaining, X-RateLimit-Reset.
Error Codes
| Code | Type | Description |
|---|---|---|
| 400 | bad_request | Invalid request parameters |
| 401 | unauthorized | Missing or invalid API key |
| 403 | forbidden | Insufficient balance or permissions |
| 429 | rate_limit_exceeded | Too many requests. Retry after X-RateLimit-Reset. |
| 500 | internal_error | Server error. Retry with exponential backoff. |
| 502 | upstream_error | Upstream provider error |
Error Response Format
{
"error": {
"message": "Insufficient balance",
"type": "forbidden",
"code": 403
}
}