DeepSeek Full-Suite Integration

XSI passes DeepSeek requests straight through: the request body is forwarded as is (only model is rewritten according to model mapping), and the response is returned unchanged. Every parameter and response field in DeepSeek's official documentation works directly, including safety_check, title, latest_reminder, deepseek_web_search, and deepseek_read_url.

Every path works with or without the /v1 prefix. Authenticate with Authorization: Bearer $XSI_API_KEY or x-api-key: $XSI_API_KEY.

Endpoints

EndpointPathBilling model
Chat CompletionsPOST /v1/chat/completionsdeepseek-flash
ResponsesPOST /v1/responsesSame as above
Messages (Anthropic format)POST /v1/messages, POST /v1/messages/count_tokensSame as above
Web searchPOST /v1/tools/searchdeepseek-search
Web fetchPOST /v1/tools/fetchdeepseek-fetch
OCRPOST /v1/tools/ocrdeepseek-ocr
Text-to-speechPOST /v1/tools/tts, or WebSocket on the same pathdeepseek-tts
Speech recognitionPOST /v1/tools/asrdeepseek-asr
FilesPOST /v1/files, GET /v1/files, GET /v1/files/{id}, DELETE /v1/files/{id}deepseek-files for document parsing
BalanceGET /user/balanceFree

Chat and web tools

All three protocols support the server-side web tools. Here is a Chat Completions example:

curl $XSI_BASE_URL/v1/chat/completions \
  -H "Authorization: Bearer $XSI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-flash",
    "thinking": {"type": "enabled"},
    "tools": [{"type": "deepseek_web_search"}, {"type": "deepseek_read_url"}],
    "messages": [{"role": "user", "content": "What is new in DeepSeek V4.1?"}],
    "stream": true
  }'

Billing is based on the final usage reported by the upstream: input, cache-hit, and output tokens, plus the number of web tool calls. The tool call count is the sum of tool_search, tool_fetch, and tool_image_search in usage.server_tool_use, billed at the model's Query unit price.

Billing units for tool endpoints

Billing modelBilling unitDefault unit price
deepseek-searchEach search that returns resultsΒ₯0.005
deepseek-fetchEach successful fetchΒ₯0.005
deepseek-ocrSuccessfully recognized pagesΒ₯0.0015 / page
deepseek-ttsCharacters; each Chinese character counts as 2Β₯3 / 10,000 characters
deepseek-asrAudio seconds, rounded up to the next whole secondΒ₯0.78 / hour
deepseek-filesDocument parsing pages, estimated from file sizeΒ₯0.0015 / page

Searches with no results and failed requests are not billed.

Files

Uploading, referencing, querying, and deleting files work the same as in DeepSeek's official API, in both OpenAI and Anthropic formats. The Anthropic format requires the anthropic-beta: files-api-2025-04-14 request header.

curl $XSI_BASE_URL/v1/files \
  -H "Authorization: Bearer $XSI_API_KEY" \
  -F purpose="text_recognition" \
  -F file="@report.pdf"

Things to know:

  • A file belongs only to the user who uploaded it. The file list shows only the user's own registered files; other users who retrieve, delete, or reference it in a conversation by ID get a 400.
  • Document parsing is billed by page count estimated from file size. For uploads with text_recognition or rich_layout_recognition, every 10 KiB counts as one page, with a minimum of 1 page and a maximum of 1000 pages. Uploads with user_data are free.
  • The file list only includes files uploaded in the same format. Files uploaded in OpenAI format appear in the OpenAI-format list, and the same applies to Anthropic format. Retrieving, deleting, and referencing by ID are not subject to this restriction.
  • The list does not support the before_id parameter.

Text-to-speech WebSocket

Connect to wss://<XSI domain>/v1/tools/tts; the message format is the same as DeepSeek's official API. Two authentication methods are supported:

  • The Authorization: Bearer $XSI_API_KEY request header.
  • In browsers, where request headers cannot be set, the subprotocol Sec-WebSocket-Protocol: tts, bearer.$XSI_API_KEY.

Each session is billed by the number of characters sent.

Balance

GET /user/balance returns your XSI balance in DeepSeek's format:

{
  "is_available": true,
  "balance_infos": [
    {"currency": "CNY", "total_balance": "110.00", "granted_balance": "0.00", "topped_up_balance": "110.00"}
  ]
}

Notes for administrators

  • After you add a key whose provider is https://api.deepseek.com, deepseek* is mapped to that Level automatically, and every billing model in the tables above matches this rule.
  • File upload (user_data) and file list requests carry no model information, so they use the model name files for Level mapping. If the Level contains multiple providers, map files to the Level that holds DeepSeek.
  • All of a user's files are pinned to the same upstream account, and chat requests that reference those files are sent to that account as well.
  • The file registry is stored in Redis and, by default, kept for 3 years after the user's last upload. Adjust this with the FILE_REGISTRY_TTL environment variable. When a user is deleted, the registry entries are deleted first, then the upstream files are deleted on a best-effort basis (if the upstream key is unavailable or deletion fails, upstream files may remain).
  • The default unit prices are DeepSeek's peak-hour list prices and can be changed in pricing.
  • The billing models for tools and document parsing are valid only on their own endpoints: they cannot be used on chat endpoints or swapped for other models through model mapping. Otherwise the request gets a 400.