GPT-5.4 Codex API Integration
Use GPT-5.4 Codex through Rivya Public API v1 with model id gpt-5.4-codex-chat, supported inputs, parameters, Files API rules, credits, and response examples.
gpt-5.4-codex-chat
text, file
Not required for the minimal request
4
Chat
Chat API: non-streaming + SSE streaming
TOKEN_BASED
20000 characters
Request contract
Chat requests send one message at a time. Session history is stored by Rivya; do not send a raw messages array.
| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | gpt-5.4-codex-chat | Use the gpt-5.4-codex-chat API model id. |
| session_id | string | No | - | Optional API-created chat session id. Omit it to start a new session. |
| message | string | Yes | - | The next user message. Chat API history comes from the server-side session, not a raw messages array. |
| attachments | array | No | - | Optional image file_id values returned by Files API. External attachment URLs are not accepted. |
| enable_web_search | boolean | No | false | Only applies when the selected chat model supports web search. |
| reasoning_effort | string | No | default | Optional reasoning effort: default, minimal, low, medium, high, or xhigh when supported. |
| client_request_id | string | No | - | Optional client-side id for tracing requests in your system. |
Model parameters
This chat model uses the shared Chat API fields above. Model-specific support for web search, image file attachments, thoughts, and reasoning is reflected in the readiness data.
Minimal request
{
"model": "gpt-5.4-codex-chat",
"message": "Write a concise launch plan for a new product image campaign"
}Reference-file request
{
"model": "gpt-5.4-codex-chat",
"message": "Write a concise launch plan for a new product image campaign",
"attachments": [
{
"file_id": "file_uploaded_image_id"
}
]
}Create response
The Chat endpoint returns a completed assistant message, token usage, and the final credit settlement for this turn.
{
"id": "chatcmpl_msg_gpt_5_4_codex_chat_example",
"object": "chat.completion",
"session_id": "chat_session_gpt_5_4_codex_chat",
"model": "gpt-5.4-codex-chat",
"created_at": "2026-05-11T00:00:00.000Z",
"message": {
"id": "assistant_message_id",
"role": "assistant",
"content": "A concise launch plan with clear next steps."
},
"usage": {
"input_tokens": 1200,
"output_tokens": 320,
"total_tokens": 1520
},
"credits": {
"reserved": 4,
"final": 4
}
}Common errors
validation_failed, insufficient_credits, idempotency_conflict, rate_limited, not_found, chat_model_not_supported, chat_session_conflict, chat_attachment_not_supported
Chat API supports non-streaming and SSE streaming turns in Public API v1. Image attachments must use Files API file_id values.