API Reference

API Documentation

Compatible with the OpenAI SDK. Switch by changing base_url and api_key. For step-by-step tutorials, see the User Guide.

Authentication

All API requests require a valid API key sent via the Authorization header.

Header Value Description
Authorization Bearer sk-... Your API key with the sk- prefix

API keys are managed in your dashboard. You can create and revoke keys at any time.

Chat Completions

The primary endpoint for generating model responses. Fully compatible with the OpenAI Chat Completion API.

POST /v1/chat/completions

Request Parameters

Parameter Type Required Description
model string Yes Model identifier (e.g. deepseek-chat, glm-4-plus)
messages array Yes Array of message objects with role and content
temperature number No Sampling temperature (0-2, default: 1.0)
max_tokens number No Maximum tokens to generate (default: model maximum)
stream boolean No Enable streaming via SSE (default: false)
routing string No Routing strategy: auto, cheapest, fallback
provider_key object No BYOK mode: {provider, api_key}. When present, switches to BYOK billing

Example Request

curl https://api.find-token.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    "temperature": 0.7,
    "max_tokens": 500,
    "stream": false
  }'

Example Response

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1715212345,
  "model": "deepseek-chat",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Quantum computing uses quantum bits..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 142,
    "total_tokens": 167
  }
}

Response Headers

Header Description
X-FindToken-Mode Billing mode used: standard or byok
X-FindToken-Cost Cost in USD for this request (e.g. 0.00123)
X-FindToken-Balance Remaining credits balance (standard mode only)

Streaming (SSE)

Set stream: true to receive responses as Server-Sent Events. Compatible with OpenAI SSE format.

curl https://api.find-token.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Count to 5."}],
    "stream": true
  }'

Each event follows the SSE format with data: prefixes. The stream ends with data: [DONE].

BYOK Mode

Bring your own provider API key for each request. The key is validated but never stored on our servers.

curl https://api.find-token.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-findtoken-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-chat",
    "messages": [{"role": "user", "content": "Hello!"}],
    "provider_key": {
      "provider": "deepseek",
      "api_key": "sk-your-deepseek-key-here"
    }
  }'

You can pre-register your provider keys via the dashboard or the POST /v1/user/byok/register endpoint. Registration is optional but recommended for key validation.

User & Billing Endpoints

GET /v1/user/balance

Returns your current credits balance and BYOK usage for the current month.

Response

{
  "credits": 9.45,
  "credits_cents": 945,
  "byok_usage_month": 50000,
  "byok_limit_month": 1000000,
  "reset_date": "2026-06-01T00:00:00Z"
}
POST /v1/user/credits

Create a Stripe checkout session to recharge credits.

Request

{
  "amount": 20.00,
  "success_url": "https://app.find-token.com/dashboard",
  "cancel_url": "https://app.find-token.com/pricing"
}
POST /v1/user/byok/register

Register a BYOK provider key. The key is validated but never persisted to our database.

Request

{
  "provider": "deepseek",
  "api_key": "sk-...",
  "name": "My DeepSeek Account"
}

Error Codes

Status Code Description
400 Bad Request Invalid request body or parameters
401 Unauthorized Invalid or missing API key
402 Insufficient Credits Balance too low for the request (standard mode)
429 Rate Limited Exceeded 100 requests/second per key
500 Gateway Error Internal server error
502 Provider Error Upstream provider returned an error
503 All Providers Unavailable No healthy provider available for the requested model
504 Provider Timeout Upstream provider timed out after retries

Error Response Format

{
  "error": {
    "message": "Insufficient credits. Balance: $0.15, Required: $0.23",
    "type": "insufficient_balance",
    "code": "insufficient_credits",
    "param": null
  }
}

Available Models

Model ID Provider Input ($/1M tokens) Output ($/1M tokens)
Loading...

Prices in USD per 1M tokens. Data loaded from API in real-time.

Anthropic-Compatible API (Claude Code)

find-token offers an Anthropic-compatible endpoint that allows you to use Claude Code, Claude Desktop, and other Anthropic-protocol tools with Chinese AI models.

Configuration

Set the following environment variables to use find-token with Claude Code:

export ANTHROPIC_BASE_URL=https://api.find-token.com/anthropic
export ANTHROPIC_AUTH_TOKEN=sk-ft_your_api_key
export ANTHROPIC_MODEL=deepseek-v4-flash

Available Models

Model ID Provider Best For
deepseek-v4-flashDeepSeekGeneral purpose (recommended default)
deepseek-v4-proDeepSeekComplex reasoning, coding
glm-4-plusZhipu AIChinese language tasks
qwen-maxAlibaba CloudGeneral purpose
kimi-k2Moonshot AICoding & reasoning

Models Endpoint

Retrieve the list of available models:

curl https://api.find-token.com/anthropic/v1/models   -H "x-api-key: sk-ft_your_key"

Rate Limiting

Rate limits are applied per API key on a rolling 60-second window.

Limit Window Scope
100 requests 1 second Per API key

When exceeded, the API returns a 429 status code. Implement exponential backoff in your client to handle rate limits gracefully.