supported_parameters field in OpenRouter’s model metadata before adapting any other example.
Prerequisites
Before you get started, you need:- Any authentication required by your access method: a Poolside Platform or OpenRouter API key, or the authentication configured for your self-managed model endpoint or gateway. To configure authentication, see Authentication.
curlor another tool that can make API requests.
If API key authentication is off for your model endpoint or gateway, omit the
Authorization header.List available models
Most API requests require a modelid. For the full request and response reference, see List models.
List models
List Poolside models on OpenRouter
Response example
Read a chat response
A chat completion returns the model’s message and the tokens the request used. The response below is abbreviated for readability:Response example
reasoning_content in addition to content. The usage object reports the tokens used by the request and response. Poolside-hosted inference responses do not include logprobs or stop_reason.
To give the model information it does not have, put that context in the message content as ordinary text. For guidance on what to include, see the Prompting guide.
Control generation
Poolside-hosted inference supports these generation parameters:
Include only the values you want to override:
Set generation parameters
Turn off thinking
Poolside-hosted inference enables thinking by default. To turn it off for a request, setchat_template_kwargs.enable_thinking to false:
Turn off thinking
content and sets reasoning_content to null.
Preserve reasoning in agentic workflows
For agentic workflows with Poolside models, preserve
reasoning_content from assistant responses when you include those responses in follow-up requests. Dropping previous reasoning content can prevent the model from reasoning in later steps. For examples, see the Control reasoning sections on the Laguna model pages.Stream responses
To receive the response as a series of chunks returned as server-sent events, setstream to true. This is useful for real-time applications. Poolside-hosted inference includes a running token usage total on every chunk and the completed total on the final chunk. Setting stream_options.include_usage to false does not suppress these totals:
Stream chat prompt
delta object. When a model produces reasoning, the stream returns reasoning_content before content. The stream ends with a chunk that has an empty choices array and the completed usage object. Chunks below are abbreviated for readability; each also includes created and model:
Response example
Extend models with tools
You can extend a model’s capabilities by providing tools that it can call during a conversation. This lets the model retrieve real-time data, run calculations, or interact with external systems. Poolside-hosted inference allows parallel tool calls by default. Setparallel_tool_calls to false when you want the model to call at most one tool in a response.
Tool calling takes two requests. First, include a tools array and define the functions the model can call:
Define a tool
tool_calls array and a finish_reason of tool_calls. The arguments value is a JSON string:
Response example
tool_calls, and a tool message whose tool_call_id matches.
Copy the assistant message from the previous response rather than rebuilding it, so that reasoning_content travels with it when the model returned it. The assistant message below is abbreviated for readability:
Send a tool result
Control reasoning through OpenRouter
OpenRouter uses its ownreasoning object rather than chat_template_kwargs. To control reasoning effort for OpenRouter-compatible models, include a reasoning object:
max, xhigh, high, medium, low, minimal, and none, but provider and model support varies. Replace <model-id> and max with values that your selected model supports. To check which parameters a model accepts, see the supported_parameters field in OpenRouter’s model metadata.
The
reasoning field is OpenRouter-style: a top-level object, which differs from the OpenAI Chat Completions reasoning_effort parameter. Use it only with OpenRouter or another provider that accepts this field. A direct connection to the OpenAI Chat Completions API at https://api.openai.com/v1/chat/completions rejects the reasoning field.Effort-level support varies by provider and model. Some providers ignore effort settings or apply thinking automatically. Check your provider’s documentation for how it handles the reasoning field.