Endpoint
POST /v1/chat/completions
Headers
Content-Type: 必填 示例:application/jsonAuthorization: 必填 示例:Bearer $API_KEY
Request example
{
"model": "gpt-4o",
"messages": [
{
"role": "developer",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
]
}
Responses
200: 成功
OpenAPI specification
openapi: 3.0.1
info:
title: ''
description: ''
version: 1.0.0
paths:
/v1/chat/completions:
post:
summary: chat-message
deprecated: false
description: 官方文档地址:https://platform.openai.com/docs/api-reference/chat/create
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: string
required:
- role
- content
required:
- model
- messages
example:
model: gpt-4o
messages:
- role: developer
content: You are a helpful assistant.
- role: user
content: Hello!
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-282435670-run
components:
schemas: {}
securitySchemes: {}
servers: []
security: []
