Skip to content

@tanstack/ai-openrouter@0.23.0

Choose a tag to compare

@github-actions github-actions released this 19 Oct 16:17
· 227 commits to main since this release
Immutable release. Only release title and notes can be modified.
7095ebb

Minor Changes

  • #1775 85c2956 - Structured output sends response_format: { type: "json_object" } for OpenRouter and Groq models that declare a response format without strict structured outputs. These models reject strict json_schema. In JSON mode the adapter adds the schema as a system prompt. await chat({ outputSchema }) checks the reply when the schema is a Standard Schema, such as Zod. Other models keep strict json_schema.

    modelOptions can set json_object for any model. On the OpenAI-base adapters (OpenAI, Grok, Groq and others), a json_object in modelOptions was replaced by strict json_schema. It is now sent as given, with the schema in a system prompt. In JSON mode, supportsCombinedToolsAndSchema() returns false. Tools and the schema then go out in separate requests, so the tool-calling turns do not get the schema prompt.

    OpenRouter catalog ids with a :variant, such as google/gemma-4-26b-a4b-it:free, now match their own catalog entry. Before, only the id without the variant was checked.

Patch Changes

  • #1750 3170517 - Keep the provider's raw tool argument string for replay.

    • Adapters now send the raw argument string as args on TOOL_CALL_END.
    • The tool call in the history keeps that exact string when it is the same JSON value as the parsed input, so the next request sends the provider's own bytes back (for example 1.50, or an id past Number.MAX_SAFE_INTEGER). When the parsed input differs, only the changed values are written again.
    • The TOOL_CALL_END that reaches the client carries the same string in metadata.tanstack.args, so the client history matches the server history. It no longer also carries metadata.tanstack.input: in-process chat() and StreamProcessor parse input from args. Run the client and the server on the same release: an older client ignores args, so it builds the tool input from the streamed deltas only, and a tool call with no deltas (for example an Anthropic server tool) gets no input.
    • History converters for Bedrock and the Gemini Interactions API send malformed tool arguments as {} instead of failing the request.
    • Gemini Interactions: the initial step.arguments snapshot goes out as a TOOL_CALL_ARGS delta only when no argument deltas follow, so the deltas always add up to the final arguments.
    • Malformed tool arguments are no longer turned into {} by an adapter. The tool gets a "Failed to parse tool arguments as JSON" error that the model can repair. Mistral still ends the run with an error on malformed arguments, as before.
  • Updated dependencies [1d0f8f1, 1d0f8f1, 5f95dbd, 3170517, 3292bad, 3170517, 4298480, f68da51, 85c2956, 30fa651, 1d0f8f1, 3170517, 3170517]:

    • @tanstack/ai@0.70.0
    • @tanstack/ai-utils@0.5.0