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
| Endpoint | Path | Billing model |
|---|---|---|
| Chat Completions | POST /v1/chat/completions | deepseek-flash |
| Responses | POST /v1/responses | Same as above |
| Messages (Anthropic format) | POST /v1/messages, POST /v1/messages/count_tokens | Same as above |
| Web search | POST /v1/tools/search | deepseek-search |
| Web fetch | POST /v1/tools/fetch | deepseek-fetch |
| OCR | POST /v1/tools/ocr | deepseek-ocr |
| Text-to-speech | POST /v1/tools/tts, or WebSocket on the same path | deepseek-tts |
| Speech recognition | POST /v1/tools/asr | deepseek-asr |
| Files | POST /v1/files, GET /v1/files, GET /v1/files/{id}, DELETE /v1/files/{id} | deepseek-files for document parsing |
| Balance | GET /user/balance | Free |
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 model | Billing unit | Default unit price |
|---|---|---|
deepseek-search | Each search that returns results | Β₯0.005 |
deepseek-fetch | Each successful fetch | Β₯0.005 |
deepseek-ocr | Successfully recognized pages | Β₯0.0015 / page |
deepseek-tts | Characters; each Chinese character counts as 2 | Β₯3 / 10,000 characters |
deepseek-asr | Audio seconds, rounded up to the next whole second | Β₯0.78 / hour |
deepseek-files | Document 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_recognitionorrich_layout_recognition, every 10 KiB counts as one page, with a minimum of 1 page and a maximum of 1000 pages. Uploads withuser_dataare 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_idparameter.
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_KEYrequest 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 namefilesfor Level mapping. If the Level contains multiple providers, mapfilesto 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_TTLenvironment 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.