Given a prompt, the model will return the completion of one or more predictions and can also return the probability of alternative markers for each position. The prompts and parameter creation provided have been completed Provide your bearer token in the Authorization header when making requests to protected resources. Example: Authorization: Bearer ********************
Request
Header Params
Content-Type
string
required
Example:
application/json
Accept
string
required
Example:
application/json
Authorization
string
required
Provide your bearer token in the Authorization header when making requests to protected resources. Example: Authorization: Bearer ********************
Example:
Bearer {{YOUR_API_KEY}}
Body Params application/json
model
string
required
The ID of the model to be used. For detailed information on which models can be used with chat APIs, please refer to the Model Endpoint Compatibility Table.
messages
array [object {2}]
required
The list of messages included in the conversation so far. Python code example.
role
string
optional
example: "user"、“assistant”
content
string
optional
The prompt that you input
stream
boolean
optional
If set to false by default, partial message increments will be sent as in ChatGPT. Tags will be sent in the form of data only server events, which will be available when available and in the data: [DONE] Message termination flow. Python code example.
{"id":"chatcmpl-123","object":"chat.completion","created":1677652288,"model":"gpt-4o-mini","choices":[{"index":0,"message":{"role":"assistant","content":"\n\nHello there, how may I assist you today?"},"finish_reason":"stop"}],"usage":{"prompt_tokens":9,"completion_tokens":12,"total_tokens":21}}