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

# ルーティングされたチャット補完を作成する

> 標準のチャット補完リクエストを送信します。`model` はタスクエイリアス、
`alias@v2` などのバージョン固定、または `openai/gpt-5.6-sol` などの登録済みプロバイダーへの直接参照を受け入れます。タスクリクエストは自動的にトレースされます。




## OpenAPI

````yaml ja/openapi/model-distillation/proxy.openapi.yaml POST /chat/completions
openapi: 3.1.0
info:
  title: Model Distillation Inference Proxy
  version: 1.0.0
  description: |
    W&B 認証、タスクルーティング、
    プロバイダー認証情報、パラメーターのオーバーライド、スティッキートラフィック、トレーニング品質のトレースを備えた OpenAI 互換チャット補完。
servers:
  - url: https://proxy.training.wandb.ai/v1
    description: 本番
security:
  - WandbApiKey: []
tags:
  - name: Chat Completions
paths:
  /chat/completions:
    post:
      tags:
        - Chat Completions
      summary: ルーティング付きチャット補完を作成
      description: >
        標準のチャット補完リクエストを送信します。`model` はタスクエイリアス、

        `alias@v2` などのバージョン固定、または `openai/gpt-5.6-sol`
        などの登録済みプロバイダーへの直接参照を受け入れます。タスクリクエストは自動的にトレースされます。
      operationId: createChatCompletion
      parameters:
        - name: wandb-cache-mode
          in: header
          required: false
          description: >-
            ストリーミングではないタスクルーティング経由または直接の `provider/model`
            リクエストで、応答の完全一致に基づくキャッシュを有効にします。キャッシュの識別には、実際に上流へ送信されるリクエストボディと、転送されるパスおよびクエリパラメーターが使用されます。直接リクエストのキャッシュはさらに、entity、プロバイダー設定、モデル、パススルーのユーザーアイデンティティ、および転送される
            W&B Inference project ごとに分離されます。`readWrite`
            はキャッシュの読み取りと書き込みを行い、`readOnly` は読み取りのみ、`writeOnly`
            は書き込みのみを行います。保存されるのは、正常な応答のうち 8 MiB 以下のものだけです。無効な値を指定すると HTTP 400
            が返されます。`op-cache`
            も指定する場合は、両方のヘッダーで同じモードを選択する必要があります。ストリーミングリクエストでは応答のキャッシュはサポートされません。
          schema:
            type: string
            enum:
              - readWrite
              - readOnly
              - writeOnly
        - name: op-cache
          in: header
          required: false
          deprecated: true
          description: >-
            `wandb-cache-mode` の OpenPipe 互換エイリアスです。同じモードを受け入れ、`true` は
            `readWrite` と同等です。両方のヘッダーを指定する場合は、同じモードを選択する必要があります。
          schema:
            type: string
            enum:
              - readWrite
              - readOnly
              - writeOnly
              - 'true'
      requestBody:
        required: true
        content:
          application/json:
            examples:
              task:
                summary: タスクルーティングリクエスト
                value:
                  model: ticket-classifier
                  messages:
                    - role: user
                      content: Classify this support request.
                  metadata:
                    wandb.entity: your-team
                    wandb.thread_id: conversation-4827
              direct:
                summary: プロバイダーへの直接リクエスト
                value:
                  model: openai/gpt-5.6-sol
                  messages:
                    - role: user
                      content: Say hello.
            schema:
              type: object
              properties:
                model:
                  type: string
                  minLength: 1
                  description: タスクエイリアス、`alias@vN`、または `{provider}/{model-id}`。
                messages:
                  minItems: 1
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                        enum:
                          - developer
                          - system
                          - user
                          - assistant
                          - tool
                          - function
                      content:
                        description: ロールで許可されている場合は、テキスト、マルチモーダルコンテンツパート、または null。
                      name:
                        type: string
                      tool_call_id:
                        type: string
                      tool_calls:
                        type: array
                        items:
                          type: object
                          properties: {}
                          additionalProperties: {}
                    required:
                      - role
                    additionalProperties: {}
                metadata:
                  type: object
                  properties:
                    wandb.entity:
                      description: >-
                        タスクまたはプロバイダーを所有する、アクセス権のある entity。キーのデフォルトの entity
                        を使用する場合は省略します。
                      type: string
                      minLength: 1
                    wandb.thread_id:
                      description: 推奨の会話およびスティッキールーティング識別子。
                      type: string
                      minLength: 1
                    gen_ai.conversation.id:
                      description: '`wandb.thread_id` がない場合に使用する会話識別子。'
                      type: string
                      minLength: 1
                    wandb.turn_index:
                      description: リプレイおよびデータセット再構成時に使用する、信頼できるソースターンのインデックス。
                      type: integer
                      minimum: 0
                      maximum: 9007199254740991
                    wandb.project:
                      description: >-
                        `project` または
                        `entity/project`。直接のプロバイダーへのCallでトレースを有効にします。
                      type: string
                    wandb.trace_surface:
                      description: トレースを有効化した直接 Call にのみ適用されるトレース表示の上書き。
                      type: string
                      enum:
                        - spans
                        - calls
                        - both
                    wandb.call_shadow:
                      description: >-
                        タスクにルーティングされたスパンをログするために、Call
                        のシャドウをリクエストします。追加すると、トレースが重複して保存されます。
                      type: boolean
                    user.id:
                      description: トレースに関連付けられるエンドユーザーアイデンティティ。
                      type: string
                      minLength: 1
                  additionalProperties: {}
                stream:
                  default: false
                  type: boolean
                temperature:
                  type: number
                tools:
                  type: array
                  items:
                    type: object
                    properties: {}
                    additionalProperties: {}
                tool_choice: {}
                response_format:
                  type: object
                  properties: {}
                  additionalProperties: {}
                reasoning_effort:
                  type: string
                max_tokens:
                  type: integer
                  minimum: 1
                  maximum: 9007199254740991
                max_completion_tokens:
                  type: integer
                  minimum: 1
                  maximum: 9007199254740991
              required:
                - model
                - messages
              additionalProperties: {}
      responses:
        '200':
          description: プロバイダーの応答。ストリーミングリクエストはサーバー送信イベントを返し、`[DONE]` で終了します。
          headers:
            x-proxy-request-id:
              description: サポートおよびトレースの関連付け用のリクエスト識別子。
              schema:
                type: string
                format: uuid
            wandb-cache-status:
              description: 完全一致した応答のキャッシュ結果。リクエストでキャッシュの読み取りが有効になっている場合にのみ含まれます。
              schema:
                type: string
                enum:
                  - hit
                  - miss
            x-wandb-cache:
              deprecated: true
              description: '`wandb-cache-status` の互換エイリアス。'
              schema:
                type: string
                enum:
                  - hit
                  - miss
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  created:
                    type: integer
                    minimum: -9007199254740991
                    maximum: 9007199254740991
                  model:
                    type: string
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        index:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        message:
                          type: object
                          properties: {}
                          additionalProperties: {}
                        finish_reason:
                          anyOf:
                            - type: string
                            - type: 'null'
                      additionalProperties: {}
                  usage:
                    type: object
                    properties: {}
                    additionalProperties: {}
                additionalProperties: {}
            text/event-stream:
              schema:
                type: string
        '400':
          $ref: '#/components/responses/ProxyError'
        '401':
          $ref: '#/components/responses/ProxyError'
        '403':
          $ref: '#/components/responses/ProxyError'
        '404':
          $ref: '#/components/responses/ProxyError'
        '500':
          $ref: '#/components/responses/ProxyError'
        '502':
          $ref: '#/components/responses/ProxyError'
components:
  responses:
    ProxyError:
      description: プロキシによって生成されたエラー。プロバイダーによって生成されたエラーでは、プロバイダーのステータスと応答本文が保持されます。
      headers:
        x-proxy-request-id:
          description: サポートおよびトレースの関連付け用のリクエスト識別子。
          schema:
            type: string
            format: uuid
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ProxyError'
  schemas:
    ProxyError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            type:
              type: string
              const: proxy_error
          required:
            - message
            - type
          additionalProperties: false
      required:
        - error
      additionalProperties: false
  securitySchemes:
    WandbApiKey:
      type: http
      scheme: bearer
      bearerFormat: W&B API key
      description: 選択したタスクとプロバイダーを所有する個人/デフォルトの entity またはチームに属する W&B APIキー。

````