> ## Documentation Index
> Fetch the complete documentation index at: https://docs.evolink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# DeepSeek - 完全なAPIリファレンス

> - OpenAI SDK形式でDeepSeekモデルを呼び出し
- 同期処理モード、リアルタイムレスポンス
- `deepseek-chat`（一般会話）と`deepseek-reasoner`（深層推論）モデルに対応
- **テキストチャット**：シングルまたはマルチターンのコンテキスト会話
- **システムプロンプト**：AIの役割と動作をカスタマイズ
- **ストリーミング**：SSEストリーミング出力対応
- **ツール呼び出し**：Function Calling対応

<Note>
  **BaseURL**：デフォルトの BaseURL は `https://direct.evolink.ai` で、テキストモデルへの対応が優れており、長時間接続をサポートします。`https://api.evolink.ai` はマルチモーダルの主力エンドポイントで、テキストモデルに対しては代替アドレスとして使用されます。
</Note>


## OpenAPI

````yaml ja/api-manual/language-series/deepseek/deepseek-reference.json POST /v1/chat/completions
openapi: 3.1.0
info:
  title: DeepSeek完全なAPIリファレンス
  description: DeepSeekチャットインターフェースの完全なAPIリファレンス、すべてのパラメータと高度な機能を含む
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://direct.evolink.ai
    description: 本番環境（推奨）
  - url: https://api.evolink.ai
    description: 代替 URL
security:
  - bearerAuth: []
tags:
  - name: チャット補完
    description: AIチャット補完関連API
paths:
  /v1/chat/completions:
    post:
      tags:
        - チャット補完
      summary: DeepSeek Chat API
      description: |-
        - OpenAI SDK形式でDeepSeekモデルを呼び出し
        - 同期処理モード、リアルタイムレスポンス
        - `deepseek-chat`（一般会話）と`deepseek-reasoner`（深層推論）モデルに対応
        - **テキストチャット**：シングルまたはマルチターンのコンテキスト会話
        - **システムプロンプト**：AIの役割と動作をカスタマイズ
        - **ストリーミング**：SSEストリーミング出力対応
        - **ツール呼び出し**：Function Calling対応
      operationId: createChatCompletionDeepSeek
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionRequest'
            examples:
              simple_text:
                summary: シンプルテキストチャット
                value:
                  model: deepseek-chat
                  messages:
                    - role: user
                      content: Tell me about yourself
              multi_turn:
                summary: マルチターン会話
                value:
                  model: deepseek-chat
                  messages:
                    - role: user
                      content: What is Python?
                    - role: assistant
                      content: Python is a high-level programming language...
                    - role: user
                      content: What are its advantages?
              system_prompt:
                summary: システムプロンプトの使用
                value:
                  model: deepseek-chat
                  messages:
                    - role: system
                      content: >-
                        You are a professional Python programming assistant.
                        Answer questions concisely.
                    - role: user
                      content: How to read a file?
              reasoner:
                summary: 深い推論モデルの使用
                value:
                  model: deepseek-reasoner
                  messages:
                    - role: user
                      content: Prove that the square root of 2 is irrational
      responses:
        '200':
          description: チャット補完が正常に生成されました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionResponse'
        '400':
          description: 無効なリクエストパラメータ
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 400
                  message: 無効なリクエストパラメータ
                  type: invalid_request_error
        '401':
          description: 未認証、トークンが無効または期限切れです
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 401
                  message: Invalid or expired token
                  type: authentication_error
        '402':
          description: クォータ不足、チャージが必要です
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 402
                  message: クォータ不足
                  type: insufficient_quota_error
        '403':
          description: アクセス拒否
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 403
                  message: Access denied for this model
                  type: permission_error
                  param: model
        '404':
          description: リソースが見つかりません
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 404
                  message: Specified model not found
                  type: not_found_error
                  param: model
        '413':
          description: リクエストボディが大きすぎます
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 413
                  message: リクエストボディが大きすぎます
                  type: request_too_large_error
                  param: messages
        '429':
          description: レート制限を超過しました
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 429
                  message: レート制限を超過しました
                  type: rate_limit_error
        '500':
          description: 内部サーバーエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 500
                  message: 内部サーバーエラー
                  type: internal_server_error
        '502':
          description: 上流サービスエラー
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 502
                  message: Upstream AI service unavailable
                  type: upstream_error
        '503':
          description: サービス一時利用不可
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error:
                  code: 503
                  message: サービス一時利用不可
                  type: service_unavailable_error
