Docs menu

Docs / Guides

Chat Completions vs Responses

Which OpenAI format to use with Cent AI, how conversation state works, and how usage differs.

Last updated


Short answer

Both formats work with the same API key, the same base URL https://api.cent-ai.dev/v1 and the same prices. Pick the one your tool or SDK already speaks.

UseWhen
Chat Completions POST /v1/chat/completionsYour tool or code already uses messages. Most tools and SDKs support it
Responses POST /v1/responsesYour tool or code is built on the Responses API, with input and previous_response_id

The format does not change the price of a request. The cost depends on the model and the tokens, see Pricing.

How the two differ

TopicChat CompletionsResponses
Input fieldmessagesinput
Conversation historyYou send the whole history in messages on every turnYou send the whole history, or pass previous_response_id
Response objectchat.completion with choices[]response with output[]
Stream endFinal chunk, then data: [DONE]response.completed event
Error after a stream startedError frame, then data: [DONE]response.failed event

Every request field, including tools, reasoning and store, is passed to the model as is.

Conversation state

Cent AI does not store conversation or response state.

  • Chat Completions is stateless: each request carries the full conversation.
  • Responses: previous_response_id is passed to the model unchanged, and store is passed when the model supports it. Whether a previous response can be found depends on the model, not on Cent AI. If you need the conversation to survive on any model, send the full history in input.

Conversations in both formats keep going to the same route between turns, so the model's prompt cache can be used. You do not add a field for this. See Prompt caching.

Usage fields

Both formats add usage.cost, the amount charged in USD. The token fields have different names.

MeaningChat CompletionsResponses
Input tokensusage.prompt_tokensusage.input_tokens
Of which read from cacheusage.prompt_tokens_details.cached_tokensusage.input_tokens_details.cached_tokens
Output tokensusage.completion_tokensusage.output_tokens
Of which reasoning, when reportedusage.completion_tokens_details.reasoning_tokensusage.output_tokens_details.reasoning_tokens
Totalusage.total_tokensusage.total_tokens
Cost in USDusage.costusage.cost
"usage": {
  "prompt_tokens": 10000,
  "prompt_tokens_details": {"cached_tokens": 9000},
  "completion_tokens": 800,
  "total_tokens": 10800,
  "cost": "0.000363000"
}

Usage in a stream

FormatWhere usage appears
Chat CompletionsIn a last chunk, only when you send stream_options.include_usage: true. You are charged either way
ResponsesIn the response object of the response.completed event

Same request in both formats

curl https://api.cent-ai.dev/v1/chat/completions \
  -H "Authorization: Bearer $CENT_AI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-sol","messages":[{"role":"user","content":"Hello"}]}'

curl https://api.cent-ai.dev/v1/responses \
  -H "Authorization: Bearer $CENT_AI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6-sol","input":"Hello"}'

Anthropic tools and SDKs use a third format, Messages, on the same host.