Completions
Create a response
The OpenAI Responses format, on the same models and prices. It stores nothing: send the whole conversation in input every time. With "stream": true you get response.* events.
/ v1 / responsesAuthorizations
AuthorizationstringheaderrequiredBearer authentication header of the form Bearer <token>, where <token> is your API key.
Body
application/jsonmodelstringrequiredA Libremodel model ID, from Models or
GET /v1/models.inputstring | object[]requiredText, or the conversation as items: messages (with
input_text,input_imageandinput_file),function_callandfunction_call_output.instructionsstringThe system prompt.
max_output_tokensintegerCap on output tokens, reasoning included.
streambooleandefault: falseSend the answer as Server-Sent Events, as it is generated. See Streaming.
reasoningobjecteffort: how much the model thinks. See Reasoning.Show child attributesHide child attributes
effortstringThe level.
Allowed values:
"low""high""max""off"
toolsobject[]functiontools. See Tool calling.textobjectformatfor structured outputs, andverbosity.storebooleanOnly
false:trueandprevious_response_idreturn400.temperaturenumberSampling temperature.
top_pnumberNucleus sampling.
Response
The response. With stream, a text/event-stream instead.
idstringrequiredThe ID of the response.
objectstringrequiredAlways
"response".statusstringrequiredcompleted, orincompletewhen it reached the output cap.modelstringrequiredThe model you asked for.
outputobject[]requiredThe items of the answer:
reasoning,message(withoutput_text) andfunction_call.usageobjectrequiredinput_tokens,output_tokenswith their details, andcost.Show child attributesHide child attributes
costnumberrequiredWhat the request cost, in dollars.
Example:
0.0001605
The body is not valid: a required field is missing or one has the wrong type.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.
The key is missing, wrong, revoked or expired.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.
The balance does not cover the request.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.
The key is valid but cannot do this: the model is not among the ones the key allows, its spending limit is reached or the account is suspended.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.
The model ID does not exist. The valid ones come from GET /v1/models.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.
Too many requests at once. Wait for the seconds in the Retry-After header and retry.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.
Temporarily unavailable. Retry after a short wait.
errorobjectrequiredThe error.
Show child attributesHide child attributes
messagestringrequiredWhat went wrong, for a person to read.
typestringrequiredThe error family, as in the OpenAI API.
Example:
"authentication_error"codestringrequiredThe exact cause. Branch on this one. All codes: Limits and errors.
Example:
"invalid_api_key"paramnullrequiredAlways
null.