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

# 创建智能体

<Note>
  注：训练模型设置参考[系统支持模型列表](https://geekai.co/models)
</Note>

响应数据格式和 OpenAI 完全兼容，根据是否是流式响应而变化，可以参考下面的请求示例进行判断：

### cURL 请求示例

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/agent/create' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--form 'name="测试智能体100"' \
--form 'desc="测试智能体机器人"' \
--form 'logo=@"/E:/图片/geekai/geekai-icon-tr-g.png"' \
--form 'model="gpt"' \
--form 'interneted="1"'
```

### Postman 请求响应示例

<img src="https://static.geekai.co/storage/2024/07/14/image-20240420015117027.png" className="mt-2" alt="创建智能体" />


## OpenAPI

````yaml openapi.yaml POST /agent/create
openapi: 3.1.0
info:
  title: GeekAI API Docs
  description: >-
    GeekAI API Specification Document Provides AI capabilities such as chat,
    image generation, speech processing, video generation, ai agents and file
    extract.
  version: 1.0.0
servers:
  - url: https://geekai.dev/api/v1
    description: base URL
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /agent/create:
    post:
      tags:
        - Agent
      summary: Create Agent
      description: Create a new AI agent
      operationId: createAgent
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - name
                - desc
              properties:
                name:
                  type: string
                  description: agent name
                  example: Test Agent
                logo:
                  type: string
                  format: binary
                  description: agent logo image
                desc:
                  type: string
                  description: agent description
                  example: >-
                    A professional customer service assistant, capable of
                    answering product-related inquiries.
                model:
                  type: string
                  description: chat model
                  default: deepseek-chat
                  example: deepseek-chat
                chat_level:
                  type: integer
                  description: >-
                    chat level, default is 2，higher temperatures increase
                    creativity, while lower temperatures increase accuracy.
                  enum:
                    - 0
                    - 1
                    - 2
                    - 3
                    - 4
                  default: 2
                  example: 2
                interneted:
                  type: integer
                  description: enable internet access, 1 is yes, 0 is no
                  enum:
                    - 0
                    - 1
                  default: 0
                stream:
                  type: integer
                  description: enable stream output, 1 is yes, 0 is no
                  enum:
                    - 0
                    - 1
                  default: 1
      responses:
        '200':
          description: successful response
          content:
            application/json:
              schema:
                type: object
                required:
                  - message
                  - data
                properties:
                  message:
                    type: string
                    description: response message
                    example: agent created successfully.
                  data:
                    type: object
                    required:
                      - uuid
                      - status
                    properties:
                      uuid:
                        type: string
                        format: uuid
                        description: agent UUID
                      status:
                        type: string
                        enum:
                          - initializing
                          - ready
                        description: agent status
                      created_at:
                        type: string
                        format: date-time
                        description: creation timestamp
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '413':
          description: upload file too large
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/StandardError'
components:
  responses:
    ValidationError:
      description: validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: validation_error
              message:
                type: string
                example: validation error
              details:
                type: object
                additionalProperties:
                  type: string
                example:
                  field: error message
    Unauthorized:
      description: unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: unauthorized
              message:
                type: string
                example: invalid api key or token
    StandardError:
      description: standard error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          description: error code
          example: invalid_request
        message:
          type: string
          description: error message
          example: invalid request
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: token
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: api key

````