Endpoint
POST /v1/chat/completions
Headers
Content-Type: 必填 示例:application/jsonAuthorization: 必填 示例:Bearer $API_KEY
Request example
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is in this image?"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
}
}
]
}
],
"max_tokens": 300
}
Responses
200: 成功
OpenAPI specification
openapi: 3.0.1
info:
title: ''
description: ''
version: 1.0.0
paths:
/v1/chat/completions:
post:
summary: chat-image
deprecated: false
description: ''
tags:
- 模型调用/会话(chat)
parameters:
- name: Content-Type
in: header
description: ''
required: true
example: application/json
schema:
type: string
- name: Authorization
in: header
description: ''
required: true
example: Bearer $API_KEY
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
properties:
model:
type: string
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
required:
- type
max_tokens:
type: integer
required:
- model
- messages
- max_tokens
example:
model: gpt-4o
messages:
- role: user
content:
- type: text
text: What is in this image?
- type: image_url
image_url:
url: >-
https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg
max_tokens: 300
responses:
'200':
description: ''
content:
application/json:
schema:
type: object
properties: {}
headers: {}
x-apifox-name: 成功
security: []
x-apifox-folder: 模型调用/会话(chat)
x-apifox-status: released
x-run-in-apifox: https://app.apifox.com/web/project/5443699/apis/api-282438731-run
components:
schemas: {}
securitySchemes: {}
servers: []
security: []
