Quick Start
Get started with the Dragonfly API in 3 steps.
Create an account
Sign up at dragonfly.dev — you get $1 free credit.
Get your API key
Go to Dashboard → API Keys → Create Key.
Make your first request
Use any OpenAI-compatible SDK. Just change the base URL.
curl https://api.dragonfly.dev/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 API requests require a Bearer token in the Authorization header.
Authorization: Bearer sk-df-xxxxxxxxxxxxxxxxxxxxGet your API key from the Dashboard. Keep it secret — treat it like a password.
Chat 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://api.dragonfly.dev/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
}
}Claude Messages API
Dragonfly supports the Anthropic Messages API format natively. Use any Anthropic SDK pointed at Dragonfly.
Endpoint
POST /v1/messagesimport anthropic
client = anthropic.Anthropic(
base_url="https://dragonfly-api.com",
api_key="sk-df-your-key-here"
)
message = client.messages.create(
model="deepseek/deepseek-chat",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(message.content[0].text)| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model ID (e.g., deepseek/deepseek-chat) |
| max_tokens | integer | Yes | Maximum tokens to generate |
| messages | array | Yes | Array of message objects with role and content |
| system | string | No | System prompt |
| stream | boolean | No | Enable SSE streaming |
| temperature | number | No | Sampling temperature (0-1) |
| stop_sequences | array | No | Custom stop sequences |
💡 Multi-Format Support
Dragonfly supports both OpenAI (/v1/chat/completions) and Anthropic (/v1/messages) API formats. Use whichever SDK you prefer — same models, same pricing.
List Models
List all available models.
/v1/modelscurl https://api.dragonfly.dev/v1/models{
"object": "list",
"data": [
{
"id": "deepseek/deepseek-chat",
"object": "model",
"owned_by": "deepseek",
"pricing": { "input": 0.0005, "output": 0.0015 }
}
]
}Audio Transcriptions (ASR)
Transcribe audio to text.
/v1/audio/transcriptions| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | Audio file (mp3, wav, m4a, webm) |
| model | string | No | Model ID. Default: whisper-1 |
| language | string | No | ISO language code (e.g. en, zh) |
curl https://api.dragonfly.dev/v1/audio/transcriptions \
-H "Authorization: Bearer sk-df-xxx" \
-F file=@audio.mp3 \
-F model=whisper-1{
"text": "Hello, how are you today?"
}Audio Speech (TTS)
Generate speech from text.
/v1/audio/speech| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | TTS model ID |
| 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://api.dragonfly.dev/v1/audio/speech \
-H "Authorization: Bearer sk-df-xxx" \
-H "Content-Type: application/json" \
-d '{"model": "tts-1", "input": "Hello world", "voice": "alloy"}' \
--output speech.mp3Crypto Payment
Create a USDT payment to add credits.
/v1/billing/crypto/create-payment| Parameter | Type | Required | Description |
|---|---|---|---|
| amount_cents | integer | Yes | Amount in cents (e.g. 1000 = $10.00) |
curl https://api.dragonfly.dev/v1/billing/crypto/create-payment \
-H "Authorization: Bearer sk-df-xxx" \
-H "Content-Type: application/json" \
-d '{"amount_cents": 1000}'{
"payment_id": "pay_abc123",
"amount_usdt": "10.00",
"address": "TXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"network": "TRC-20",
"expires_at": "2026-02-17T22:00:00Z"
}Models & 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 |
| deepseek/janus-pro-7b | — | — | — | Image Gen |
Qwen
| Model ID | Input | Output | Context | Capabilities |
|---|---|---|---|---|
| qwen/qwen3-235b-a22b | $1.00 | $4.00 | 128K | Chat, Code |
| qwen/qwen3-30b-a3b | $0.50 | $2.00 | 128K | Chat |
| qwen/wan2.1-t2v | — | — | — | Video Gen |
Moonshot
| Model ID | Input | Output | Context | Capabilities |
|---|---|---|---|---|
| moonshot/kimi-k2 | $1.00 | $4.00 | 128K | Chat, Agents |
Zhipu
| Model ID | Input | Output | Context | Capabilities |
|---|---|---|---|---|
| zhipu/glm-5-0131 | $1.00 | $4.00 | 128K | Multimodal |
Doubao
| Model ID | Input | Output | Context | Capabilities |
|---|---|---|---|---|
| doubao/doubao-1.5-pro-256k | $0.30 | $0.90 | 256K | Chat |
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
}
}