POST /v1/chat/completions
Method: POSTEndpoint: /v1/chat/completions
This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API. This section contains endpoint-specific behavior, parameters, or usage notes for this API. For moderation, the official review covers at least three stages or directions:
- Whether the submitted image contains a real person, or something too close to a real person.
- Whether the prompt violates policy, such as violence, sexual content, copyright issues, or living celebrities.
- Whether the generated result passes review. This is also why generation can fail after reaching more than 90% progress.
Request Parameters
Header Parameters
Content-Type
string
Required
Example:
application/json
Accept
string
Required
Example:
application/json
Authorization
string
Optional
Default Value:
Bearer {{YOUR_API_KEY}}Body Parameters application/json
model
string
Required
messages
array
[object]
Required
in
the chat format
to generate a chat completion message.
role
string
Optional
content
string
Optional
stream
boolean
Optional
If set, partial message deltas are streamed just like in ChatGPT. Tokens are sent as data-only
server-sent events
data: [DONE]
events as they become available, and the stream is terminated by a final message.
For sample code
, see the OpenAI Cookbook.
Example
{
"model"
:
"sora_video2"
,
"stream"
:
false
,
"messages"
:
[
{
"role"
:
"user"
,
"content"
:
[
{
"type"
:
"text"
,
"text"
:
// provider-specific example normalized for English documentation
}
,
{
"type"
:
"image_url"
,
"image_url"
:
{
"url"
:
"https://github.com/dianping/cat/raw/master/cat-home/src/main/webapp/images/logo/cat_logo03.png"
}
}
]
}
]
}Example Request
Shell
curl --location --request POST '/v1/chat/completions' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "sora_video2",
"stream": false,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
// provider-specific example normalized for English documentation
},
{
"type": "image_url",
"image_url": {
"url": "https://github.com/dianping/cat/raw/master/cat-home/src/main/webapp/images/logo/cat_logo03.png"
}
}
]
}
]
}'Response
🟢 200 OK
Content Type: application/json
Response Schema
id
string
Required
object
string
Required
created
integer
Required
choices
array
[object]
Required
index
integer
Optional
message
object
Optional
finish_reason
string
Optional
usage
object
Required
prompt_tokens
integer
Required
completion_tokens
integer
Required
total_tokens
integer
RequiredExample
{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "✅ Video GenerationSuccess,[click here](https:// provider-specific note
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
}
}