> ## Documentation Index
> Fetch the complete documentation index at: https://evo-0136956d.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude 聊天

> Anthropic Claude Messages API 格式的请求。
需要在请求头中包含 `anthropic-version`。




## OpenAPI

````yaml /zh/openapi/relay-api.mintlify.json post /v1/messages
openapi: 3.0.1
info:
  title: AI 调用接口
  description: 统一的 AI 模型调用接口，支持 OpenAI、Claude、Gemini、Kling、即梦等多种格式
  version: 1.0.0
servers:
  - url: https://api.nusabase.com
    description: API Base URL
security:
  - BearerAuth: []
tags:
  - name: Models
    description: 获取可用模型列表（支持 OpenAI / Gemini / Anthropic 格式）
  - name: Chat
    description: 对话补全与文本补全（OpenAI Chat Completions 兼容）
  - name: Responses
    description: OpenAI Responses API（支持工具调用、推理、多轮对话）
  - name: Realtime
    description: WebSocket 实时对话（OpenAI Realtime API 兼容）
  - name: Claude
    description: Anthropic Claude Messages API 兼容格式
  - name: Gemini
    description: Google Gemini API 兼容格式
  - name: Images
    description: 图片生成与编辑
  - name: Video
    description: 视频生成（OpenAI Sora 兼容格式 + 通用格式）
  - name: Video / Kling
    description: Kling 视频生成（文生视频 / 图生视频）
  - name: Video / Jimeng
    description: 即梦（Jimeng）视频生成
  - name: Audio
    description: 语音转文字 / 语音翻译 / 文字转语音
  - name: Embeddings
    description: 文本向量嵌入
  - name: Rerank
    description: 文档相关性重排序
  - name: Moderations
    description: 内容安全审核
  - name: Not Implemented
    description: 暂未实现的接口（保留兼容性占位）
paths:
  /v1/messages:
    post:
      tags:
        - Claude
      summary: Claude 聊天
      description: |
        Anthropic Claude Messages API 格式的请求。
        需要在请求头中包含 `anthropic-version`。
      operationId: createMessage
      parameters:
        - name: anthropic-version
          in: header
          description: Anthropic API 版本
          required: true
          example: ''
          schema:
            type: string
            example: '2023-06-01'
        - name: x-api-key
          in: header
          description: Anthropic API Key (可选，也可使用 Bearer Token)
          required: false
          example: ''
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ClaudeRequest'
            examples: {}
      responses:
        '200':
          description: 成功创建响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ClaudeResponse'
          headers: {}
      deprecated: false
      security:
        - BearerAuth: []
components:
  schemas:
    ClaudeRequest:
      type: object
      required:
        - model
        - messages
        - max_tokens
      properties:
        model:
          type: string
          example: claude-3-opus-20240229
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ClaudeMessage'
        system:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                properties: {}
        max_tokens:
          type: integer
          minimum: 1
        temperature:
          type: number
          minimum: 0
          maximum: 1
        top_p:
          type: number
        top_k:
          type: integer
        stream:
          type: boolean
        stop_sequences:
          type: array
          items:
            type: string
        tools:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              description:
                type: string
              input_schema:
                type: object
                properties: {}
        tool_choice:
          oneOf:
            - type: object
              properties:
                type:
                  type: string
                  enum:
                    - auto
                    - any
                    - tool
                name:
                  type: string
        thinking:
          type: object
          properties:
            type:
              type: string
              enum:
                - enabled
                - disabled
            budget_tokens:
              type: integer
        metadata:
          type: object
          properties:
            user_id:
              type: string
        max_tokens_to_sample:
          type: integer
          minimum: 1
          description: 最大生成 Token 数（Claude 遗留字段，等同于 max_tokens）
        prompt:
          type: string
          description: 提示词（Claude 遗留 Completions 格式）
    ClaudeResponse:
      type: object
      properties:
        id:
          type: string
        type:
          type: string
          example: message
        role:
          type: string
          example: assistant
        content:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              text:
                type: string
        model:
          type: string
        stop_reason:
          type: string
          enum:
            - end_turn
            - max_tokens
            - stop_sequence
            - tool_use
        usage:
          type: object
          properties:
            input_tokens:
              type: integer
            output_tokens:
              type: integer
            cache_creation_input_tokens:
              type: integer
            cache_read_input_tokens:
              type: integer
    ClaudeMessage:
      type: object
      required:
        - role
        - content
      properties:
        role:
          type: string
          enum:
            - user
            - assistant
        content:
          oneOf:
            - type: string
            - type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - text
                      - image
                      - tool_use
                      - tool_result
                  text:
                    type: string
                  source:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - base64
                          - url
                      media_type:
                        type: string
                      data:
                        type: string
                      url:
                        type: string
                  id:
                    type: string
                  name:
                    type: string
                  input:
                    type: object
                    properties: {}
                  tool_use_id:
                    type: string
                  content:
                    type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: |
        使用 Bearer Token 认证。
        格式: `Authorization: Bearer sk-xxxxxx`

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.