# Messages API

Creates a model response in the Anthropic Messages API format.

Send the conversation history in `messages` on each request. Use `https://api.deepseek.com/anthropic` as the Anthropic SDK's `base_url`; the SDK appends `/v1/messages`. Direct HTTP requests can also use the compatible path `/anthropic/messages`.

Authenticate with either `x-api-key` or `Authorization: Bearer`. If both are supplied, `Authorization` takes precedence. See the [Anthropic API Guide](https://api-docs.deepseek.com/guides/anthropic_api.md) for model mappings, tool-result replay, and compatibility details.

Compatibility fields `container`, `mcp_servers`, `service_tier`, and `top_k` are ignored.

## Endpoint

```http
POST /anthropic/v1/messages
```

operationId: `createMessage`

### Servers

- `https://api.deepseek.com`

## Authentication

### Alternative 1

**anthropicApiKey**

`x-api-key` (header)

```yaml
type: apiKey
in: header
name: x-api-key
```

### Alternative 2

**bearerAuth**

`Authorization: Bearer <API_KEY>`

```yaml
type: http
scheme: bearer
```

## Parameters

**`anthropic-version`** (header) — optional

The Anthropic SDK sends this header automatically; the service currently ignores it.

- `type`: `string`

**Example**

```json
"2023-06-01"
```

**`anthropic-beta`** (header) — optional

Include `files-api-2025-04-14` when referencing an uploaded image with `source.type` of `file`. Otherwise not required for this endpoint. See the [Files API Guide](https://api-docs.deepseek.com/guides/files_api.md#anthropic-compatible-files-api).

- `type`: `string`

**Example**

```json
"files-api-2025-04-14"
```

## Request body

**required**

### application/json

- Reference: [CreateMessageRequest](#schema-create-message-request) (`#/components/schemas/CreateMessageRequest`)

## Responses

### 200 (No streaming)

OK, returns a `message` object. Its content may include text, thinking, and tool-use blocks.

#### application/json

- Reference: [AnthropicMessage](#schema-anthropic-message) (`#/components/schemas/AnthropicMessage`)

**Example**

```json
{
  "id": "e6ef6a63-a078-4f53-a73b-38c8d1d46310",
  "type": "message",
  "role": "assistant",
  "model": "deepseek-flash",
  "content": [{"type": "text", "text": "Hello!"}],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 12,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 3,
    "service_tier": "standard"
  }
}
```

### 200 (Streaming)

OK, returns SSE events in the order `message_start` → content block events → `message_delta` → `message_stop`. A `ping` event or keep-alive comment may appear between events. There is no `data: [DONE]` message. Accumulate tool input JSON fragments until the content block ends before parsing them. See [Streaming](https://api-docs.deepseek.com/guides/anthropic_api.md#streaming).

A connection that closes before `message_stop` is an incomplete response. Errors after streaming has started may terminate the connection without an Anthropic `error` event.

#### text/event-stream

- `type`: `array`

- **Array items**

  - Reference: [AnthropicMessageStreamEvent](#schema-anthropic-message-stream-event) (`#/components/schemas/AnthropicMessageStreamEvent`)

**Example**

```
event: message_start
data: {"type":"message_start","message":{"id":"e6ef6a63-a078-4f53-a73b-38c8d1d46310","type":"message","role":"assistant","model":"deepseek-flash","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":12,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":0,"service_tier":"standard"}}}

event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}

event: ping
data: {"type":"ping"}

event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello!"}}

event: content_block_stop
data: {"type":"content_block_stop","index":0}

event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":12,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":3,"service_tier":"standard"}}

event: message_stop
data: {"type":"message_stop"}
```

### 400 (Bad request)

Invalid request, for example an empty `messages` array or unpaired tool results. Errors use the Anthropic structure `{type: "error", error: {type, message}}`, where `error.type` follows the HTTP status: `invalid_request_error` (400, 422), `authentication_error` (401), `billing_error` (402), `permission_error` (403), `not_found_error` (404), `request_too_large` (413), `rate_limit_error` (429), `timeout_error` (408, 504), `overloaded_error` (503) and `api_error` (500 and others). See [Error Codes](https://api-docs.deepseek.com/quick_start/error_codes.md) for the causes of each status.

#### application/json

- Reference: [AnthropicErrorResponse](#schema-anthropic-error-response) (`#/components/schemas/AnthropicErrorResponse`)

**Example**

```json
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "messages: at least one message is required"
  }
}
```

## Code samples

### curl

```bash
# Set DEEPSEEK_API_KEY to your API key before running this example.
curl --silent --show-error --max-time 60 "https://api.deepseek.com/anthropic/v1/messages" \
  --header "x-api-key: ${DEEPSEEK_API_KEY}" \
  --header "anthropic-version: 2023-06-01" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "deepseek-flash",
  "messages": [{"role": "user", "content": "Say hello."}],
  "max_tokens": 32,
  "thinking": {"type": "disabled"},
  "stream": false
}'
```

### Python — Anthropic SDK

```python
# Install the SDK first: pip install anthropic
# Set DEEPSEEK_API_KEY to your API key before running this example.
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["DEEPSEEK_API_KEY"],
    base_url="https://api.deepseek.com/anthropic",
    timeout=60.0,
)

message = client.messages.create(
    model="deepseek-flash",
    messages=[{"role": "user", "content": "Say hello."}],
    max_tokens=32,
    thinking={"type": "disabled"},
    stream=False,
)
print(message.model_dump_json(indent=2))
```

## Referenced schemas

### schema-create-message-request

**CreateMessageRequest** — `#/components/schemas/CreateMessageRequest`

Creates the next assistant message using the Anthropic Messages format. Compatibility fields `container`, `mcp_servers`, `service_tier`, and `top_k` are ignored. See the [Anthropic API Guide](https://api-docs.deepseek.com/guides/anthropic_api.md) for compatibility details.

- `type`: `object`

- `required`: `["model","messages"]`

- **Properties**

  - **`model`** (required)

    ID of the model to use. Use `deepseek-flash` or `deepseek-v4-pro`. Claude model-name aliases are also accepted: `claude-opus*` maps to `deepseek-v4-pro`, and other `claude*` names map to `deepseek-flash`. See the [Anthropic API Guide](https://api-docs.deepseek.com/guides/anthropic_api.md).

    - `type`: `string`

    **Example**

    ```json
    "deepseek-flash"
    ```

  - **`messages`** (required)

    The conversation history. At least one message is required. This API is stateless: include the messages needed for the current turn in every request. Use the top-level `system` field for the system prompt. When continuing after a tool call, pass back the complete assistant content, including thinking and tool-use blocks, followed by the matching tool results. The service may restore omitted thinking content from tool-call IDs; if recovery is required but fails, the request returns `400`. Preserve the complete content for reliable replay.

    - `type`: `array`

    - `minItems`: `1`

    - **Array items**

      - Reference: [AnthropicMessageParam](#schema-anthropic-message-param) (`#/components/schemas/AnthropicMessageParam`)

  - **`system`** (optional)

    - Reference: [AnthropicSystemContent](#schema-anthropic-system-content) (`#/components/schemas/AnthropicSystemContent`)

  - **`max_tokens`** (optional)

    The requested output token limit, including thinking tokens. This field is optional at the HTTP API level; the Anthropic SDK requires it. The default and effective limit depend on the model, thinking mode, and reasoning effort. Values above the model limit are capped, and the input plus output must fit within the context window. For certain Claude Code or OpenCode main-agent requests in thinking mode, compatibility handling may raise the effective limit above the requested value, within model and context limits. See [Models & Pricing](https://api-docs.deepseek.com/quick_start/pricing.md).

    - `type`: `integer`

    - `minimum`: `1`

    - `nullable`: `true`

    **Example**

    ```json
    4096
    ```

  - **`stream`** (optional)

    If `true`, return named server-sent events (SSE), ending with `message_stop`. There is no `data: [DONE]` message. Otherwise, return one complete message object.

    - `type`: `boolean`

    - `nullable`: `true`

    - `default`: `false`

  - **`thinking`** (optional)

    - Reference: [AnthropicThinkingConfig](#schema-anthropic-thinking-config) (`#/components/schemas/AnthropicThinkingConfig`)

  - **`output_config`** (optional)

    - Reference: [AnthropicOutputConfig](#schema-anthropic-output-config) (`#/components/schemas/AnthropicOutputConfig`)

  - **`tools`** (optional)

    Tools available to the model. Supports client-defined tools, the web search server tool, and the `deepseek_web_search` and `deepseek_read_url` server tools. Tool names must be unique. An empty list is treated as no tools. `cache_control` is ignored.

    - `type`: `array`

    - `nullable`: `true`

    - **Array items**

      - Reference: [AnthropicTool](#schema-anthropic-tool) (`#/components/schemas/AnthropicTool`)

  - **`tool_choice`** (optional)

    - Reference: [AnthropicToolChoice](#schema-anthropic-tool-choice) (`#/components/schemas/AnthropicToolChoice`)

  - **`stop_sequences`** (optional)

    Up to 16 non-empty strings that stop generation. Each string must be at most 512 bytes (UTF-8 encoded). If a string is matched, `stop_reason` is `stop_sequence` and `stop_sequence` contains the matched string.

    - `type`: `array`

    - `nullable`: `true`

    - `maxItems`: `16`

    - **Array items**

      - `type`: `string`

      - `minLength`: `1`

  - **`temperature`** (optional)

    Sampling temperature, between 0 and 2. Higher values produce more varied output. In thinking mode the value is fixed at 1, and the supplied value has no effect. We generally recommend changing either this or `top_p`, rather than both.

    - `type`: `number`

    - `nullable`: `true`

    - `minimum`: `0`

    - `maximum`: `2`

    - `default`: `1`

  - **`top_p`** (optional)

    Nucleus sampling probability, greater than 0 and at most 1. For `deepseek-flash`, thinking mode defaults to 1 and clamps values below 0.95 to 0.95; non-thinking mode always uses 1. For `deepseek-v4-pro`, thinking mode uses 0.95 when tools are enabled and 1 otherwise, ignoring the supplied value; non-thinking mode uses the supplied value, defaulting to 1. Setting `tool_choice` to `{"type":"none"}` disables tool calling.

    - `type`: `number`

    - `nullable`: `true`

    - `minimum`: `0`

    - `exclusiveMinimum`: `true`

    - `maximum`: `1`

    **Example**

    ```json
    1
    ```

  - **`metadata`** (optional)

    - Reference: [AnthropicMetadata](#schema-anthropic-metadata) (`#/components/schemas/AnthropicMetadata`)

  - **`safety_check`** (optional)

    DeepSeek extension. Set `level` to `high` to turn on basic risk control, which reviews the model input and output. See the [Model Content Safety Guide](https://api-docs.deepseek.com/guides/safety.md).

    - `type`: `object`

    - `nullable`: `true`

    - `required`: `["level"]`

    - **Properties**

      - **`level`** (required)

        `high`: basic risk control. `low`: the default checks, the same as omitting `safety_check`.

        - `type`: `string`

        - `enum`: `["low","high"]`

  - **`title`** (optional)

    DeepSeek extension. Set `{"enabled": true}` to have the response carry a short title for the conversation. See the [Conversation Title Guide](https://api-docs.deepseek.com/guides/conversation_title.md).

    - `type`: `object`

    - `nullable`: `true`

    - `required`: `["enabled"]`

    - **Properties**

      - **`enabled`** (required)

        Whether to return a conversation title.

        - `type`: `boolean`

    - **additionalProperties**

      - Schema: `false`

### schema-anthropic-message

**AnthropicMessage** — `#/components/schemas/AnthropicMessage`

- title: `Message`

- `type`: `object`

- `required`: `["id","type","role","model","content","stop_reason","stop_sequence","usage"]`

- **Properties**

  - **`id`** (required)

    Unique identifier for this message.

    - `type`: `string`

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["message"]`

  - **`role`** (required)

    - `type`: `string`

    - `enum`: `["assistant"]`

  - **`model`** (required)

    The model identifier supplied in the request. When using a Claude-compatible model name, the response retains that name.

    - `type`: `string`

  - **`content`** (required)

    Generated content blocks. Preserve the full content when adding this assistant turn to the next request.

    - `type`: `array`

    - **Array items**

      - Reference: [AnthropicMessageOutputBlock](#schema-anthropic-message-output-block) (`#/components/schemas/AnthropicMessageOutputBlock`)

  - **`stop_reason`** (required)

    Why generation stopped: natural completion, output limit, a stop sequence, a client tool call, or content filtering. Null in message\_start.

    - `type`: `string`

    - `nullable`: `true`

    - `enum`: `["end_turn","max_tokens","stop_sequence","tool_use","refusal",null]`

  - **`stop_sequence`** (required)

    The matched stop sequence, or null when no stop sequence was matched.

    - `type`: `string`

    - `nullable`: `true`

  - **`stop_details`** (optional)

    - Reference: [AnthropicStopDetails](#schema-anthropic-stop-details) (`#/components/schemas/AnthropicStopDetails`)

  - **`title`** (optional)

    DeepSeek extension. The conversation title, present only when the request enabled `title` and a title was generated. Not related to the `title` of search results and citations.

    - `type`: `string`

  - **`usage`** (required)

    - Reference: [AnthropicMessageUsage](#schema-anthropic-message-usage) (`#/components/schemas/AnthropicMessageUsage`)

### schema-anthropic-message-stream-event

**AnthropicMessageStreamEvent** — `#/components/schemas/AnthropicMessageStreamEvent`

- title: `Message stream event`

Normal message events have an event name matching the JSON type. A normal stream ends with message\_stop. Ping events and keep-alive comments may appear between events; no data: \[DONE] is emitted. A timeout may instead return an unnamed data event containing an error object before closing the connection. An interrupted stream without message\_stop is incomplete.

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicMessageStartEvent](#schema-anthropic-message-start-event) (`#/components/schemas/AnthropicMessageStartEvent`)

  - oneOf 2

    - Reference: [AnthropicContentBlockStartEvent](#schema-anthropic-content-block-start-event) (`#/components/schemas/AnthropicContentBlockStartEvent`)

  - oneOf 3

    - Reference: [AnthropicContentBlockDeltaEvent](#schema-anthropic-content-block-delta-event) (`#/components/schemas/AnthropicContentBlockDeltaEvent`)

  - oneOf 4

    - Reference: [AnthropicContentBlockStopEvent](#schema-anthropic-content-block-stop-event) (`#/components/schemas/AnthropicContentBlockStopEvent`)

  - oneOf 5

    - Reference: [AnthropicMessageDeltaEvent](#schema-anthropic-message-delta-event) (`#/components/schemas/AnthropicMessageDeltaEvent`)

  - oneOf 6

    - Reference: [AnthropicMessageStopEvent](#schema-anthropic-message-stop-event) (`#/components/schemas/AnthropicMessageStopEvent`)

  - oneOf 7

    - Reference: [AnthropicPingEvent](#schema-anthropic-ping-event) (`#/components/schemas/AnthropicPingEvent`)

### schema-anthropic-error-response

**AnthropicErrorResponse** — `#/components/schemas/AnthropicErrorResponse`

An error of the Anthropic-compatible API.

- `type`: `object`

- `required`: `["type","error"]`

- **Properties**

  - **`type`** (required)

    Always `error`.

    - `type`: `string`

    - `enum`: `["error"]`

  - **`error`** (required)

    - `type`: `object`

    - `required`: `["type","message"]`

    - **Properties**

      - **`type`** (required)

        The error type, such as `invalid_request_error` or `rate_limit_error`.

        - `type`: `string`

      - **`message`** (required)

        A description of the error.

        - `type`: `string`

### schema-anthropic-message-param

**AnthropicMessageParam** — `#/components/schemas/AnthropicMessageParam`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicUserMessage](#schema-anthropic-user-message) (`#/components/schemas/AnthropicUserMessage`)

  - oneOf 2

    - Reference: [AnthropicAssistantMessage](#schema-anthropic-assistant-message) (`#/components/schemas/AnthropicAssistantMessage`)

  - oneOf 3

    - Reference: [AnthropicLatestReminderMessage](#schema-anthropic-latest-reminder-message) (`#/components/schemas/AnthropicLatestReminderMessage`)

### schema-anthropic-system-content

**AnthropicSystemContent** — `#/components/schemas/AnthropicSystemContent`

The system prompt. Supports only a string, an array of text blocks, or `null`.

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextContent](#schema-anthropic-text-content) (`#/components/schemas/AnthropicTextContent`)

  - oneOf 2

    - Reference: [AnthropicSystemBlocks](#schema-anthropic-system-blocks) (`#/components/schemas/AnthropicSystemBlocks`)

  - oneOf 3

    - Reference: [AnthropicNullValue](#schema-anthropic-null-value) (`#/components/schemas/AnthropicNullValue`)

### schema-anthropic-thinking-config

**AnthropicThinkingConfig** — `#/components/schemas/AnthropicThinkingConfig`

- title: `Thinking configuration`

Controls thinking mode. An explicit `thinking.type` takes precedence over `output_config.effort` when selecting the mode. When omitted, `effort` determines the mode. If neither is set, thinking is enabled by default for `deepseek-flash` and `deepseek-v4-pro`.

- `type`: `object`

- `required`: `["type"]`

- `nullable`: `true`

- **Properties**

  - **`type`** (required)

    `enabled` turns thinking on; `disabled` turns it off. `adaptive` is treated as `enabled`.

    - `type`: `string`

    - `enum`: `["enabled","disabled","adaptive"]`

  - **`budget_tokens`** (optional)

    Ignored. This parameter does not set a thinking-token budget.

    - `type`: `integer`

    - `minimum`: `0`

    - `nullable`: `true`

### schema-anthropic-output-config

**AnthropicOutputConfig** — `#/components/schemas/AnthropicOutputConfig`

- title: `Output configuration`

Output configuration. Only `effort` is supported; output-format settings such as `format` are ignored.

- `type`: `object`

- `nullable`: `true`

- **Properties**

  - **`effort`** (optional)

    Controls thinking mode and effort. `none` disables thinking unless `thinking.type` explicitly enables it. `low`, `high`, and `max` enable thinking, with `high` as the default effort. Compatibility aliases: `minimal` maps to `low`, `medium` and `xhigh` both map to `high`, and `ultra` maps to `max`. An explicit `thinking.type` determines whether thinking is enabled.

    - `type`: `string`

    - `enum`: `["none","minimal","low","medium","high","xhigh","ultra","max",null]`

    - `nullable`: `true`

### schema-anthropic-tool

**AnthropicTool** — `#/components/schemas/AnthropicTool`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicClientTool](#schema-anthropic-client-tool) (`#/components/schemas/AnthropicClientTool`)

  - oneOf 2

    - Reference: [AnthropicWebSearchTool](#schema-anthropic-web-search-tool) (`#/components/schemas/AnthropicWebSearchTool`)

  - oneOf 3

    - Reference: [AnthropicDeepSeekWebSearchTool](#schema-anthropic-deep-seek-web-search-tool) (`#/components/schemas/AnthropicDeepSeekWebSearchTool`)

  - oneOf 4

    - Reference: [AnthropicDeepSeekReadUrlTool](#schema-anthropic-deep-seek-read-url-tool) (`#/components/schemas/AnthropicDeepSeekReadUrlTool`)

### schema-anthropic-tool-choice

**AnthropicToolChoice** — `#/components/schemas/AnthropicToolChoice`

Controls tool selection. Defaults to `auto`. `any` is treated as `auto` and does not force a tool call. Selecting a named client tool requires non-thinking mode. `disable_parallel_tool_use` is ignored.

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicToolChoiceAuto](#schema-anthropic-tool-choice-auto) (`#/components/schemas/AnthropicToolChoiceAuto`)

  - oneOf 2

    - Reference: [AnthropicToolChoiceAny](#schema-anthropic-tool-choice-any) (`#/components/schemas/AnthropicToolChoiceAny`)

  - oneOf 3

    - Reference: [AnthropicToolChoiceNamed](#schema-anthropic-tool-choice-named) (`#/components/schemas/AnthropicToolChoiceNamed`)

  - oneOf 4

    - Reference: [AnthropicToolChoiceNone](#schema-anthropic-tool-choice-none) (`#/components/schemas/AnthropicToolChoiceNone`)

  - oneOf 5

    - Reference: [AnthropicNullValue](#schema-anthropic-null-value) (`#/components/schemas/AnthropicNullValue`)

### schema-anthropic-metadata

**AnthropicMetadata** — `#/components/schemas/AnthropicMetadata`

- title: `Metadata`

Request metadata. Only `user_id` is supported; other metadata fields are ignored.

- `type`: `object`

- `nullable`: `true`

- **Properties**

  - **`user_id`** (optional)

    A custom end-user identifier. We recommend using only ASCII letters, digits, underscores (`_`), and hyphens (`-`). The UTF-8 encoded value must not exceed 512 bytes. Do not include personal information. See [Rate Limit & Isolation](https://api-docs.deepseek.com/quick_start/rate_limit.md).

    - `type`: `string`

    - `nullable`: `true`

### schema-anthropic-message-output-block

**AnthropicMessageOutputBlock** — `#/components/schemas/AnthropicMessageOutputBlock`

- title: `Output content block`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextBlock](#schema-anthropic-text-block) (`#/components/schemas/AnthropicTextBlock`)

  - oneOf 2

    - Reference: [AnthropicOutputThinkingBlock](#schema-anthropic-output-thinking-block) (`#/components/schemas/AnthropicOutputThinkingBlock`)

  - oneOf 3

    - Reference: [AnthropicToolUseBlock](#schema-anthropic-tool-use-block) (`#/components/schemas/AnthropicToolUseBlock`)

  - oneOf 4

    - Reference: [AnthropicOutputServerToolUseBlock](#schema-anthropic-output-server-tool-use-block) (`#/components/schemas/AnthropicOutputServerToolUseBlock`)

  - oneOf 5

    - Reference: [AnthropicWebSearchToolResultBlock](#schema-anthropic-web-search-tool-result-block) (`#/components/schemas/AnthropicWebSearchToolResultBlock`)

  - oneOf 6

    - Reference: [AnthropicWebFetchToolResultBlock](#schema-anthropic-web-fetch-tool-result-block) (`#/components/schemas/AnthropicWebFetchToolResultBlock`)

### schema-anthropic-stop-details

**AnthropicStopDetails** — `#/components/schemas/AnthropicStopDetails`

- title: `Stop details`

Present when the model content safety review refuses the response (`stop_reason` is `refusal`). See the [Model Content Safety Guide](https://api-docs.deepseek.com/guides/safety.md#handling-refusals).

- `type`: `object`

- `nullable`: `true`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["refusal"]`

  - **`category`** (optional)

    Always `null`.

    - `type`: `string`

    - `nullable`: `true`

  - **`explanation`** (optional)

    Names the blocked images when images in the request fail the review; otherwise `null`.

    - `type`: `string`

    - `nullable`: `true`

### schema-anthropic-message-usage

**AnthropicMessageUsage** — `#/components/schemas/AnthropicMessageUsage`

- title: `Message usage`

- `type`: `object`

- `required`: `["input_tokens","cache_creation_input_tokens","cache_read_input_tokens","output_tokens","service_tier"]`

- **Properties**

  - **`input_tokens`** (required)

    Input tokens not served from the context cache. Total input tokens equal input\_tokens + cache\_read\_input\_tokens + cache\_creation\_input\_tokens.

    - `type`: `integer`

    - `minimum`: `0`

  - **`cache_creation_input_tokens`** (required)

    Always 0. Anthropic-style cache creation is not used; context caching is automatic.

    - `type`: `integer`

    - `enum`: `[0]`

  - **`cache_read_input_tokens`** (required)

    Input tokens served from the context cache.

    - `type`: `integer`

    - `minimum`: `0`

  - **`output_tokens`** (required)

    Generated output tokens, including thinking tokens when thinking is enabled. In message\_delta this is the cumulative count, not an increment.

    - `type`: `integer`

    - `minimum`: `0`

  - **`output_tokens_details`** (optional)

    - title: `Output token details`

    Breakdown of `output_tokens`. Present when thinking is enabled or `safety_check` is `high`.

    - `type`: `object`

    - **Properties**

      - **`thinking_tokens`** (optional)

        Thinking tokens, already included in `output_tokens`.

        - `type`: `integer`

        - `minimum`: `0`

      - **`safety_tokens`** (optional)

        DeepSeek extension. Tokens of the safety review, already included in `output_tokens`. Present only when `safety_check` is `high`.

        - `type`: `integer`

        - `minimum`: `0`

  - **`service_tier`** (required)

    - `type`: `string`

    - `enum`: `["standard"]`

  - **`server_tool_use`** (optional)

    - title: `Server tool usage`

    Server-side web search and fetch counts, separate from token usage. Present only when at least one of the counts is greater than zero; otherwise omitted. All fields are present when this object is returned. Read the final message's usage for non-streaming responses or the final message\_delta.usage for streaming responses. These counts are cumulative, not deltas. See [Server tool usage](https://api-docs.deepseek.com/guides/anthropic_api.md#server-tool-usage).

    - `type`: `object`

    - `required`: `["web_search_requests","tool_search"]`

    - **Properties**

      - **`web_search_requests`** (required)

        Number of server-side web search attempts, including failed attempts and attempts exceeding `max_uses`.

        - `type`: `integer`

        - `minimum`: `0`

      - **`tool_search`** (required)

        Number of successful server-side web searches that returned nonempty results.

        - `type`: `integer`

        - `minimum`: `0`

      - **`web_fetch_requests`** (optional)

        With the web tools. Number of fetch result blocks in the response, including errors. For display only.

        - `type`: `integer`

        - `minimum`: `0`

      - **`tool_fetch`** (optional)

        With the web tools. Number of page fetches.

        - `type`: `integer`

        - `minimum`: `0`

      - **`tool_image_search`** (optional)

        With the web tools. Number of image searches.

        - `type`: `integer`

        - `minimum`: `0`

    **Example**

    ```json
    {
      "web_search_requests": 1,
      "tool_search": 1
    }
    ```

### schema-anthropic-message-start-event

**AnthropicMessageStartEvent** — `#/components/schemas/AnthropicMessageStartEvent`

- title: `message_start`

- `type`: `object`

- `required`: `["type","message"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["message_start"]`

  - **`message`** (required)

    - Reference: [AnthropicMessage](#schema-anthropic-message) (`#/components/schemas/AnthropicMessage`)

### schema-anthropic-content-block-start-event

**AnthropicContentBlockStartEvent** — `#/components/schemas/AnthropicContentBlockStartEvent`

- title: `content_block_start`

- `type`: `object`

- `required`: `["type","index","content_block"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["content_block_start"]`

  - **`index`** (required)

    Zero-based index of the content block.

    - `type`: `integer`

    - `minimum`: `0`

  - **`content_block`** (required)

    - Reference: [AnthropicMessageOutputBlock](#schema-anthropic-message-output-block) (`#/components/schemas/AnthropicMessageOutputBlock`)

### schema-anthropic-content-block-delta-event

**AnthropicContentBlockDeltaEvent** — `#/components/schemas/AnthropicContentBlockDeltaEvent`

- title: `content_block_delta`

- `type`: `object`

- `required`: `["type","index","delta"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["content_block_delta"]`

  - **`index`** (required)

    Zero-based index of the content block.

    - `type`: `integer`

    - `minimum`: `0`

  - **`delta`** (required)

    - Reference: [AnthropicContentBlockDelta](#schema-anthropic-content-block-delta) (`#/components/schemas/AnthropicContentBlockDelta`)

### schema-anthropic-content-block-stop-event

**AnthropicContentBlockStopEvent** — `#/components/schemas/AnthropicContentBlockStopEvent`

- title: `content_block_stop`

- `type`: `object`

- `required`: `["type","index"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["content_block_stop"]`

  - **`index`** (required)

    Zero-based index of the content block.

    - `type`: `integer`

    - `minimum`: `0`

### schema-anthropic-message-delta-event

**AnthropicMessageDeltaEvent** — `#/components/schemas/AnthropicMessageDeltaEvent`

- title: `message_delta`

- `type`: `object`

- `required`: `["type","delta","usage"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["message_delta"]`

  - **`delta`** (required)

    - title: `Stop information`

    - `type`: `object`

    - `required`: `["stop_reason","stop_sequence"]`

    - **Properties**

      - **`stop_reason`** (required)

        The final reason generation stopped.

        - `type`: `string`

        - `nullable`: `false`

        - `enum`: `["end_turn","max_tokens","stop_sequence","tool_use","refusal"]`

      - **`stop_sequence`** (required)

        The matched stop sequence, or null when no stop sequence was matched.

        - `type`: `string`

        - `nullable`: `true`

      - **`stop_details`** (optional)

        - Reference: [AnthropicStopDetails](#schema-anthropic-stop-details) (`#/components/schemas/AnthropicStopDetails`)

      - **`title`** (optional)

        DeepSeek extension. The conversation title, present only when the request enabled `title` and a title was generated.

        - `type`: `string`

  - **`usage`** (required)

    - Reference: [AnthropicMessageUsage](#schema-anthropic-message-usage) (`#/components/schemas/AnthropicMessageUsage`)

### schema-anthropic-message-stop-event

**AnthropicMessageStopEvent** — `#/components/schemas/AnthropicMessageStopEvent`

- title: `message_stop`

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["message_stop"]`

### schema-anthropic-ping-event

**AnthropicPingEvent** — `#/components/schemas/AnthropicPingEvent`

- title: `ping`

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["ping"]`

### schema-anthropic-user-message

**AnthropicUserMessage** — `#/components/schemas/AnthropicUserMessage`

- title: `User message`

- `type`: `object`

- `required`: `["role","content"]`

- **Properties**

  - **`role`** (required)

    - `type`: `string`

    - `enum`: `["user"]`

  - **`content`** (required)

    - Reference: [AnthropicUserContent](#schema-anthropic-user-content) (`#/components/schemas/AnthropicUserContent`)

### schema-anthropic-assistant-message

**AnthropicAssistantMessage** — `#/components/schemas/AnthropicAssistantMessage`

- title: `Assistant message`

A previous assistant message. Preserve its content blocks when passing it back, including thinking, tool use, and web search results.

- `type`: `object`

- `required`: `["role","content"]`

- **Properties**

  - **`role`** (required)

    - `type`: `string`

    - `enum`: `["assistant"]`

  - **`content`** (required)

    - Reference: [AnthropicAssistantContent](#schema-anthropic-assistant-content) (`#/components/schemas/AnthropicAssistantContent`)

### schema-anthropic-latest-reminder-message

**AnthropicLatestReminderMessage** — `#/components/schemas/AnthropicLatestReminderMessage`

- title: `Latest reminder message`

DeepSeek extension. Gives the model the current date, location, platform and language, like DeepSeek Chat. Place it directly before the `user` message it belongs to; anywhere else it returns `400`. Works with or without the web tools. See the [User Metadata Marker Guide](https://api-docs.deepseek.com/guides/latest_reminder.md).

- `type`: `object`

- `required`: `["role","content"]`

- **Properties**

  - **`role`** (required)

    - `type`: `string`

    - `enum`: `["latest_reminder"]`

  - **`content`** (required)

    `<date>,<weekday>,<location>,<platform>,<language>`, for example `2026-11-11,Wednesday,Singapore,Web,English`.

    - `type`: `string`

### schema-anthropic-text-content

**AnthropicTextContent** — `#/components/schemas/AnthropicTextContent`

- title: `Text content`

- `type`: `string`

### schema-anthropic-system-blocks

**AnthropicSystemBlocks** — `#/components/schemas/AnthropicSystemBlocks`

- title: `System text blocks`

- `type`: `array`

- **Array items**

  - Reference: [AnthropicTextBlock](#schema-anthropic-text-block) (`#/components/schemas/AnthropicTextBlock`)

### schema-anthropic-null-value

**AnthropicNullValue** — `#/components/schemas/AnthropicNullValue`

- title: `Null value`

- `type`: `string`

- `nullable`: `true`

- `enum`: `[null]`

### schema-anthropic-client-tool

**AnthropicClientTool** — `#/components/schemas/AnthropicClientTool`

- title: `Client tool`

The application executes this tool after receiving a `tool_use` block and returns a `tool_result` block. Omit `type` for client tools. Providing `type` selects server-tool parsing; unsupported values such as `custom` return `422`. `cache_control` is ignored.

- `type`: `object`

- `required`: `["name","input_schema"]`

- **Properties**

  - **`name`** (required)

    A unique tool name containing letters, digits, underscores, or hyphens, up to 128 characters.

    - `type`: `string`

    - `minLength`: `1`

    - `maxLength`: `128`

    - `pattern`: `^[a-zA-Z0-9_-]+$`

  - **`description`** (optional)

    A description of what the tool does and when to use it.

    - `type`: `string`

    - `nullable`: `true`

  - **`input_schema`** (required)

    A valid JSON Schema describing the tool arguments. Its top-level `type` must be `object`.

    - `type`: `object`

    - **additionalProperties**

      - Schema: `true`

    **Example**

    ```json
    {
      "type": "object",
      "properties": {
        "city": {
          "type": "string"
        }
      },
      "required": [
        "city"
      ]
    }
    ```

- **not**

  - `required`: `["type"]`

### schema-anthropic-web-search-tool

**AnthropicWebSearchTool** — `#/components/schemas/AnthropicWebSearchTool`

- title: `Web search server tool`

The service executes web searches and returns `server_tool_use` and `web_search_tool_result` blocks in the assistant message. Both type values select the same tool.

- `type`: `object`

- `required`: `["type","name"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_search_20250305","web_search_20260209"]`

  - **`name`** (required)

    - `type`: `string`

    - `enum`: `["web_search"]`

  - **`max_uses`** (optional)

    Maximum searches allowed in this request. The default and service-side cap are normally 5; for Claude Code search-subagent compatibility requests, both are 1. Larger values are capped at the applicable limit. A search beyond this limit returns a `max_uses_exceeded` result.

    - `type`: `integer`

    - `minimum`: `0`

    - `nullable`: `true`

### schema-anthropic-deep-seek-web-search-tool

**AnthropicDeepSeekWebSearchTool** — `#/components/schemas/AnthropicDeepSeekWebSearchTool`

- title: `DeepSeek web search server tool`

DeepSeek extension. Lets the model search the web; with thinking enabled, it runs deep thinking search. See the [Web Tools Guide](https://api-docs.deepseek.com/guides/web_tools.md).

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["deepseek_web_search"]`

  - **`name`** (optional)

    Optional. The service does not check it.

    - `type`: `string`

    - `enum`: `["deepseek_web_search"]`

### schema-anthropic-deep-seek-read-url-tool

**AnthropicDeepSeekReadUrlTool** — `#/components/schemas/AnthropicDeepSeekReadUrlTool`

- title: `DeepSeek read URL server tool`

DeepSeek extension. Lets the model read the links in the last user message. See the [Web Tools Guide](https://api-docs.deepseek.com/guides/web_tools.md#read-links).

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["deepseek_read_url"]`

  - **`name`** (optional)

    Optional. The service does not check it.

    - `type`: `string`

    - `enum`: `["deepseek_read_url"]`

### schema-anthropic-tool-choice-auto

**AnthropicToolChoiceAuto** — `#/components/schemas/AnthropicToolChoiceAuto`

- title: `Automatic tool choice`

The model decides whether to call a tool. This is the default.

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["auto"]`

  - **`disable_parallel_tool_use`** (optional)

    Ignored; it does not disable parallel tool calls.

    - `type`: `boolean`

    - `nullable`: `true`

### schema-anthropic-tool-choice-any

**AnthropicToolChoiceAny** — `#/components/schemas/AnthropicToolChoiceAny`

- title: `Any tool (automatic)`

Treated as `auto`; the model decides whether to call a tool.

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["any"]`

  - **`disable_parallel_tool_use`** (optional)

    Ignored; it does not disable parallel tool calls.

    - `type`: `boolean`

    - `nullable`: `true`

### schema-anthropic-tool-choice-named

**AnthropicToolChoiceNamed** — `#/components/schemas/AnthropicToolChoiceNamed`

- title: `Named tool choice`

Selects the named tool. For a client tool, this forces a call in non-thinking mode; selecting it in thinking mode returns a `400` error. Set `thinking.type` to `disabled` when forcing a client-tool call.

- `type`: `object`

- `required`: `["type","name"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["tool"]`

  - **`name`** (required)

    The name of a tool present in `tools`.

    - `type`: `string`

  - **`disable_parallel_tool_use`** (optional)

    Ignored; it does not disable parallel tool calls.

    - `type`: `boolean`

    - `nullable`: `true`

### schema-anthropic-tool-choice-none

**AnthropicToolChoiceNone** — `#/components/schemas/AnthropicToolChoiceNone`

- title: `Disable tool calls`

Disables tool calling, even when `tools` is provided.

- `type`: `object`

- `required`: `["type"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["none"]`

### schema-anthropic-text-block

**AnthropicTextBlock** — `#/components/schemas/AnthropicTextBlock`

- title: `Text block`

Each text block must have `type: "text"`, with its content in the `text` field. On input, additional `cache_control` and `citations` fields are ignored.

- `type`: `object`

- `required`: `["type","text"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["text"]`

  - **`text`** (required)

    The text content.

    - `type`: `string`

  - **`citations`** (optional)

    Sources cited by this text. Returned when the answer cites results of the web tools; ignored on input.

    - `type`: `array`

    - `nullable`: `true`

    - **Array items**

      - Reference: [AnthropicWebSearchResultLocation](#schema-anthropic-web-search-result-location) (`#/components/schemas/AnthropicWebSearchResultLocation`)

### schema-anthropic-output-thinking-block

**AnthropicOutputThinkingBlock** — `#/components/schemas/AnthropicOutputThinkingBlock`

- title: `Thinking output`

- `type`: `object`

- `required`: `["type","thinking","signature"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["thinking"]`

  - **`thinking`** (required)

    The generated thinking content. Return this block unchanged when continuing a thinking-mode tool conversation.

    - `type`: `string`

  - **`signature`** (required)

    Opaque signature returned with the thinking block; preserve it when replaying the block.

    - `type`: `string`

### schema-anthropic-tool-use-block

**AnthropicToolUseBlock** — `#/components/schemas/AnthropicToolUseBlock`

- title: `Tool-use block`

Appears in assistant messages. Each tool-use block must have a matching tool-result block in the immediately following user message.

- `type`: `object`

- `required`: `["type","id","name","input"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["tool_use"]`

  - **`id`** (required)

    The tool-call ID. Pass this ID back as `tool_result.tool_use_id`.

    - `type`: `string`

  - **`name`** (required)

    The name of the client tool.

    - `type`: `string`

  - **`input`** (required)

    The JSON arguments supplied to the tool, normally an object matching its `input_schema`.

### schema-anthropic-output-server-tool-use-block

**AnthropicOutputServerToolUseBlock** — `#/components/schemas/AnthropicOutputServerToolUseBlock`

- title: `Server tool use output`

Describes a tool call executed by the service. Request-level search counts are reported separately in `usage.server_tool_use`; the client does not execute this call.

- `type`: `object`

- `required`: `["type","id","name","input","caller"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["server_tool_use"]`

  - **`id`** (required)

    Identifier of the server tool call.

    - `type`: `string`

  - **`name`** (required)

    Name of the server tool: `web_search` for web search. With the web tools, the declared tool that enabled the capability: `deepseek_web_search` for searches and the steps of deep thinking search, or `deepseek_read_url` for URL reading.

    - `type`: `string`

  - **`input`** (required)

    Arguments supplied to the server tool as a JSON value, normally an object. With the web tools, `input.action` is `search`, `open_page`, `find_in_page` or `read_link`.

  - **`caller`** (required)

    - title: `Caller`

    - `type`: `object`

    - `required`: `["type"]`

    - **Properties**

      - **`type`** (required)

        - `type`: `string`

        - `enum`: `["direct"]`

  - **`kind`** (optional)

    - Reference: [AnthropicDeepSeekWebToolsKind](#schema-anthropic-deep-seek-web-tools-kind) (`#/components/schemas/AnthropicDeepSeekWebToolsKind`)

### schema-anthropic-web-search-tool-result-block

**AnthropicWebSearchToolResultBlock** — `#/components/schemas/AnthropicWebSearchToolResultBlock`

- title: `Web search result block`

- `type`: `object`

- `required`: `["type","tool_use_id","content"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_search_tool_result"]`

  - **`tool_use_id`** (required)

    The ID of the associated `server_tool_use` block.

    - `type`: `string`

  - **`content`** (required)

    Search results or search-error items. Pass the entire array back unchanged with the assistant message.

    - `type`: `array`

    - **Array items**

      - Reference: [AnthropicWebSearchResultContent](#schema-anthropic-web-search-result-content) (`#/components/schemas/AnthropicWebSearchResultContent`)

  - **`kind`** (optional)

    - Reference: [AnthropicDeepSeekWebToolsKind](#schema-anthropic-deep-seek-web-tools-kind) (`#/components/schemas/AnthropicDeepSeekWebToolsKind`)

### schema-anthropic-web-fetch-tool-result-block

**AnthropicWebFetchToolResultBlock** — `#/components/schemas/AnthropicWebFetchToolResultBlock`

- title: `Web fetch result block`

Returned for a page opened during deep thinking search (`deepseek_web_search`), or a link read by `deepseek_read_url`. Pass it back unchanged, including `kind` and `signature`. See the [Web Tools Guide](https://api-docs.deepseek.com/guides/web_tools.md#response-blocks).

- `type`: `object`

- `required`: `["type","tool_use_id","content"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_fetch_tool_result"]`

  - **`tool_use_id`** (required)

    The ID of the associated `server_tool_use` block.

    - `type`: `string`

  - **`content`** (required)

    The fetched page, or the reason the fetch failed.

    - **oneOf**

      - oneOf 1

        - Reference: [AnthropicWebFetchResult](#schema-anthropic-web-fetch-result) (`#/components/schemas/AnthropicWebFetchResult`)

      - oneOf 2

        - Reference: [AnthropicWebFetchToolResultError](#schema-anthropic-web-fetch-tool-result-error) (`#/components/schemas/AnthropicWebFetchToolResultError`)

  - **`kind`** (optional)

    - Reference: [AnthropicDeepSeekWebToolsKind](#schema-anthropic-deep-seek-web-tools-kind) (`#/components/schemas/AnthropicDeepSeekWebToolsKind`)

  - **`signature`** (optional)

    DeepSeek extension. Present on successful `read_link` results: the page that was read, encrypted. Pass it back unchanged to restore the page into the context.

    - `type`: `string`

### schema-anthropic-content-block-delta

**AnthropicContentBlockDelta** — `#/components/schemas/AnthropicContentBlockDelta`

- title: `Content delta`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextDelta](#schema-anthropic-text-delta) (`#/components/schemas/AnthropicTextDelta`)

  - oneOf 2

    - Reference: [AnthropicThinkingDelta](#schema-anthropic-thinking-delta) (`#/components/schemas/AnthropicThinkingDelta`)

  - oneOf 3

    - Reference: [AnthropicSignatureDelta](#schema-anthropic-signature-delta) (`#/components/schemas/AnthropicSignatureDelta`)

  - oneOf 4

    - Reference: [AnthropicInputJsonDelta](#schema-anthropic-input-json-delta) (`#/components/schemas/AnthropicInputJsonDelta`)

  - oneOf 5

    - Reference: [AnthropicCitationsDelta](#schema-anthropic-citations-delta) (`#/components/schemas/AnthropicCitationsDelta`)

### schema-anthropic-user-content

**AnthropicUserContent** — `#/components/schemas/AnthropicUserContent`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextContent](#schema-anthropic-text-content) (`#/components/schemas/AnthropicTextContent`)

  - oneOf 2

    - Reference: [AnthropicUserBlocks](#schema-anthropic-user-blocks) (`#/components/schemas/AnthropicUserBlocks`)

### schema-anthropic-assistant-content

**AnthropicAssistantContent** — `#/components/schemas/AnthropicAssistantContent`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextContent](#schema-anthropic-text-content) (`#/components/schemas/AnthropicTextContent`)

  - oneOf 2

    - Reference: [AnthropicAssistantBlocks](#schema-anthropic-assistant-blocks) (`#/components/schemas/AnthropicAssistantBlocks`)

### schema-anthropic-web-search-result-location

**AnthropicWebSearchResultLocation** — `#/components/schemas/AnthropicWebSearchResultLocation`

- title: `Web search citation`

A source cited by the answer. Returned with the web tools.

- `type`: `object`

- `required`: `["type","url"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_search_result_location"]`

  - **`url`** (required)

    The URL of the cited source.

    - `type`: `string`

  - **`title`** (optional)

    The title of the cited source, or `null` when unknown.

    - `type`: `string`

    - `nullable`: `true`

  - **`encrypted_index`** (optional)

    Always an empty string.

    - `type`: `string`

  - **`cited_text`** (optional)

    The answer text of the current text block up to this citation. Unlike the Anthropic API, it is not text quoted from the source.

    - `type`: `string`

### schema-anthropic-deep-seek-web-tools-kind

**AnthropicDeepSeekWebToolsKind** — `#/components/schemas/AnthropicDeepSeekWebToolsKind`

- title: `Web tools capability`

DeepSeek extension on blocks produced by the web tools: `search` for web search, `deep_search` for deep thinking search, `read_link` for URL reading, and `image_search` or `deep_image_search` (during deep thinking search) for image search. Pass it back unchanged.

- `type`: `string`

- `enum`: `["search","deep_search","read_link","image_search","deep_image_search"]`

### schema-anthropic-web-search-result-content

**AnthropicWebSearchResultContent** — `#/components/schemas/AnthropicWebSearchResultContent`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicWebSearchResult](#schema-anthropic-web-search-result) (`#/components/schemas/AnthropicWebSearchResult`)

  - oneOf 2

    - Reference: [AnthropicWebSearchToolResultError](#schema-anthropic-web-search-tool-result-error) (`#/components/schemas/AnthropicWebSearchToolResultError`)

### schema-anthropic-web-fetch-result

**AnthropicWebFetchResult** — `#/components/schemas/AnthropicWebFetchResult`

- title: `Web fetch result`

- `type`: `object`

- `required`: `["type","url","content"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_fetch_result"]`

  - **`url`** (required)

    The URL of the page.

    - `type`: `string`

  - **`content`** (required)

    - title: `Page document`

    The page as a text document.

    - `type`: `object`

    - **Properties**

      - **`type`** (optional)

        - `type`: `string`

        - `enum`: `["document"]`

      - **`source`** (optional)

        - title: `Page text`

        - `type`: `object`

        - **Properties**

          - **`type`** (optional)

            - `type`: `string`

            - `enum`: `["text"]`

          - **`media_type`** (optional)

            - `type`: `string`

            - `enum`: `["text/plain"]`

          - **`data`** (optional)

            Always an empty string: the page text is not returned. For `read_link`, the page is carried in `signature`.

            - `type`: `string`

      - **`title`** (optional)

        The page title.

        - `type`: `string`

        - `nullable`: `true`

  - **`published_at`** (optional)

    DeepSeek extension, in place of `retrieved_at`. The publication time of the page, or `null` when unknown. For a link read from the user message, the date found on the page, in no fixed format; for a page opened during deep thinking search, an RFC 3339 timestamp.

    - `type`: `string`

    - `nullable`: `true`

### schema-anthropic-web-fetch-tool-result-error

**AnthropicWebFetchToolResultError** — `#/components/schemas/AnthropicWebFetchToolResultError`

- title: `Web fetch error`

- `type`: `object`

- `required`: `["type","error_code"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_fetch_tool_result_error"]`

  - **`error_code`** (required)

    The reason the fetch failed. See the [Web Tools Guide](https://api-docs.deepseek.com/guides/web_tools.md#response-blocks).

    - `type`: `string`

    - `enum`: `["url_not_accessible","url_not_allowed","unavailable"]`

### schema-anthropic-text-delta

**AnthropicTextDelta** — `#/components/schemas/AnthropicTextDelta`

- title: `Text delta`

- `type`: `object`

- `required`: `["type","text"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["text_delta"]`

  - **`text`** (required)

    Append this text to the current text block.

    - `type`: `string`

### schema-anthropic-thinking-delta

**AnthropicThinkingDelta** — `#/components/schemas/AnthropicThinkingDelta`

- title: `Thinking delta`

- `type`: `object`

- `required`: `["type","thinking"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["thinking_delta"]`

  - **`thinking`** (required)

    Append this text to the current thinking block.

    - `type`: `string`

### schema-anthropic-signature-delta

**AnthropicSignatureDelta** — `#/components/schemas/AnthropicSignatureDelta`

- title: `Signature delta`

- `type`: `object`

- `required`: `["type","signature"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["signature_delta"]`

  - **`signature`** (required)

    Signature for the completed thinking block.

    - `type`: `string`

### schema-anthropic-input-json-delta

**AnthropicInputJsonDelta** — `#/components/schemas/AnthropicInputJsonDelta`

- title: `Tool input delta`

- `type`: `object`

- `required`: `["type","partial_json"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["input_json_delta"]`

  - **`partial_json`** (required)

    A fragment of the tool input JSON. Concatenate all fragments for this block, then parse the JSON after content\_block\_stop.

    - `type`: `string`

### schema-anthropic-citations-delta

**AnthropicCitationsDelta** — `#/components/schemas/AnthropicCitationsDelta`

- title: `Citations delta`

Adds one citation to the current text block. Returned with the web tools.

- `type`: `object`

- `required`: `["type","citation"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["citations_delta"]`

  - **`citation`** (required)

    - Reference: [AnthropicWebSearchResultLocation](#schema-anthropic-web-search-result-location) (`#/components/schemas/AnthropicWebSearchResultLocation`)

### schema-anthropic-user-blocks

**AnthropicUserBlocks** — `#/components/schemas/AnthropicUserBlocks`

- title: `User content blocks`

Place all `tool_result` blocks before text or image blocks when replying to tool calls.

- `type`: `array`

- `minItems`: `1`

- **Array items**

  - Reference: [AnthropicUserContentBlock](#schema-anthropic-user-content-block) (`#/components/schemas/AnthropicUserContentBlock`)

### schema-anthropic-assistant-blocks

**AnthropicAssistantBlocks** — `#/components/schemas/AnthropicAssistantBlocks`

- title: `Assistant content blocks`

- `type`: `array`

- `minItems`: `1`

- **Array items**

  - Reference: [AnthropicAssistantContentBlock](#schema-anthropic-assistant-content-block) (`#/components/schemas/AnthropicAssistantContentBlock`)

### schema-anthropic-web-search-result

**AnthropicWebSearchResult** — `#/components/schemas/AnthropicWebSearchResult`

- title: `Web search result`

- `type`: `object`

- `required`: `["type","title","url","encrypted_content"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_search_result"]`

  - **`title`** (required)

    The title of the result page.

    - `type`: `string`

  - **`url`** (required)

    The URL of the result page.

    - `type`: `string`

    - `format`: `uri`

  - **`encrypted_content`** (required)

    Opaque result content. Preserve this value unchanged when passing the result back.

    - `type`: `string`

  - **`page_age`** (optional)

    Page-age metadata, when available; may be `null`.

    - `type`: `string`

    - `nullable`: `true`

  - **`snippet`** (optional)

    DeepSeek extension. A plain-text summary of the result for display.

    - `type`: `string`

    - `nullable`: `true`

  - **`site_name`** (optional)

    DeepSeek extension. The name of the site, or `null` when unknown.

    - `type`: `string`

    - `nullable`: `true`

  - **`site_icon`** (optional)

    DeepSeek extension. The URL of the site icon, or `null` when unknown.

    - `type`: `string`

    - `nullable`: `true`

### schema-anthropic-web-search-tool-result-error

**AnthropicWebSearchToolResultError** — `#/components/schemas/AnthropicWebSearchToolResultError`

- title: `Web search error`

- `type`: `object`

- `required`: `["type","error_code"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["web_search_tool_result_error"]`

  - **`error_code`** (required)

    The reason the server-side search failed.

    - `type`: `string`

    - `enum`: `["invalid_tool_input","unavailable","max_uses_exceeded","too_many_requests","query_too_long","request_too_large"]`

### schema-anthropic-user-content-block

**AnthropicUserContentBlock** — `#/components/schemas/AnthropicUserContentBlock`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextBlock](#schema-anthropic-text-block) (`#/components/schemas/AnthropicTextBlock`)

  - oneOf 2

    - Reference: [AnthropicImageBlock](#schema-anthropic-image-block) (`#/components/schemas/AnthropicImageBlock`)

  - oneOf 3

    - Reference: [AnthropicDocumentBlock](#schema-anthropic-document-block) (`#/components/schemas/AnthropicDocumentBlock`)

  - oneOf 4

    - Reference: [AnthropicToolResultBlock](#schema-anthropic-tool-result-block) (`#/components/schemas/AnthropicToolResultBlock`)

### schema-anthropic-assistant-content-block

**AnthropicAssistantContentBlock** — `#/components/schemas/AnthropicAssistantContentBlock`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextBlock](#schema-anthropic-text-block) (`#/components/schemas/AnthropicTextBlock`)

  - oneOf 2

    - Reference: [AnthropicThinkingBlock](#schema-anthropic-thinking-block) (`#/components/schemas/AnthropicThinkingBlock`)

  - oneOf 3

    - Reference: [AnthropicToolUseBlock](#schema-anthropic-tool-use-block) (`#/components/schemas/AnthropicToolUseBlock`)

  - oneOf 4

    - Reference: [AnthropicServerToolUseBlock](#schema-anthropic-server-tool-use-block) (`#/components/schemas/AnthropicServerToolUseBlock`)

  - oneOf 5

    - Reference: [AnthropicWebSearchToolResultBlock](#schema-anthropic-web-search-tool-result-block) (`#/components/schemas/AnthropicWebSearchToolResultBlock`)

  - oneOf 6

    - Reference: [AnthropicWebFetchToolResultBlock](#schema-anthropic-web-fetch-tool-result-block) (`#/components/schemas/AnthropicWebFetchToolResultBlock`)

### schema-anthropic-image-block

**AnthropicImageBlock** — `#/components/schemas/AnthropicImageBlock`

- title: `Image block`

Image input is supported by `deepseek-flash` in user messages and tool results. Images in assistant messages are not supported. `deepseek-v4-pro` does not support image input. See the [Vision Guide](https://api-docs.deepseek.com/guides/vision.md) for image limits.

- `type`: `object`

- `required`: `["type","source"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["image"]`

  - **`source`** (required)

    - Reference: [AnthropicImageSource](#schema-anthropic-image-source) (`#/components/schemas/AnthropicImageSource`)

### schema-anthropic-document-block

**AnthropicDocumentBlock** — `#/components/schemas/AnthropicDocumentBlock`

- title: `Document block`

A document for the model to read, supported in user messages. See the [File Parsing Guide](https://api-docs.deepseek.com/guides/document_parsing.md#document-qa).

- `type`: `object`

- `required`: `["type","source"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["document"]`

  - **`source`** (required)

    - **oneOf**

      - oneOf 1

        - Reference: [AnthropicFileDocumentSource](#schema-anthropic-file-document-source) (`#/components/schemas/AnthropicFileDocumentSource`)

      - oneOf 2

        - Reference: [AnthropicTextDocumentSource](#schema-anthropic-text-document-source) (`#/components/schemas/AnthropicTextDocumentSource`)

  - **`title`** (optional)

    Optional. The file name shown to the model for a `text` source.

    - `type`: `string`

### schema-anthropic-tool-result-block

**AnthropicToolResultBlock** — `#/components/schemas/AnthropicToolResultBlock`

- title: `Tool-result block`

Only valid in user messages. Return one result for every pending tool-use ID, with no duplicates, before any text or image blocks.

- `type`: `object`

- `required`: `["type","tool_use_id"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["tool_result"]`

  - **`tool_use_id`** (required)

    The ID of the corresponding `tool_use` block in the immediately preceding assistant message.

    - `type`: `string`

  - **`content`** (optional)

    - Reference: [AnthropicToolResultContent](#schema-anthropic-tool-result-content) (`#/components/schemas/AnthropicToolResultContent`)

  - **`is_error`** (optional)

    Ignored. Include any error details in `content`.

    - `type`: `boolean`

    - `nullable`: `true`

### schema-anthropic-thinking-block

**AnthropicThinkingBlock** — `#/components/schemas/AnthropicThinkingBlock`

- title: `Thinking block`

- `type`: `object`

- `required`: `["type","thinking"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["thinking"]`

  - **`thinking`** (required)

    Thinking content returned by the model. Pass it back unchanged when continuing a tool-call turn in thinking mode.

    - `type`: `string`

  - **`signature`** (optional)

    The signature returned with the thinking block. Preserve it when passing back the block; the input signature is not validated.

    - `type`: `string`

    - `nullable`: `true`

### schema-anthropic-server-tool-use-block

**AnthropicServerToolUseBlock** — `#/components/schemas/AnthropicServerToolUseBlock`

- title: `Server-tool-use block`

Returned when the service runs web search, `deepseek_web_search` or `deepseek_read_url`. Its matching `web_search_tool_result` or `web_fetch_tool_result` appears in the same assistant message; the client does not run this tool.

- `type`: `object`

- `required`: `["type","id","name","input"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["server_tool_use"]`

  - **`id`** (required)

    The server-tool-call ID.

    - `type`: `string`

  - **`name`** (required)

    - `type`: `string`

    - `enum`: `["web_search","web_fetch","deepseek_web_search","deepseek_read_url"]`

  - **`input`** (required)

    The server-tool arguments as a JSON value, normally an object such as `{"query":"..."}`. Preserve them when passing back the assistant message.

  - **`caller`** (optional)

    Identifies a direct server-tool call.

    - `type`: `object`

    - `required`: `["type"]`

    - **Properties**

      - **`type`** (required)

        - `type`: `string`

        - `enum`: `["direct"]`

  - **`kind`** (optional)

    - Reference: [AnthropicDeepSeekWebToolsKind](#schema-anthropic-deep-seek-web-tools-kind) (`#/components/schemas/AnthropicDeepSeekWebToolsKind`)

### schema-anthropic-image-source

**AnthropicImageSource** — `#/components/schemas/AnthropicImageSource`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicBase64ImageSource](#schema-anthropic-base-64-image-source) (`#/components/schemas/AnthropicBase64ImageSource`)

  - oneOf 2

    - Reference: [AnthropicUrlImageSource](#schema-anthropic-url-image-source) (`#/components/schemas/AnthropicUrlImageSource`)

  - oneOf 3

    - Reference: [AnthropicFileImageSource](#schema-anthropic-file-image-source) (`#/components/schemas/AnthropicFileImageSource`)

### schema-anthropic-file-document-source

**AnthropicFileDocumentSource** — `#/components/schemas/AnthropicFileDocumentSource`

- title: `Uploaded file`

The request must carry the `anthropic-beta: files-api-2025-04-14` header.

- `type`: `object`

- `required`: `["type","file_id"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["file"]`

  - **`file_id`** (required)

    The ID of a file uploaded via the [Files API](https://api-docs.deepseek.com/guides/files_api.md), of the form `file-api-...`.

    - `type`: `string`

### schema-anthropic-text-document-source

**AnthropicTextDocumentSource** — `#/components/schemas/AnthropicTextDocumentSource`

- title: `Inline text`

- `type`: `object`

- `required`: `["type","data"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["text"]`

  - **`media_type`** (optional)

    - `type`: `string`

    - `enum`: `["text/plain"]`

  - **`data`** (required)

    The text of the document.

    - `type`: `string`

### schema-anthropic-tool-result-content

**AnthropicToolResultContent** — `#/components/schemas/AnthropicToolResultContent`

The tool output as a string or a list of text and image blocks. If omitted or `null`, the result is empty.

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextContent](#schema-anthropic-text-content) (`#/components/schemas/AnthropicTextContent`)

  - oneOf 2

    - Reference: [AnthropicToolResultBlocks](#schema-anthropic-tool-result-blocks) (`#/components/schemas/AnthropicToolResultBlocks`)

  - oneOf 3

    - Reference: [AnthropicNullValue](#schema-anthropic-null-value) (`#/components/schemas/AnthropicNullValue`)

### schema-anthropic-base-64-image-source

**AnthropicBase64ImageSource** — `#/components/schemas/AnthropicBase64ImageSource`

- title: `Base64 image`

- `type`: `object`

- `required`: `["type","media_type","data"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["base64"]`

  - **`media_type`** (required)

    - `type`: `string`

    - `enum`: `["image/jpeg","image/png","image/gif","image/webp"]`

  - **`data`** (required)

    The base64-encoded image bytes, without a data-URL prefix.

    - `type`: `string`

### schema-anthropic-url-image-source

**AnthropicUrlImageSource** — `#/components/schemas/AnthropicUrlImageSource`

- title: `Image URL`

- `type`: `object`

- `required`: `["type","url"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["url"]`

  - **`url`** (required)

    An HTTP or HTTPS URL from which the server can download the image.

    - `type`: `string`

    - `format`: `uri`

### schema-anthropic-file-image-source

**AnthropicFileImageSource** — `#/components/schemas/AnthropicFileImageSource`

- title: `Uploaded image file`

Requires the request header `anthropic-beta: files-api-2025-04-14`.

- `type`: `object`

- `required`: `["type","file_id"]`

- **Properties**

  - **`type`** (required)

    - `type`: `string`

    - `enum`: `["file"]`

  - **`file_id`** (required)

    The ID of an uploaded image file. See the [Files API Guide](https://api-docs.deepseek.com/guides/files_api.md#anthropic-compatible-files-api).

    - `type`: `string`

### schema-anthropic-tool-result-blocks

**AnthropicToolResultBlocks** — `#/components/schemas/AnthropicToolResultBlocks`

- title: `Tool-result content blocks`

- `type`: `array`

- **Array items**

  - Reference: [AnthropicToolResultContentBlock](#schema-anthropic-tool-result-content-block) (`#/components/schemas/AnthropicToolResultContentBlock`)

### schema-anthropic-tool-result-content-block

**AnthropicToolResultContentBlock** — `#/components/schemas/AnthropicToolResultContentBlock`

- **oneOf**

  - oneOf 1

    - Reference: [AnthropicTextBlock](#schema-anthropic-text-block) (`#/components/schemas/AnthropicTextBlock`)

  - oneOf 2

    - Reference: [AnthropicImageBlock](#schema-anthropic-image-block) (`#/components/schemas/AnthropicImageBlock`)
