Quick Start

Get started with the Dragonfly API in 3 steps.

1

Create an account

Sign up at dragonfly.dev — you get $1 free credit.

2

Get your API key

Go to Dashboard → API Keys → Create Key.

3

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-xxxxxxxxxxxxxxxxxxxx

Get your API key from the Dashboard. Keep it secret — treat it like a password.

Chat Completions

Create a chat completion. OpenAI-compatible.

POST/v1/chat/completions

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel ID (e.g. deepseek/deepseek-chat)
messagesarrayYesArray of message objects with role and content
temperaturenumberNoSampling temperature (0-2). Default: 1
top_pnumberNoNucleus sampling. Default: 1
max_tokensintegerNoMaximum tokens to generate
streambooleanNoStream response via SSE. Default: false
stopstring|arrayNoStop sequences
frequency_penaltynumberNoFrequency penalty (-2 to 2). Default: 0
presence_penaltynumberNoPresence penalty (-2 to 2). Default: 0
toolsarrayNoFunction calling tools (OpenAI format)
tool_choicestring|objectNoTool 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

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/messages
import 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)
ParameterTypeRequiredDescription
modelstringYesModel ID (e.g., deepseek/deepseek-chat)
max_tokensintegerYesMaximum tokens to generate
messagesarrayYesArray of message objects with role and content
systemstringNoSystem prompt
streambooleanNoEnable SSE streaming
temperaturenumberNoSampling temperature (0-1)
stop_sequencesarrayNoCustom 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.

GET/v1/models
curl https://api.dragonfly.dev/v1/models
Response
{
  "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.

POST/v1/audio/transcriptions
ParameterTypeRequiredDescription
filefileYesAudio file (mp3, wav, m4a, webm)
modelstringNoModel ID. Default: whisper-1
languagestringNoISO 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
Response
{
  "text": "Hello, how are you today?"
}

Audio Speech (TTS)

Generate speech from text.

POST/v1/audio/speech
ParameterTypeRequiredDescription
modelstringYesTTS model ID
inputstringYesText to speak
voicestringNoVoice ID. Default: alloy
speednumberNoSpeed (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.mp3

Crypto Payment

Create a USDT payment to add credits.

POST/v1/billing/crypto/create-payment
ParameterTypeRequiredDescription
amount_centsintegerYesAmount 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}'
Response
{
  "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 IDInputOutputContextCapabilities
deepseek/deepseek-chat$0.50$1.50128KChat, Code
deepseek/deepseek-reasoner$2.00$8.00128KReasoning
deepseek/janus-pro-7bImage Gen

Qwen

Model IDInputOutputContextCapabilities
qwen/qwen3-235b-a22b$1.00$4.00128KChat, Code
qwen/qwen3-30b-a3b$0.50$2.00128KChat
qwen/wan2.1-t2vVideo Gen

Moonshot

Model IDInputOutputContextCapabilities
moonshot/kimi-k2$1.00$4.00128KChat, Agents

Zhipu

Model IDInputOutputContextCapabilities
zhipu/glm-5-0131$1.00$4.00128KMultimodal

Doubao

Model IDInputOutputContextCapabilities
doubao/doubao-1.5-pro-256k$0.30$0.90256KChat

Rate Limits

PlanRequests/minTokens/min
Free1040,000
Starter60200,000
Pro3001,000,000
EnterpriseUnlimitedUnlimited

Rate limit headers are included in every response: X-RateLimit-Remaining, X-RateLimit-Reset.

Error Codes

CodeTypeDescription
400bad_requestInvalid request parameters
401unauthorizedMissing or invalid API key
403forbiddenInsufficient balance or permissions
429rate_limit_exceededToo many requests. Retry after X-RateLimit-Reset.
500internal_errorServer error. Retry with exponential backoff.
502upstream_errorUpstream provider error

Error Response Format

Response
{
  "error": {
    "message": "Insufficient balance",
    "type": "forbidden",
    "code": 403
  }
}