components:
  schemas:
    ChatCompletionRequest:
      type: object
      required:
        - model
        - messages
      properties:
        model:
          type: string
          description: >-
            チャットモデル名


            - `deepseek-chat`：一般会話モデル

            - `deepseek-reasoner`：深層推論モデル、数学、コーディング、複雑な論理推論に優れる


            **注意**：`deepseek-reasoner`は`temperature`、`top_p`、`tools`、`tool_choice`、`response_format`パラメータに対応していません。これらを渡すとアップストリームで拒否されます
          enum:
            - deepseek-chat
            - deepseek-reasoner
          default: deepseek-chat
          example: deepseek-chat
        messages:
          type: array
          description: |-
            会話メッセージリスト、マルチターン会話に対応

            異なるロールには異なるフィールド構造があります、対応するロールを選択して確認してください
          items:
            oneOf:
              - $ref: '#/components/schemas/SystemMessage'
              - $ref: '#/components/schemas/UserMessage'
              - $ref: '#/components/schemas/AssistantRequestMessage'
              - $ref: '#/components/schemas/ToolMessage'
            discriminator:
              propertyName: role
              mapping:
                system:
                  $ref: '#/components/schemas/SystemMessage'
                user:
                  $ref: '#/components/schemas/UserMessage'
                assistant:
                  $ref: '#/components/schemas/AssistantRequestMessage'
                tool:
                  $ref: '#/components/schemas/ToolMessage'
          minItems: 1
        thinking:
          type: object
          description: |-
            思考モード制御（ベータ）

            **詳細**:
            - `deepseek-reasoner` モデルの深い思考機能を制御します
            - 有効にすると、モデルは応答前に深い推論を行います
          properties:
            type:
              type: string
              description: |-
                思考モードスイッチ

                - `enabled`: 深い思考を有効にする
                - `disabled`: 深い思考を無効にする
              enum:
                - enabled
                - disabled
        frequency_penalty:
          type: number
          description: |-
            繰り返しコンテンツを減らすための頻度ペナルティパラメータ

            **詳細**：
            - 正の値は生成テキスト内の頻度に基づいてトークンにペナルティを与えます
            - 値が高いほど既存のコンテンツを繰り返す可能性が低くなります
            - デフォルト：0（ペナルティなし）
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        max_tokens:
          type: integer
          description: |-
            生成する最大トークン数

            **詳細**:
            - この制限に達するとモデルは生成を停止します
            - 設定されていない場合、モデルが生成長を決定します
          minimum: 1
          example: 4096
        presence_penalty:
          type: number
          description: |-
            新しいトピックを促すプレゼンスペナルティパラメータ

            **詳細**:
            - 正の値はテキストに出現したかどうかに基づいてトークンにペナルティを与えます
            - 高い値は新しいトピックの議論を促します
            - デフォルト:0(ペナルティなし)
          minimum: -2
          maximum: 2
          default: 0
          example: 0
        response_format:
          type: object
          description: |-
            レスポンスフォーマットを指定

            **詳細**:
            - `{"type": "json_object"}` に設定すると JSON モードが有効になります
            - JSON モードでは、モデルは有効な JSON コンテンツを出力します
          properties:
            type:
              type: string
              enum:
                - text
                - json_object
              description: レスポンス形式タイプ
              default: text
        stop:
          description: |-
            停止シーケンス。モデルはこれらの文字列に遭遇すると生成を停止します

            **詳細**:
            - 単一の文字列または文字列の配列が可能
            - 最大16個の停止シーケンス
          oneOf:
            - type: string
            - type: array
              items:
                type: string
              maxItems: 16
        stream:
          type: boolean
          description: |-
            レスポンスをストリーミングするかどうか

            - `true`: SSE（Server-Sent Events）でストリーミング、リアルタイムでチャンク単位でコンテンツを返却
            - `false`: 完全なレスポンスを待ってから返却
          default: false
          example: false
        stream_options:
          type: object
          description: |-
            ストリーミングレスポンスオプション

            `stream=true` の場合のみ有効
          properties:
            include_usage:
              type: boolean
              description: ストリームの最後に使用統計を返す
        temperature:
          type: number
          description: |-
            サンプリング温度、出力のランダム性を制御

            **詳細**:
            - 低い値（例: 0.2）: より決定論的で集中した出力
            - 高い値（例: 1.5）: よりランダムで創造的な出力
            - デフォルト: 1
          minimum: 0
          maximum: 2
          default: 1
          example: 1
        top_p:
          type: number
          description: |-
            Nucleus Samplingパラメータ

            **詳細**:
            - 累積確率が閾値に達するトークンからのサンプリングを制御
            - 例えば、0.9は累積確率が90%に達するトークンからサンプリングすることを意味します
            - デフォルト: 1.0（すべてのトークンを考慮）

            **ヒント**: temperatureとtop_pの両方を同時に調整しないでください
          minimum: 0
          maximum: 1
          default: 1
          example: 1
        tools:
          type: array
          description: |-
            Function Calling 用のツール定義リスト

            **詳細**:
            - 最大128個のツール定義
            - 各ツールには名前、説明、パラメータスキーマが必要です
          items:
            $ref: '#/components/schemas/Tool'
          maxItems: 128
        tool_choice:
          description: |-
            ツール呼び出しの動作を制御

            **オプション**：
            - `none`：ツールを呼び出さない
            - `auto`：モデルがツールを呼び出すかどうかを判断
            - `required`：モデルに1つ以上のツールの呼び出しを強制

            **デフォルト**：ツール未提供時は`none`、ツール提供時は`auto`
          oneOf:
            - type: string
              enum:
                - none
                - auto
                - required
            - type: object
              description: 特定のツールを呼び出すよう指定
              properties:
                type:
                  type: string
                  enum:
                    - function
                function:
                  type: object
                  properties:
                    name:
                      type: string
                      description: 呼び出す関数の名前
                  required:
                    - name
        logprobs:
          type: boolean
          description: |-
            トークンのログ確率を返すかどうか

            **詳細**:
            - `true` に設定すると、レスポンスに各トークンのログ確率情報が含まれます
          default: false
        top_logprobs:
          type: integer
          description: |-
            最も可能性の高い上位Nトークンのログ確率を返す

            **詳細**:
            - `logprobs`を`true`に設定する必要があります
            - 範囲: `[0, 20]`
          minimum: 0
          maximum: 20
    ChatCompletionResponse:
      type: object
      properties:
        id:
          type: string
          description: チャット補完の一意の識別子
          example: 930c60df-bf64-41c9-a88e-3ec75f81e00e
        model:
          type: string
          description: 使用された実際のモデル名
          example: deepseek-chat
        object:
          type: string
          enum:
            - chat.completion
          description: レスポンスタイプ
          example: chat.completion
        created:
          type: integer
          description: 作成タイムスタンプ
          example: 1770617860
        choices:
          type: array
          description: チャット補完選択肢のリスト
          items:
            $ref: '#/components/schemas/Choice'
        usage:
          $ref: '#/components/schemas/Usage'
        system_fingerprint:
          type: string
          description: システムフィンガープリント識別子
          example: fp_eaab8d114b_prod0820_fp8_kvcache
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
              description: HTTP ステータスエラーコード
            message:
              type: string
              description: エラーの説明
            type:
              type: string
              description: エラータイプ
            param:
              type: string
              description: 関連パラメータ名
    SystemMessage:
      title: システムメッセージ
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - system
          description: ロール識別子、`system` 固定
        content:
          type: string
          description: システムプロンプトの内容、AIのロールと動作を定義するために使用
        name:
          type: string
          description: 参加者名、異なるシステムプロンプトソースを区別するために使用
    UserMessage:
      title: ユーザーメッセージ
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
          description: ロール識別子、`user` 固定
        content:
          type: string
          description: ユーザーメッセージコンテンツ（プレーンテキスト文字列）
        name:
          type: string
          description: 参加者名、異なるユーザーを区別するために使用
    AssistantRequestMessage:
      title: アシスタントメッセージ
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - assistant
          description: ロール識別子、`assistant` 固定
        content:
          type:
            - string
            - 'null'
          description: |-
            アシスタントメッセージコンテンツ

            **詳細**：
            - マルチターン会話で過去のアシスタント応答を渡すために使用
            - `tool_calls`が存在する場合は`null`にできます
        name:
          type: string
          description: 参加者名
        prefix:
          type: boolean
          description: |-
            プレフィックス継続モードを有効化（Beta）

            **詳細**：
            - 最後のメッセージでのみ使用
            - `true`の場合、モデルはこのメッセージの`content`をプレフィックスとして生成を継続
          default: false
        reasoning_content:
          type:
            - string
            - 'null'
          description: |-
            Chain of Thoughtコンテンツ（Beta）

            **詳細**：
            - `deepseek-reasoner`モデル使用時のみ有効
            - マルチターン会話で過去の推論プロセスを渡すために使用
            - `prefix`を`true`に設定する必要があります
        tool_calls:
          type: array
          description: |-
            ツール呼び出しリスト

            マルチターン会話で過去のツール呼び出し情報を渡すために使用
          items:
            type: object
            properties:
              id:
                type: string
                description: ツール呼び出しの一意の識別子
              type:
                type: string
                enum:
                  - function
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: 呼び出された関数の名前
                  arguments:
                    type: string
                    description: 関数の引数（JSON文字列）
    ToolMessage:
      title: ツールメッセージ
      type: object
      required:
        - role
        - content
        - tool_call_id
      properties:
        role:
          type: string
          enum:
            - tool
          description: ロール識別子、`tool` 固定
        content:
          type: string
          description: ツール呼び出し結果のコンテンツ
        tool_call_id:
          type: string
          description: |-
            ツール呼び出し ID

            アシスタントメッセージの `tool_calls` で返される `id` フィールドに対応します
    Tool:
      type: object
      required:
        - type
        - function
      properties:
        type:
          type: string
          enum:
            - function
          description: ツールタイプ、現在は `function` のみサポート
        function:
          type: object
          required:
            - name
          properties:
            name:
              type: string
              description: |-
                呼び出す関数の名前

                **詳細**:
                - a-z、A-Z、0-9の文字で構成されるか、アンダースコアとハイフンを含む必要があります
                - 最大長64文字
            description:
              type: string
              description: 関数の説明、モデルがいつどのようにこの関数を呼び出すかを理解するのに役立ちます
            parameters:
              type: object
              description: |-
                関数の入力パラメータ、JSON Schemaオブジェクトとして記述

                **詳細**：
                - `parameters`を省略すると空のパラメータリストを持つ関数を定義します
            strict:
              type: boolean
              description: |-
                厳格モードを有効化（Beta）

                **詳細**：
                - `true`に設定すると、APIは関数呼び出しに厳格モードを使用
                - 出力が常に関数のJSON Schema定義に準拠することを保証
              default: false
    Choice:
      type: object
      properties:
        index:
          type: integer
          description: 選択インデックス
          example: 0
        message:
          $ref: '#/components/schemas/AssistantMessage'
        finish_reason:
          type: string
          description: |-
            終了理由

            - `stop`：自然完了またはストップシーケンスに到達
            - `length`：最大トークン制限に到達
            - `content_filter`：安全ポリシーにより出力がフィルタリング
            - `tool_calls`：モデルがツールを呼び出し
            - `insufficient_system_resource`：バックエンドリソースの制約
          enum:
            - stop
            - length
            - content_filter
            - tool_calls
            - insufficient_system_resource
          example: stop
    Usage:
      type: object
      description: トークン使用統計
      properties:
        prompt_tokens:
          type: integer
          description: 入力のトークン数
          example: 16
        completion_tokens:
          type: integer
          description: 出力のトークン数
          example: 10
        total_tokens:
          type: integer
          description: トークンの合計数
          example: 26
        prompt_cache_hit_tokens:
          type: integer
          description: 入力内のキャッシュヒットトークンの数
          example: 0
        prompt_cache_miss_tokens:
          type: integer
          description: 入力内のキャッシュミストークンの数
          example: 16
    AssistantMessage:
      type: object
      properties:
        role:
          type: string
          description: メッセージ送信者のロール
          enum:
            - assistant
          example: assistant
        content:
          type: string
          description: AIレスポンスコンテンツ
          example: >-
            Hello! I'm DeepSeek, a powerful AI assistant. I excel at general
            conversation, code generation, mathematical reasoning and many other
            tasks.
        reasoning_content:
          type: string
          description: |-
            推論プロセスの内容（`deepseek-reasoner`モデルのみが返します）

            **詳細**:
            - モデルのChain of Thoughtプロセスを含みます
            - `deepseek-reasoner`モデルを使用する場合にのみ返されます
          example: Let me analyze this problem...
        tool_calls:
          type: array
          description: ツール呼び出しリスト（モデルがツールを呼び出すことを決定した場合に返されます）
          items:
            type: object
            properties:
              id:
                type: string
                description: ツール呼び出しの一意の識別子
              type:
                type: string
                enum:
                  - function
              function:
                type: object
                properties:
                  name:
                    type: string
                    description: 呼び出された関数の名前
                  arguments:
                    type: string
                    description: 関数の引数（JSON文字列）
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: |-
        ##すべてのAPIにBearer Token認証が必要です##

        **APIキーの取得：**

        [APIキー管理ページ](https://evolink.ai/dashboard/keys)にアクセスしてAPIキーを取得してください

        **リクエストヘッダーに追加：**
        ```
        Authorization: Bearer YOUR_API_KEY
        ```

````