{"openapi":"3.0.0","info":{"description":"Frontier open-weight LLMs with an OpenAI-compatible API: chat completions, the Responses API, FIM code completion, native vision input, a Files API, web search/fetch tools and an Anthropic-compatible endpoint","version":[]},"servers":[{"description":"Frontier open-weight LLMs with an OpenAI-compatible API: chat completions, the Responses API, FIM code completion, native vision input, a Files API, web search/fetch tools and an Anthropic-compatible endpoint","url":"https://api.apirails.com/deepseek"}],"paths":{"/chat/completions":{"post":{"tags":["Chat"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/create-chat-completion","api_endpoint":"https://api.deepseek.com/chat/completions"},"summary":"Create Chat Completion","description":"Creates a model response for the given chat conversation. With deepseek-flash, message content may include image_url / file blocks for vision input.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"frequency_penalty":{"type":"number","description":"Frequency Penalty"},"logprobs":{"type":"boolean","description":"Whether to return log probabilities of the output tokens or not","enum":[true,false]},"max_tokens":{"type":"number","description":"Max Tokens"},"messages":{"type":"array","description":"A list of messages comprising the conversation so far. content may be a plain string or an array of blocks (text, image_url, or file) for vision input with deepseek-flash.","required":true,"items":{"type":"string"}},"model":{"type":"string","description":"ID of the model to use: deepseek-flash (latest, multimodal) or deepseek-v4-pro.","required":true},"presence_penalty":{"type":"number","description":"Presence Penalty"},"reasoning_effort":{"type":"string","description":"Thinking-mode effort. Accepted values: minimal, low, medium, high, xhigh, max, ultra (mapped internally to low/high/max; default high)."},"response_format":{"type":"object","description":"An object specifying the format that the model must output","properties":{}},"stop":{"type":"string","description":"Up to 4 sequences where the API will stop generating further tokens."},"stream":{"type":"boolean","description":"If set, partial message deltas will be sent.","enum":[true,false]},"stream_options":{"type":"object","description":"Options for streaming response. Only set this when you set stream: true","properties":{}},"temperature":{"type":"number","description":"Sampling temperature between 0 and 2. Has no effect while thinking mode is enabled."},"thinking":{"type":"object","description":"Enable or disable thinking mode (enabled by default). temperature/presence_penalty/frequency_penalty have no effect while enabled.","properties":{"type":{"type":"string","description":"Whether thinking mode is enabled","enum":["enabled","disabled"]}}},"tool_choice":{"type":"object","description":"Tool Choice","properties":{}},"tools":{"type":"object","description":"Stop","properties":{}},"top_logprobs":{"type":"number","description":"An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability"},"top_p":{"type":"number","description":"Top P"}}},"example":{"frequency_penalty":"","logprobs":"","max_tokens":"","messages":[],"model":["deepseek-flash"],"presence_penalty":"","reasoning_effort":["high"],"response_format":{},"stop":"","stream":"","stream_options":{},"temperature":"","thinking":{},"tool_choice":{},"tools":{},"top_logprobs":"","top_p":""}}}}}},"/responses":{"post":{"tags":["Responses"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/create-response","api_endpoint":"https://api.deepseek.com/responses"},"summary":"Create Response","description":"Creates a model response in the OpenAI Responses API format (stateless; previous_response_id is not supported).","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"text":{"type":"object","description":"Output format control (text.format fully supported, e.g. json_object).","properties":{}},"input":{"type":"string","description":"Text or a list of input items (message / function_call / function_call_output / reasoning items) in OpenAI Responses format. Images go in input_image parts (image_url or file_id). At least one of input or instructions is required."},"instructions":{"type":"string","description":"Inserted as the first system message."},"max_output_tokens":{"type":"number","description":"Maximum number of tokens generated."},"model":{"type":"string","description":"ID of the model to use: deepseek-flash (multimodal) or deepseek-v4-pro.","required":true},"reasoning":{"type":"object","description":"Thinking-mode control (OpenAI Responses format).","properties":{"effort":{"type":"string","description":"Reasoning effort; none disables thinking mode.","enum":["none","low","high","max"]}}},"stream":{"type":"boolean","description":"If set, the response is streamed as server-sent events.","enum":[true,false]},"temperature":{"type":"number","description":"Sampling temperature between 0.0 and 2.0. No effect in thinking mode."},"tool_choice":{"type":"object","description":"none / auto / required / a specific function tool.","properties":{}},"tools":{"type":"object","description":"Tool definitions: function supported; web_search supported with deepseek-v4-pro; other tool types are ignored.","properties":{}},"top_logprobs":{"type":"number","description":"0-20 most likely tokens per position returned with log probabilities."},"top_p":{"type":"number","description":"Nucleus sampling. Effective range depends on model and thinking mode."},"user":{"type":"string","description":"End-user identifier for rate-limit isolation."}}},"example":{"text":{},"input":["Hello!"],"instructions":"","max_output_tokens":"","model":["deepseek-flash"],"reasoning":{},"stream":"","temperature":"","tool_choice":{},"tools":{},"top_logprobs":"","top_p":"","user":""}}}}}},"/beta/completions":{"post":{"tags":["Completions"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/create-completion","api_endpoint":"https://api.deepseek.com/beta/completions"},"summary":"Create FIM Completion (Beta)","description":"The FIM (Fill-In-the-Middle) Completion API.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"echo":{"type":"boolean","description":"Echo back the prompt in addition to the completion","enum":[true,false]},"frequency_penalty":{"type":"number","description":"Frequency Penalty"},"logprobs":{"type":"boolean","description":"Whether to return log probabilities of the output tokens or not","enum":[true,false]},"max_tokens":{"type":"number","description":"The maximum number of tokens that can be generated in the completion."},"model":{"type":"string","description":"ID of the model to use, e.g. deepseek-flash.","required":true},"presence_penalty":{"type":"number","description":"Presence Penalty"},"prompt":{"type":"string","description":"The code before the completion cursor (prefix). The model completes the middle between prompt and suffix.","required":true},"stop":{"type":"object","description":"Stop","properties":{}},"stream":{"type":"boolean","description":"If set, partial message deltas will be sent.","enum":[true,false]},"stream_options":{"type":"object","description":"Options for streaming response. Only set this when you set stream: true","properties":{}},"suffix":{"type":"string","description":"The suffix that comes after a completion of inserted text."},"temperature":{"type":"number","description":"Sampling temperature between 0 and 2. Has no effect while thinking mode is enabled."},"top_p":{"type":"number","description":"An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass."}}},"example":{"echo":"","frequency_penalty":"","logprobs":"","max_tokens":"","model":["deepseek-flash"],"presence_penalty":"","prompt":"","stop":{},"stream":"","stream_options":{},"suffix":"","temperature":"","top_p":""}}}}}},"/files":{"post":{"tags":["Files"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/create-file","api_endpoint":"https://api.deepseek.com/files"},"summary":"Upload File","description":"Uploads an image (JPEG, PNG, GIF, WebP; max 64 MiB) that can be referenced by file_id in chat and responses requests.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"expires_after[anchor]":{"type":"string","description":"Must be created_at. Required together with expires_after[seconds].","enum":["created_at"]},"expires_after[seconds]":{"type":"number","description":"Lifetime in seconds, 3600-2592000 (1 hour to 30 days). Omit both expires_after fields to keep the file permanently."},"file":{"type":"string","format":"binary","description":"The image file to upload (JPEG, PNG, GIF, or WebP; at most 64 MiB).","required":true},"purpose":{"type":"string","description":"Purpose of the upload. Must be user_data.","required":true,"enum":["user_data"]}}},"example":{"expires_after[anchor]":["created_at"],"expires_after[seconds]":[86400],"file":["(binary file)"],"purpose":["user_data"]}}}}},"get":{"tags":["Files"],"parameters":[{"name":"after","in":"query","description":"A file_id cursor for pagination; returns files after this one.","required":false,"schema":{"type":"string","example":""}},{"name":"limit","in":"query","description":"Number of files to return, 1-1000.","required":false,"schema":{"type":"number","example":""}},{"name":"order","in":"query","description":"Sort order by creation time.","required":false,"schema":{"type":"string","example":"","items":{"type":"string","enum":["asc","desc"]}}},{"name":"purpose","in":"query","description":"Filter by purpose. Only user_data is supported.","required":false,"schema":{"type":"string","example":""}}],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/list-files","api_endpoint":"https://api.deepseek.com/files"},"summary":"List Files","description":"Returns the account's uploaded files, most recently paginated by file_id cursor.","security":[{"bearerAuth":[]}]}},"/files/{file_id}":{"get":{"tags":["Files"],"parameters":[{"name":"file_id","in":"path","description":"The ID of the file to retrieve.","required":true,"schema":{"type":"string","example":""}}],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/retrieve-file","api_endpoint":"https://api.deepseek.com/files/{file_id}"},"summary":"Retrieve File","description":"Returns metadata for a previously uploaded file.","security":[{"bearerAuth":[]}]},"delete":{"tags":["Files"],"parameters":[{"name":"file_id","in":"path","description":"The ID of the file to delete.","required":true,"schema":{"type":"string","example":""}}],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/delete-file","api_endpoint":"https://api.deepseek.com/files/{file_id}"},"summary":"Delete File","description":"Deletes a previously uploaded file.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{}},"example":{}}}}}},"/v1/tools/search":{"post":{"tags":["Tools"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/search","api_endpoint":"https://api.deepseek.com/v1/tools/search"},"summary":"Web Search","description":"Web search powered by DeepSeek's in-house search engine; returns structured results with snippet, summary and optional full content.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"count":{"type":"number","description":"Number of results to return, 1-50 (default 10)."},"localization":{"type":"string","description":"Optional client IP address used to localize search results."},"need_content":{"type":"boolean","description":"Return the full page content in each result (default false).","enum":[true,false]},"ori_question":{"type":"string","description":"The user's original question that triggered the search (1-128 chars), to improve query understanding."},"query":{"type":"string","description":"Search query, 1-128 characters. Supports operators: site:, -site:, -, -\"...\", \"...\", lang:, after:, before:.","required":true}}},"example":{"count":[5],"localization":"","need_content":[false],"ori_question":"","query":["DeepSeek V4 release"]}}}}}},"/v1/tools/fetch":{"post":{"tags":["Tools"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/fetch","api_endpoint":"https://api.deepseek.com/v1/tools/fetch"},"summary":"Fetch Page","description":"Fetches a single web page and returns its content as Markdown.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"url":{"type":"string","description":"The page URL to fetch: at most 8192 characters, http/https with a host, no username or password.","required":true}}},"example":{"url":["https://example.com/article"]}}}}}},"/anthropic/messages":{"post":{"tags":["Messages"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/guides/anthropic_api","api_endpoint":"https://api.deepseek.com/anthropic/messages"},"summary":"Create Message (Anthropic-compatible)","description":"Anthropic-compatible Messages endpoint. DeepSeek model names are required; claude-opus* maps to deepseek-v4-pro and other claude* names map to deepseek-flash. x-api-key or Bearer auth are both accepted.","security":[{"bearerAuth":[]}],"requestBody":{"description":"","required":true,"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"max_tokens":{"type":"number","description":"The maximum number of tokens to generate.","required":true},"messages":{"type":"array","description":"A list of messages comprising the conversation so far. content blocks support text, image (base64/url/file), thinking and tool_use.","required":true,"items":{"type":"string"}},"model":{"type":"string","description":"DeepSeek model to use (claude* aliases are mapped server-side).","required":true},"stop_sequences":{"type":"array","description":"Custom sequences where the model stops generating.","items":{"type":"string"}},"stream":{"type":"boolean","description":"If set, the response is streamed as server-sent events.","enum":[true,false]},"system":{"type":"string","description":"System prompt."},"temperature":{"type":"number","description":"Sampling temperature, 0.0-2.0."},"thinking":{"type":"object","description":"Extended thinking control (budget_tokens is ignored).","properties":{}},"tool_choice":{"type":"object","description":"none / auto / any / tool.","properties":{}},"tools":{"type":"object","description":"Tool definitions (name, description, input_schema).","properties":{}},"top_p":{"type":"number","description":"Nucleus sampling."},"user_id":{"type":"string","description":"End-user identifier for rate-limit isolation."}}},"example":{"max_tokens":"","messages":[],"model":["deepseek-flash"],"stop_sequences":[],"stream":"","system":"","temperature":"","thinking":{},"tool_choice":{},"tools":{},"top_p":"","user_id":""}}}}}},"/models":{"get":{"tags":["Models"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/list-models","api_endpoint":"https://api.deepseek.com/models"},"summary":"Lists Models","description":"Lists the currently available models, and provides basic information about each one such as the owner and availability.","security":[{"bearerAuth":[]}]}},"/user/balance":{"get":{"tags":["Others"],"parameters":[],"responses":{"401":{"description":"Bearer token required (Authorization header)","content":{"application/json":{}}}},"externalDocs":{"api_ref":"https://api-docs.deepseek.com/api/get-user-balance","api_endpoint":"https://api.deepseek.com/user/balance"},"summary":"Get User Balance","description":"Returns the current remaining balance and grant amounts of the account.","security":[{"bearerAuth":[]}]}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"security":[{"bearerAuth":[]}]}