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

# 创建自定义 Agent

> 创建一个新的自定义 Agent，提供 Agent 的基本信息、角色介绍和适用场景等内容。创建成功后可以获得一个 Agent ID，用于后续的对话创建。

## 说明

管理账号下的自定义 Agent，所创建的 Agent 可在 [创建实时会话](/api-reference/endpoint/realtime/invoke) 中使用。

* **标识规则**：每个 Agent 拥有全局唯一 `id`，删除不可恢复
* **配置项**：提示词、工具、音色、LLM 模型均可按需组合


## OpenAPI

````yaml POST /v1/agent
openapi: 3.1.0
info:
  title: SenseAudio Open Platform API
  description: >-
    SenseAudio 开放平台
    API，覆盖语音合成、语音识别、音色能力、音乐生成、图片生成、视频生成、智能体与大语言模型等能力。未显式说明的字段为依据素材文档推断。
  version: 1.0.0
servers:
  - url: https://api.senseaudio.cn
    description: 生产环境
security:
  - bearerAuth: []
paths:
  /v1/agent:
    post:
      tags:
        - Agents
      summary: 创建自定义 Agent
      description: >-
        创建一个新的自定义 Agent，提供 Agent 的基本信息、角色介绍和适用场景等内容。创建成功后可以获得一个 Agent
        ID，用于后续的对话创建。
      operationId: createCustomAgent
      parameters:
        - name: Content-Type
          in: header
          required: true
          description: 内容类型。固定为 application/json
          schema:
            type: string
            default: application/json
            example: application/json
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomAgentCreateRequest'
            example:
              title: 小助理
              prompt: 你是一名专业的小助理
              llm_model: senseaudio-vl-lite-1.0-260319
              op_statement: 您好，我是小助理
              voice_id: male_0004_a
              speech_model: senseaudio-tts-1.0
      responses:
        '200':
          description: 成功响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomAgentCreateResponse'
              example:
                id: 69b6ac2100000d8dbf84289c
        '400':
          description: 参数错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: invalid
        '401':
          description: 鉴权失败
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFilled:
                  summary: 未填写API KEY
                  value:
                    code: authentication_error
                    message: invalid authorization
                apiKeyFailed:
                  summary: API KEY 错误
                  value:
                    code: authentication_error
                    message: incorrect API key provided
        '500':
          description: 服务器内部错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: internal
                message: 服务繁忙，请稍后再试
                ref_code: 500000
      security:
        - bearerAuth: []
components:
  schemas:
    CustomAgentCreateRequest:
      type: object
      properties:
        title:
          type: string
          description: Agent 标题
          example: 小助理
        prompt:
          type: string
          description: Agent 提示词
          example: 你是一名专业的小助理
        llm_model:
          type: string
          description: Agent llm 模型标识
          example: doubao-seed-2-0-pro-260215
        op_statement:
          type: string
          description: Agent 开场白
          example: 您好，我是小助理
        voice_id:
          type: string
          description: 音色 ID，参考 [音色目录与权限](/guides/voice/catalog)
          example: male_0004_a
        speech_model:
          type: string
          description: 语音合成模型
          example: senseaudio-tts-1.0
      required:
        - title
        - prompt
        - llm_model
        - op_statement
        - voice_id
        - speech_model
    CustomAgentCreateResponse:
      type: object
      properties:
        id:
          type: string
          description: Agent ID
          example: 69b6ac2100000d8dbf84289c
      required:
        - id
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API_KEY
      description: 格式：`Bearer <API_KEY>`

````