# 图像识别 glm-4v-flash

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /v1/chat/completions:
    post:
      summary: 图像识别 glm-4v-flash
      deprecated: false
      description: |+
        **冰橙API提供与OPENAI官方的API兼容的接口方式，方便国内开发者进行与OPENAI的CHATGPT的接口对接服务**



        :::highlight purple 📌
        本接口相当于让Ai有了人类的眼睛，可以看到画面并理解画面。
        通过识别提交的远程图片网址,进行识别图片内容，然后可以依据图片内容进行提问或文字创作（后续还可使用TTS音频接口，产生例如解说等实例的运用）。
        例：可询问图像是否包含某文字/图片内容校正/行为预测/故事创作等
        :::



        ### token获取方式：
        访问公众号《冰橙云》进入菜单冰橙AI助手后，访问右上角 / 个人（首次访问免费赠送15000字符，可通过充值增加字符数）可查看 token
        访问：https://yewu.bcwhkj.cn 》 个人 》Token令牌 获取（首次访问赠送15000字符）


      tags:
        - 文生文 对话生成
      parameters:
        - name: Content-Type
          in: header
          description: 固定值
          required: false
          example: application/json
          schema:
            type: string
        - name: Authorization
          in: header
          description: token要更换为个人自己的TOKEN
          example: Bearer token
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                model:
                  type: string
                  description: 固定值
                  const: gpt-4-vision-preview
                messages:
                  type: array
                  items:
                    type: object
                    properties:
                      role:
                        type: string
                      content:
                        type: array
                        items:
                          type: object
                          properties:
                            type:
                              type: string
                            text:
                              type: string
                            image_url:
                              type: object
                              properties:
                                url:
                                  type: string
                              required:
                                - url
                              x-apifox-orders:
                                - url
                          required:
                            - type
                          x-apifox-orders:
                            - type
                            - text
                            - image_url
                    x-apifox-orders:
                      - role
                      - content
                max_tokens:
                  type: integer
              required:
                - model
                - messages
                - max_tokens
              x-apifox-orders:
                - model
                - messages
                - max_tokens
            example:
              model: glm-4v-flash
              messages:
                - role: user
                  content:
                    - type: text
                      text: 这是什么图片?
                    - type: image_url
                      image_url:
                        url: >-
                          https://vkceyugu.cdn.bspapp.com/VKCEYUGU-908027cd-0849-4303-ae20-d3bed9830e3a/25eaeef6-ccce-4b08-9caa-de04ecef681a.png
              max_tokens: 300
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  object:
                    type: string
                  created:
                    type: integer
                  model:
                    type: string
                  usage:
                    type: object
                    properties:
                      prompt_tokens:
                        type: integer
                      completion_tokens:
                        type: integer
                      total_tokens:
                        type: integer
                    required:
                      - prompt_tokens
                      - completion_tokens
                      - total_tokens
                    x-apifox-orders:
                      - prompt_tokens
                      - completion_tokens
                      - total_tokens
                  choices:
                    type: array
                    items:
                      type: object
                      properties:
                        message:
                          type: object
                          properties:
                            role:
                              type: string
                            content:
                              type: string
                          required:
                            - role
                            - content
                          x-apifox-orders:
                            - role
                            - content
                        finish_details:
                          type: object
                          properties:
                            type:
                              type: string
                            stop:
                              type: string
                          required:
                            - type
                            - stop
                          x-apifox-orders:
                            - type
                            - stop
                        index:
                          type: integer
                      x-apifox-orders:
                        - message
                        - finish_details
                        - index
                required:
                  - id
                  - object
                  - created
                  - model
                  - usage
                  - choices
                x-apifox-orders:
                  - id
                  - object
                  - created
                  - model
                  - usage
                  - choices
              examples:
                '1':
                  summary: 成功示例
                  value:
                    choices:
                      - finish_reason: stop
                        index: 0
                        message:
                          content: >-
                            这是一个橙子的图案，橙色部分代表果肉，绿色部分是叶子，白色线条可能是用来表示光线照射在橙子上。这个图标可能用于与水果、健康饮食或农业相关的应用程序或网站中。
                          role: assistant
                    created: 1745813877
                    id: 202504281217566c4aa5d82259466e
                    model: GLM-4V-Flash
                    request_id: 202504281217566c4aa5d82259466e
                    usage:
                      completion_tokens: 45
                      prompt_tokens: 100
                      total_tokens: 145
                '2':
                  summary: 密钥错误
                  value:
                    codes: 900
                    mess: 密钥错误或已过期，请通过微信访问yewu.bcwhkj.cn个人中心获取
                    data: token
                '3':
                  summary: 提交内容不合规
                  value:
                    error:
                      code: content_policy_violation
                      message: >-
                        Your request was rejected as a result of our safety
                        system. 
                      param: null
                      type: invalid_request_error
                '4':
                  summary: 额度不足
                  value:
                    codes: 300
                    mess: 当前额度不足，请充值后继续使用
                    data: ''
          headers: {}
          x-apifox-name: 成功
      security: []
      x-apifox-folder: 文生文 对话生成
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/3216478/apis/api-125230845-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://yewu.bcwhkj.cn
    description: 正式环境
security: []

```
