The OpenAI Chat Completions API
(/v1/chat/completions) is the industry-standard payload structure for LLMs. It uses a stateless JSON payload containing a target model and an array of message objects. [1
, 2
, 3
, 4
, 5
]
{
"model": "glm-5.2",
"messages": [
{ "role": "system", "content": "You are a helpful coding assistant." },
{ "role": "user", "content": "Write a python function to fetch weather." }
],
"temperature": 0.2
}
- Roles: Divided strictly into
system(behavioral instructions),user(human prompt), andassistant(model’s response). - Tool/Function Calling: Tools are passed as an array of JSON schemas under a top-level
"tools"parameter. The model responds with a role of"assistant"and a"tool_calls"array rather than a text string. [1 , 2 , 3 , 4 , 5 ]
Deep Dive Resources
- Official Documentation: Look at the comprehensive OpenAI API Reference Guide for the exact payload schemas and parameter tables.
- Parameter Blueprint: For a raw, concrete look at all valid attributes, review the OpenAI Chat Completions API Reference Community Guide which aggregates the complete schema parameters. [1 , 2 , 3 ]
Alternative Industry Formats
As the AI ecosystem has matured, alternative formats have emerged to handle complex agent behaviors: [1 ]
- Anthropic Messages API (
/v1/messages)
Built natively for Claude models. [1 ]
- Key Differences: System prompts are isolated as a standalone top-level parameter (
"system": "...") rather than an item inside the"messages"array. - Blocks: Instead of raw text strings, content is often bundled as arrays of structured text or image “blocks”. It natively includes special parameters like
thinkingblocks for extended reasoning budgets and native metadata for prompt caching. [1 , 2 ]
- OpenAI Responses API (
/responses)
OpenAI’s stateful, agent-oriented framework meant to succeed basic Chat Completions. [1 , 2 ]
- Key Differences: Instead of passing the whole conversation history back and forth statelessly, it manages interaction state natively. It handles tools like web search or file analysis internally, tracks reasoning metrics via an explicit
reasoning_effortparameter, and renames token limits tomax_output_tokens. [1 , 2 , 3 , 4 ]
- OpenAI Harmony Response Format [1 ]
An internal tokenizer-level formatting layout (<|start|>, <|message|>, <|end|>). It explicitly splits chain-of-thought routing, tool routing (<|call|>), and text generation loops directly within the context window before it reaches your developer-facing JSON. [1
]