Skip to main content
OpenAI-compatible chat endpoint for every text model. Existing OpenAI SDK code works by changing the base URL and the model ID.

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.
With cURL, add -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

  1. Send tools with the request:
  1. The model answers with finish_reason: "tool_calls" and a tool_calls list. function.arguments is a JSON string; parse it before calling your function.
  2. Append the assistant message and one role: "tool" message per call, with the matching tool_call_id, then send the request again with the same tools:

Conversations

The API does not remember earlier requests. Send the history you want the model to see in messages 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.