> **Building with AI coding agents?** Install the authstack plugin with one command. This equips your agent with accurate Scalekit implementation patterns.
>
> **Recommended** (the `-y` flags skip prompts, so the command runs without an interactive terminal):
> ```bash
> npx -y @scalekit-inc/cli setup -y
> ```
>
> Global:
> ```bash
> npm install -g @scalekit-inc/cli
> scalekit setup -y
> ```
>
> Supports Claude Code, Cursor, GitHub Copilot, Codex + skills for other Agent Skills-compatible agents in `~/.agents/skills`.
> Skills: integrate-agentkit, implement-saaskit, add-mcp-oauth, implement-sso, implement-scim.
> [Full setup guide](https://docs.scalekit.com/dev-kit/build-with-ai/)

---

# Connect AI agents to DeepSeek

The DeepSeek connector lets your AI agent act in each user's DeepSeek account. Each user connects their own DeepSeek access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 11 tools.

**Authentication:** Bearer Token
**Categories:** AI
**Tools:** 11: 6 read, 4 write, 1 destructive
**Users sign in with:** Access token
**Built by:** Scalekit connector
**Try it:** [Playground in the Scalekit dashboard](https://app.scalekit.com/ws/signup?sk_intent=playground&provider=DEEPSEEK)

## Setup

1. ### Install the SDK

   **Node.js**

   ```bash
   npm install @scalekit-sdk/node dotenv
   ```

   **Python**

   ```bash
   pip install scalekit-sdk-python python-dotenv
   ```

2. ### Set your credentials

   Add your Scalekit credentials to your `.env` file. Find values in **[app.scalekit.com](https://app.scalekit.com)** > **Developers** > **API Credentials**.

   ```sh title=".env"
   SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
   SCALEKIT_CLIENT_ID=<your-client-id>
   SCALEKIT_CLIENT_SECRET=<your-client-secret>
   ```

3. ### Create the DeepSeek connection

   In **AgentKit > Connections**, create a DeepSeek connection. The name you give it is the `connection_name` your code passes. See [Configure connections](/agentkit/connections/).

4. ### Authorize a user and make your first call

   **Node.js** (`quickstart.mts`)

   ```typescript
   import { ScalekitClient } from '@scalekit-sdk/node'
   import 'dotenv/config'
   import { createInterface } from 'node:readline/promises'

   const scalekit = new ScalekitClient(
     process.env.SCALEKIT_ENVIRONMENT_URL,
     process.env.SCALEKIT_CLIENT_ID,
     process.env.SCALEKIT_CLIENT_SECRET,
   )
   const actions = scalekit.actions

   const connector = 'deepseek'
   const identifier = 'user_123'

   // Generate an authorization link for the user
   const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
   console.log('Authorize DeepSeek:', link)
   const rl = createInterface({ input: process.stdin, output: process.stdout })
   await rl.question('Press Enter after authorizing...')
   rl.close()

   // Make your first call
   const result = await actions.executeTool({
     connector,
     identifier,
     toolName: 'deepseek_get_user_balance',
     toolInput: {},
   })
   console.log(result)
   ```

   ```bash
   npx tsx quickstart.mts
   ```

   **Python** (`quickstart.py`)

   ```python
   import os
   from scalekit import ScalekitClient
   from dotenv import load_dotenv
   load_dotenv()

   scalekit_client = ScalekitClient(
       env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),
       client_id=os.getenv("SCALEKIT_CLIENT_ID"),
       client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),
   )
   actions = scalekit_client.actions

   connection_name = "deepseek"
   identifier = "user_123"

   # Generate an authorization link for the user
   link_response = actions.get_authorization_link(
       connection_name=connection_name,
       identifier=identifier,
   )
   print("Authorize DeepSeek:", link_response.link)
   input("Press Enter after authorizing...")

   # Make your first call
   result = actions.execute_tool(
       tool_input={},
       tool_name="deepseek_get_user_balance",
       connection_name=connection_name,
       identifier=identifier,
   )
   print(result)
   ```

   ```bash
   python quickstart.py
   ```

   Each user opens the link once and enters their DeepSeek credentials there. See [Authorize a user](/agentkit/tools/authorize/) for the full flow and statuses.

## Tools

Pass the exact name to `execute_tool`, with an input like each tool's example. To ask for a tool that's missing, use the [request form](https://scalekitsupport.portal.usepylon.com/forms/request-a-connector-tool).

**Node.js**

```typescript
const result = await actions.executeTool({
  toolName: 'deepseek_fetch_url',
  toolInput: {
    url: '<url>',
  },
  connector: 'deepseek',
  identifier: 'user_123',
})
```

**Python**

```python
result = actions.execute_tool(
    tool_name="deepseek_fetch_url",
    tool_input={
        "url": "<url>",
    },
    connection_name="deepseek",
    identifier="user_123",
)
```

`result.data` is the app's response as JSON, and `result.execution_id` (`executionId` in Node.js) is the ID of the call.

### `deepseek_fetch_url`

Fetch URL · Read-only

Fetch one web page through DeepSeek and convert it to Markdown.
Returns the page title and its content as Markdown text.
Use this to read a specific URL, for example one returned by deepseek_search_web. A 404 means the page had no usable content or was blocked by the site. Billed per successful fetch.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `url` (`string`, required): HTTP or HTTPS URL to fetch, at most 8192 characters, without a username or password. Example: https://api-docs.deepseek.com/guides/thinking_mode

Example input: `{"url":"<url>"}`

### `deepseek_get_file`

Get File · Read-only

Get the metadata of one uploaded file by its id.
Returns id, filename, bytes, purpose, created_at and, if set at upload, expires_at. The file contents are not returned.
Use this to check that a file_id still exists before referencing it. Use deepseek_list_files to browse.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `file_id` (`string`, required): ID of the file to look up, of the form file-api-.... Get it from deepseek_list_files. Example: file-api-0a1b2c3d4e5f60718293a4b5c6d7e8f9

Example input: `{"file_id":"<file_id>"}`

### `deepseek_get_user_balance`

Get User Balance · Read-only

Get the DeepSeek account's current balance.
Returns is_available (whether the balance covers API calls) and balance_infos per currency (CNY or USD) with total, granted and topped-up amounts.
Use this to check funds before large jobs or to explain 402 Insufficient Balance errors.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `deepseek_list_files`

List Files · Read-only

List the image files uploaded to the DeepSeek account, with cursor pagination.
Returns a data array of file objects (id, filename, bytes, purpose, created_at, expires_at), plus first_id, last_id and has_more.
Use this to find a file_id for an image part in deepseek_create_chat_completion. Use deepseek_get_file when you already have the id.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `after` (`string`, optional): Pagination cursor: return files after this file id, usually the last_id of the previous page. Example: file-api-0a1b2c3d4e5f60718293a4b5c6d7e8f9
- `limit` (`integer`, optional): Number of files to return, 1 to 1000 (default 1000). Example: 100
- `order` (`string`, optional): Sort by creation time: asc (oldest first, default) or desc (newest first). One of: `asc`, `desc`.
- `purpose` (`string`, optional): Only return files with this purpose. user_data is the only value. One of: `user_data`.

Example input: `{}`

### `deepseek_list_models`

List Models · Read-only

List the DeepSeek models the API key can use.
Returns a data array of models with id, display name, context window, max output tokens, input modalities and supported reasoning effort levels.
Use this to pick a valid model id and its limits before calling deepseek_create_chat_completion or the other generation tools.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs: none.

Example input: `{}`

### `deepseek_search_web`

Search the Web · Read-only

Search the web with DeepSeek's search engine and return ranked results.
Returns results with title, url, snippet, a longer model-ready summary, rerank_score (0 to 3; 1.5 or more is high quality), authority tier, site name, publish date and, when need_content is true, page content.
Use this to find pages for a query. Use deepseek_fetch_url to read one known URL in full. Billed per successful non-empty search.

Read only: yes. Destructive: no. Idempotent (safe to retry): yes.

Inputs:

- `query` (`string`, required): Search query, 1 to 128 characters. Supports operators: site:, -site:, -term, "exact phrase", -"phrase", lang:zh,en, after:2025-01-01 and before:2026. Example: DeepSeek V4 site:github.com
- `count` (`integer`, optional): Number of results to return, 1 to 50. Defaults to 10. Example: 5
- `localization` (`string`, optional): An IP address used to localize results. Example: 203.0.113.7
- `need_content` (`boolean`, optional): When true, each result's content field carries the page text. When false (default), content is empty.
- `ori_question` (`string`, optional): The user's original question that led to this search (1 to 128 characters); improves query understanding. Example: When did DeepSeek release V4?

Example input: `{"query":"<query>"}`

### `deepseek_create_beta_chat_completion`

Create Beta Chat Completion · Write

Generate an assistant message through DeepSeek's beta chat endpoint (non-streaming), which adds chat prefix completion and strict-mode function calling to the regular chat API.
Returns the same chat completion object: choices with content, reasoning_content, tool_calls and finish_reason, plus token usage.
Use this when the reply must continue from an assistant prefix (last message has "prefix": true) or when tool arguments must match their JSON Schema exactly ("strict": true on each function). Otherwise use deepseek_create_chat_completion.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `messages` (`array`, required): Conversation so far as a JSON array of message objects. Each has a role (system, user, assistant, or tool) and content. User content can also be an array of content parts, for example text plus an image_url part (images work with deepseek-flash only). Assistant messages that requested tools carry tool_calls, and each tool result is a tool message with the matching tool_call_id. When tools are used in thinking mode, pass every earlier assistant message back unchanged, including its reasoning_content, or the API returns 400. For chat prefix completion, make the last message an assistant message with "prefix": true; the model continues from its content. Example: [{"role":"user","content":"Write quick sort in Python"},{"role":"assistant","content":"```python\n","prefix":true}]
- `model` (`string`, required): DeepSeek model to use: deepseek-flash (DeepSeek-V4.1-Flash, fast and cheap, accepts image input) or deepseek-v4-pro (DeepSeek-V4-Pro, stronger, text only). One of: `deepseek-flash`, `deepseek-v4-pro`.
- `logprobs` (`boolean`, optional): When true, return the log probability of each output token.
- `max_tokens` (`integer`, optional): Maximum number of tokens to generate, from 1 to 393216 (384K). Defaults to 8K in non-thinking mode and 64K in thinking mode (128K with reasoning_effort max). Example: 4096
- `reasoning_effort` (`string`, optional): How hard the model thinks in thinking mode: low, high (the default), or max. none turns thinking mode off. Example: max. One of: `none`, `low`, `high`, `max`.
- `response_format` (`string`, optional): Output format: text (default) or json_object for JSON Output, which guarantees the reply is valid JSON. With json_object, also ask for JSON in a system or user message (ideally with an example of the shape) and set max_tokens high enough, or the reply can be empty or cut off. One of: `text`, `json_object`.
- `stop` (`array`, optional): Up to 16 stop sequences as a JSON array of strings; generation stops before any of them. Example: ["```"]
- `temperature` (`number`, optional): Sampling temperature from 0 to 2; lower is more deterministic. Only applies in non-thinking mode. Example: 0.2
- `thinking` (`string`, optional): Turns thinking (reasoning) mode on or off. Thinking mode is on by default: the model writes its chain of thought to reasoning_content before the final answer. disabled gives faster, cheaper replies and is required for tool_choice required or a named function. One of: `enabled`, `disabled`.
- `tool_choice` (`string`, optional): Which tool the model may call: none (no tool), auto (model decides; the default when tools are given), required (must call at least one tool), or the name of one function to force that call. required and a function name only work with thinking disabled. Example: get_weather
- `tools` (`array`, optional): Functions the model may call, as a JSON array (up to 128 entries is typical). Each entry is {"type":"function","function":{...}} where the function has a name (letters, digits, underscores and dashes, up to 128 characters), a description, and parameters as a JSON Schema object. This tool supports strict mode: set "strict": true on every function to force arguments that match its schema. Example: [{"type":"function","function":{"name":"get_weather","description":"Get the weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]
- `top_logprobs` (`integer`, optional): Number of most likely alternative tokens (0 to 20) to return at each position. Needs logprobs true. Example: 5
- `top_p` (`number`, optional): Nucleus sampling cutoff, greater than 0 and at most 1. How it applies depends on the model and thinking mode (for deepseek-flash it only applies in thinking mode, with values below 0.95 raised to 0.95). Example: 0.95
- `user_id` (`string`, optional): Your own identifier for the end user (letters, digits, - and _, up to 512 characters). DeepSeek uses it for content safety review, KV cache isolation and per-user scheduling. Do not put personal data in it. Example: customer_8421

Example input: `{"messages":[{"role":"user","content":"Write quick sort in Python"},{"role":"assistant","content":"```python\n","prefix":true}],"model":"deepseek-flash"}`

### `deepseek_create_chat_completion`

Create Chat Completion · Write

Generate the next assistant message for a conversation with a DeepSeek model (non-streaming), with optional thinking mode, JSON output and function calling.
Returns choices with the message content, reasoning_content (thinking mode), any tool_calls and finish_reason, plus token usage including cache hits and reasoning tokens.
Use this for chat, reasoning, structured JSON and tool-calling agents. Use deepseek_create_beta_chat_completion to force the reply to start with a prefix or for strict-mode tool schemas, deepseek_create_fim_completion to fill in code between a prefix and a suffix, and deepseek_create_response for the OpenAI Responses API format.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `messages` (`array`, required): Conversation so far as a JSON array of message objects. Each has a role (system, user, assistant, or tool) and content. User content can also be an array of content parts, for example text plus an image_url part (images work with deepseek-flash only). Assistant messages that requested tools carry tool_calls, and each tool result is a tool message with the matching tool_call_id. When tools are used in thinking mode, pass every earlier assistant message back unchanged, including its reasoning_content, or the API returns 400. Example: [{"role":"system","content":"You are concise."},{"role":"user","content":"Hello"}]
- `model` (`string`, required): DeepSeek model to use: deepseek-flash (DeepSeek-V4.1-Flash, fast and cheap, accepts image input) or deepseek-v4-pro (DeepSeek-V4-Pro, stronger, text only). One of: `deepseek-flash`, `deepseek-v4-pro`.
- `logprobs` (`boolean`, optional): When true, return the log probability of each output token.
- `max_tokens` (`integer`, optional): Maximum number of tokens to generate, from 1 to 393216 (384K). Defaults to 8K in non-thinking mode and 64K in thinking mode (128K with reasoning_effort max). Example: 4096
- `reasoning_effort` (`string`, optional): How hard the model thinks in thinking mode: low, high (the default), or max. none turns thinking mode off. Example: max. One of: `none`, `low`, `high`, `max`.
- `response_format` (`string`, optional): Output format: text (default) or json_object for JSON Output, which guarantees the reply is valid JSON. With json_object, also ask for JSON in a system or user message (ideally with an example of the shape) and set max_tokens high enough, or the reply can be empty or cut off. One of: `text`, `json_object`.
- `stop` (`array`, optional): Up to 16 stop sequences as a JSON array of strings; generation stops before any of them. Example: ["```"]
- `temperature` (`number`, optional): Sampling temperature from 0 to 2; lower is more deterministic. Only applies in non-thinking mode. Example: 0.2
- `thinking` (`string`, optional): Turns thinking (reasoning) mode on or off. Thinking mode is on by default: the model writes its chain of thought to reasoning_content before the final answer. disabled gives faster, cheaper replies and is required for tool_choice required or a named function. One of: `enabled`, `disabled`.
- `tool_choice` (`string`, optional): Which tool the model may call: none (no tool), auto (model decides; the default when tools are given), required (must call at least one tool), or the name of one function to force that call. required and a function name only work with thinking disabled. Example: get_weather
- `tools` (`array`, optional): Functions the model may call, as a JSON array (up to 128 entries is typical). Each entry is {"type":"function","function":{...}} where the function has a name (letters, digits, underscores and dashes, up to 128 characters), a description, and parameters as a JSON Schema object. Example: [{"type":"function","function":{"name":"get_weather","description":"Get the weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]
- `top_logprobs` (`integer`, optional): Number of most likely alternative tokens (0 to 20) to return at each position. Needs logprobs true. Example: 5
- `top_p` (`number`, optional): Nucleus sampling cutoff, greater than 0 and at most 1. How it applies depends on the model and thinking mode (for deepseek-flash it only applies in thinking mode, with values below 0.95 raised to 0.95). Example: 0.95
- `user_id` (`string`, optional): Your own identifier for the end user (letters, digits, - and _, up to 512 characters). DeepSeek uses it for content safety review, KV cache isolation and per-user scheduling. Do not put personal data in it. Example: customer_8421

Example input: `{"messages":[{"role":"system","content":"You are concise."},{"role":"user","content":"Hello"}],"model":"deepseek-flash"}`

### `deepseek_create_fim_completion`

Create FIM Completion · Write

Fill in the middle: generate the text (usually code) that belongs between a prompt and an optional suffix, using DeepSeek's beta completions endpoint (non-streaming, non-thinking).
Returns choices with the generated text and finish_reason, plus token usage.
Use this for code or text infill and autocomplete. Use deepseek_create_chat_completion for conversations and instructions.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `model` (`string`, required): DeepSeek model to use: deepseek-flash (DeepSeek-V4.1-Flash, fast and cheap, accepts image input) or deepseek-v4-pro (DeepSeek-V4-Pro, stronger, text only). FIM always runs in non-thinking mode. One of: `deepseek-flash`, `deepseek-v4-pro`.
- `prompt` (`string`, required): The text before the gap: the model writes what comes next. Example: def fib(a):
- `echo` (`boolean`, optional): When true, return the prompt together with the completion. Cannot be combined with suffix or logprobs.
- `logprobs` (`integer`, optional): Return log probabilities for this many most likely tokens at each position (0 to 20), plus the chosen token. Example: 5
- `max_tokens` (`integer`, optional): Maximum number of tokens to generate, 1 to 4096 (FIM output is capped at 4K). Example: 128
- `stop` (`array`, optional): Up to 16 stop sequences as a JSON array of strings; the returned text does not include them. Example: ["\n\n"]
- `suffix` (`string`, optional): The text after the gap. When set, the model writes the middle part that joins prompt and suffix. Example:     return fib(a-1) + fib(a-2)
- `temperature` (`number`, optional): Sampling temperature from 0 to 2; lower is more deterministic. Example: 0.2
- `top_p` (`number`, optional): Nucleus sampling cutoff, greater than 0 and at most 1. Example: 0.9

Example input: `{"model":"deepseek-flash","prompt":"<prompt>"}`

### `deepseek_create_response`

Create Response · Write

Generate a model response in the OpenAI Responses API format (stateless, non-streaming), with optional thinking, JSON or JSON Schema output, function tools and server-side web search (deepseek-v4-pro).
Returns a response object with status, an output array of reasoning, message, function_call and web_search_call items, and token usage.
Use this when your agent already speaks the Responses format or needs json_schema output or built-in web search. Use deepseek_create_chat_completion for the Chat Completions format. Nothing is stored, so send the full history in input_items each turn.

Read only: no. Destructive: no. Idempotent (safe to retry): no.

Inputs:

- `model` (`string`, required): DeepSeek model to use: deepseek-flash (DeepSeek-V4.1-Flash, fast and cheap, accepts image input) or deepseek-v4-pro (DeepSeek-V4-Pro, stronger, text only). One of: `deepseek-flash`, `deepseek-v4-pro`.
- `input` (`string`, optional): Plain-text input, treated as one user message. Use input_items instead for a multi-turn history, images or tool results. Provide input, input_items or instructions. Example: Explain what a vector database is.
- `input_items` (`array`, optional): The full conversation as a JSON array of input items. The API is stateless, so send the whole history each time. Item types are message ({"role":"user","content":"..."}, roles user, assistant, system or developer), function_call, function_call_output (with the matching call_id), reasoning and web_search_call. User messages can include input_image parts (deepseek-flash only). Overrides input when both are set. Example: [{"role":"user","content":"What is 2+2?"}]
- `instructions` (`string`, optional): System-level instruction inserted as the first system message. Example: Answer in one short paragraph.
- `json_schema` (`object`, optional): JSON Schema object the output must match. Required when text_format is json_schema. Example: {"type":"object","properties":{"city":{"type":"string"},"population":{"type":"integer"}},"required":["city","population"]}
- `json_schema_name` (`string`, optional): Name of the output schema. Required when text_format is json_schema. Example: city_facts
- `max_output_tokens` (`integer`, optional): Upper bound on generated tokens, counting both visible output and reasoning tokens. Example: 4096
- `reasoning_effort` (`string`, optional): Thinking mode and effort: none turns thinking off; low, high or max turn it on at that effort. If unset, the model's default applies (thinking on, effort high). One of: `none`, `low`, `high`, `max`.
- `temperature` (`number`, optional): Sampling temperature from 0 to 2. Only applies in non-thinking mode. Example: 0.2
- `text_format` (`string`, optional): Output format: text (default), json_object for JSON mode, or json_schema for output that matches json_schema (also set json_schema_name). One of: `text`, `json_object`, `json_schema`.
- `tool_choice` (`string`, optional): Which tool the model may call: none, auto (default), required, or the name of one function to force that call. Example: get_weather
- `tools` (`array`, optional): Tools the model may call, as a JSON array. Function tools look like {"type":"function","name":"get_weather","description":"...","parameters":{JSON Schema}}. {"type":"web_search"} lets deepseek-v4-pro search the web on the server; it is ignored with deepseek-flash.
- `top_logprobs` (`integer`, optional): Number of most likely tokens (0 to 20) to return with log probabilities at each position. Example: 5
- `top_p` (`number`, optional): Nucleus sampling cutoff, greater than 0 and at most 1. Only applies in thinking mode, where values below 0.95 are raised to 0.95. Example: 0.95
- `user` (`string`, optional): Your own identifier for the end user (letters, digits, - and _, up to 512 characters), used for content safety review, KV cache isolation and scheduling. No personal data. Example: customer_8421

Example input: `{"model":"deepseek-flash"}`

### `deepseek_delete_file`

Delete File · Destructive

Permanently delete an uploaded file by its id.
Returns the file id and deleted: true.
Use this to remove images that are no longer needed. Chat requests that still reference the id will fail.

Read only: no. Destructive: yes. Idempotent (safe to retry): yes.

Inputs:

- `file_id` (`string`, required): ID of the file to delete, of the form file-api-.... Get it from deepseek_list_files. Example: file-api-0a1b2c3d4e5f60718293a4b5c6d7e8f9

Example input: `{"file_id":"<file_id>"}`

## Related

Other AI connectors ([all 148](/agentkit/connectors/?category=ai)):

- [Chorus](/agentkit/connectors/chorus/): Scalekit connector, Username and password, 9 tools
- [Gong](/agentkit/connectors/gong/): Scalekit connector, OAuth, 69 tools
- [Jiminny](/agentkit/connectors/jiminny/): Scalekit connector, Access token, 27 tools


---

## More Scalekit documentation

| Resource | What it contains | When to use it |
|----------|-----------------|----------------|
| [/llms.txt](/llms.txt) | Structured index with routing hints per product area | Start here — find which documentation set covers your topic before loading full content |
| [/llms-full.txt](/llms-full.txt) | Complete documentation for all Scalekit products in one file | Use when you need exhaustive context across multiple products or when the topic spans several areas |
| [sitemap-0.xml](https://docs.scalekit.com/sitemap-0.xml) | Full URL list of every documentation page | Use to discover specific page URLs you can fetch for targeted, page-level answers |
