Request fields
Other OpenAI parameters (
temperature, top_p, response_format, …) are passed through where the model supports them. Start with a minimal request and add parameters one at a time.
Example
Response
Models may add their own fields. Read the ones you need and do not depend on field order.
finish_reason
Streaming
Set"stream": true. The answer arrives as server-sent events; join the delta.content of each chunk and skip chunks without text.
-N to turn off output buffering. Use streaming for long answers: a non-streaming request that runs longer than about 5 minutes can time out with 504.
Tool calls
- Send
toolswith the request:
-
The model answers with
finish_reason: "tool_calls"and atool_callslist.function.argumentsis a JSON string; parse it before calling your function. -
Append the assistant message and one
role: "tool"message per call, with the matchingtool_call_id, then send the request again with the sametools:
Conversations
The API does not remember earlier requests. Send the history you want the model to see inmessages every time; history counts as input tokens.
Anthropic format
Text models are also available on the Anthropic Messages endpoint,POST https://refillapi.com/v1/messages, for tools built on the Anthropic SDK such as Claude Code.