GPT-5.4 Chat

The fourth generation of GPT-5, with enhanced general-purpose reasoning and multimodal capabilities

POST/v1/chat/completions
  • Compatible with the OpenAI Chat Completions API format
  • Specify the gpt-5.4 model through the model parameter
  • Supports streaming output (SSE)
  • Supports multi-turn conversations, system prompts, and visual input

Authorizations

AuthorizationstringRequired

All endpoints require authentication using a Bearer Token

Get an API Key: Visit the API Key Management Page to obtain your API Key

Add the following to the request headers:

Authorization: Bearer YOUR_API_KEY

Body

modelstringRequiredDefault gpt-5.4

Model name

Example: "gpt-5.4"

messagesobject[]Required

List of conversation messages arranged in chronological order

Show messages[n]Hide messages[n]
rolestringRequired

Message role. Available values: system, user, and assistant

contentstringRequired

Message content, provided as a string or an array of content blocks (images supported)

streambooleanDefault false

Whether to enable streaming output (Server-Sent Events)

  • true: Stream the response token by token
  • false: Wait for the complete response and return it all at once
max_tokensinteger

Maximum number of tokens to generate

If not specified, the model's default limit is used

temperaturenumberDefault 1

Sampling temperature that controls output randomness

  • Range: 0 ~ 2
  • Lower values produce more consistent output, while higher values produce more random output
top_pnumberDefault 1

Probability threshold for nucleus sampling

Range: 0 ~ 1. It is recommended not to modify both temperature and top_p at the same time

stopstring | string[]

Stop sequences. Generation stops when any specified string is encountered

Up to 4 stop sequences are supported

Response

idstring

Unique identifier for this request

objectstring

Object type, always chat.completion

createdinteger

Request creation time (Unix timestamp)

modelstring

Name of the model actually used

choicesobject[]

List of generated results

  • choices[].message.role: Message role, always assistant
  • choices[].message.content: Generated text content
  • choices[].finish_reason: Completion reason: stop / length / content_filter
  • choices[].index: Result index
usageobject

Token usage statistics for this request

  • usage.prompt_tokens: Number of input tokens
  • usage.completion_tokens: Number of output tokens
  • usage.total_tokens: Total number of tokens

Response Examples

{  "id": "chatcmpl-abc123",  "object": "chat.completion",  "created": 1703884800,  "model": "gpt-5.4",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "Hello! I'm GPT-5.4, the latest version of OpenAI's fifth-generation flagship model. I offer enhanced capabilities in reasoning, code generation, multimodal understanding, and more. How can I help you?"      },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 15,    "completion_tokens": 45,    "total_tokens": 60  }}
{  "error": {    "code": "invalid_request_error",    "message": "The 'messages' field is required.",    "param": "messages",    "type": "invalid_request_error"  }}
{  "error": {    "code": "unauthorized",    "message": "Invalid API key",    "type": "authentication_error"  }}