Skip to main content
Early access. Server-side tool execution is available as a rate limited preview for playground usage (25 RPM across all models). For scaled evaluations or high-volume production integration, contact Baseten support or use the support chat in the Baseten app.
Use this reference to select tools that Baseten executes server-side, configure the execution loop, and parse protocol-specific responses. Server-side tool execution works with Messages, Responses, and ChatCompletions. See Web search for runnable requests and outputs.

Request fields

x-baseten-server-tools

Include this header on every request that uses server-side tool execution:
The header routes the request through the server-side tool execution loop. Without it, the model endpoint rejects the baseten__* selector as an unknown tool type.

tools

Select a tool for Baseten to execute server-side with an object that contains its type:
Selectors use baseten__<provider>__<tool> in the request’s tools array. Extra fields on a selector return 400.

Tool catalog

Search tools discover pages. Fetch tools retrieve content from known URLs. Give the model both when it should discover sources and then read selected pages. The advanced Exa search schema adds domain filters, subpage crawling, and a summary option to the basic search.
Server-side tools run on third-party search providers. By adding their tools, you agree to their respective terms: Exa, Keenable, Parallel, You.com.
The provider’s tool schema defines the arguments, and the model supplies their values.

Request configuration

Set request-level loop limits under baseten.tool_settings:
On Responses, the native max_tool_calls field sets a whole-request budget of server-side tool calls. When the loop spends the budget, Baseten steers the model to answer from the results it already has. Messages and ChatCompletions have no equivalent field.
Most requests can omit tool_choice and let the model decide whether to use a tool. Set it when the first model iteration must call a tool, call a particular tool, or avoid tools.tool_choice applies only to the first model iteration. Later iterations use automatic selection so the model can stop calling tools and answer.
Changing tool_choice between requests invalidates the KV cache. In a multi-turn conversation, keep tool_choice stable, or change it infrequently.
If a request includes both server-side and application-side tool execution, the require any tool forms allow the model to choose either type. Name the server-side tool when the first iteration must search.

Response shapes

Each protocol returns the final answer through its normal response field and represents completed server-side calls differently. A turn that ends on an open application call reports the protocol’s tool-calling stop condition. Messages reports stop_reason: "tool_use", Responses has no stop field and carries the open call as a function_call item in output, and ChatCompletions reports finish_reason: "tool_calls". Messages uses generic tool_use and tool_result blocks for tools that Baseten executes server-side. These blocks round-trip through Baseten’s Messages endpoint, but Anthropic’s API does not accept tool_result inside an assistant message. The top-level usage is the billed total across all model iterations, and usage.input_tokens excludes cache reads. ChatCompletions concatenates the text of every iteration into choices[0].message.content. A preamble such as “I will search now” arrives attached to the answer with no separator. Read baseten.iterations[].continuation_messages for the separated transcript. Responses uses completed mcp_call items for tools that Baseten executes server-side. server_label identifies the provider. Application tools remain standard function_call items.

baseten response metadata

The optional baseten object describes work across model iterations. Read it to display ChatCompletions tool execution progress, retain ChatCompletions search history, inspect per-iteration usage, or distinguish an iteration limit from a model token limit. A client that only displays the final answer can ignore it. The object has two scopes. iterations[] holds one entry per internal model call. request holds fields that describe the whole HTTP request.
Extension example (ChatCompletions, buffered)
The billing fields billable, sku, and quantity are provisional during early access. Their names and semantics can change without notice. sku can be null, and the meaning of quantity varies by provider. Baseten may add fields to this object. Ignore fields that your client does not use.

Streaming metadata

Server-side tool execution supports buffered and streaming requests. The baseten object appears in these locations: Streaming iteration entries are partial. Merge iterations by index and ChatCompletions server-side calls by id. Append each continuation_messages array once, in arrival order. ChatCompletions metadata chunks have choices: []. Check for an empty array before reading choices[0] in a hand-written streaming client.

Iteration limit

If the model continues to call server-side tools at the iteration limit, Baseten returns a resumable response with max_react_iterations_reached: The transcript ends with a completed server-side call and result. Send it back without a new user message to resume from that point, or retry the original request with a larger max_react_iterations value. In ChatCompletions, finish_reason: "length" without baseten.request.termination_reason means the model reached max_tokens. OpenAI SDK helpers can raise LengthFinishReasonError in either case. The completion remains available as error.completion.

Observability

  • On enabled workspaces, a Model API page’s Metrics tab graphs server-side tool calls: throughput, throughput per tool, errors by error code, and call latency.
  • Billed tool calls appear in workspace settings under Billing → Usage, in the Tool calls view, grouped by provider.
  • Per-request detail is in the baseten response metadata: per-iteration usage, call outcomes, and request.termination_reason.
  • The metrics export endpoint does not include server-side tool series. The usage and costs REST APIs report token counts only, with no tool-call dimension.
  • A failure after a streaming response starts arrives as an SSE error event, because the HTTP status is already 200. Streaming clients must handle that event.

Limits and errors

Server-side tool execution implements a subset of each protocol. A request that uses a refused feature returns 400 instead of silently degrading. Two output deviations from the stock protocols:
  • Messages represents server-side calls as generic tool_use and tool_result blocks, not Anthropic’s server_tool_use and web_search_tool_result types. Thinking blocks carry signature: "erased". Echo these blocks back to Baseten only, not to Anthropic’s API.
  • Responses does not echo request parameters on the response envelope. Fields such as temperature, tools, and store are null on the response.
A provider failure usually becomes a tool result that the model can inspect. The model can retry, change its query, choose another offered tool, or answer without that result. Errors that prevent the loop from starting return a non-2xx response. For general inference error guidance, see Inference errors. Use a client read timeout longer than 285 seconds for buffered requests. Streaming responses send a : keep-alive comment line every 15 seconds while a server-side call runs.