Summary
When using @openrouter/ai-sdk-provider with the native OpenRouter web search tool, web search appears to work, but the returned provider metadata reports OpenAI even when the requested model is Anthropic.
For example, this request uses:
model: openrouter.chat("anthropic/claude-opus-4.6")
but after the stream completes:
(await result.providerMetadata)?.openrouter?.provider
returns:
The issue is not that web search fails. The issue is that provider metadata says the provider was OpenAI for an Anthropic model request when openrouter:web_search is enabled.
Environment
@openrouter/ai-sdk-provider: 2.2.3
ai: 6.0.97
- Runtime: Bun / Node-style server runtime
- API:
streamText with openrouter.chat(...)
- Native server tool:
openrouter:web_search
Repro
import { createOpenRouter } from "@openrouter/ai-sdk-provider";
import { streamText, stepCountIs } from "ai";
const openrouter = createOpenRouter({ apiKey: process.env.OPENROUTER_API_KEY! });
const result = streamText({
model: openrouter.chat("anthropic/claude-opus-4.6"),
messages: [
{
role: "user",
content: "Use web search to find the latest OpenRouter routing docs and cite what you used.",
},
],
stopWhen: stepCountIs(1),
providerOptions: {
openrouter: {
tools: [
{
type: "openrouter:web_search",
parameters: {
engine: "auto",
max_results: 5,
max_total_results: 15,
},
},
],
tool_choice: "auto",
},
},
});
await result.consumeStream();
console.log({
provider: (await result.providerMetadata)?.openrouter?.provider,
text: await result.text,
});
Actual output
The exact text varies, but the provider metadata reports OpenAI:
{
provider: "OpenAI",
text: "Here's a comprehensive summary of the latest OpenRouter routing documentation..."
}
The generated text includes web-search-based citations, so the tool appears to be working.
Expected behavior
For a request using openrouter.chat("anthropic/claude-opus-4.6"), provider metadata should not report OpenAI unless OpenRouter intentionally routes Anthropic model requests with web search through an OpenAI-backed provider.
If that routing is intentional, it would be helpful for the provider metadata or docs to make that explicit. Otherwise, this looks like incorrect provider metadata when openrouter:web_search is enabled.
Summary
When using
@openrouter/ai-sdk-providerwith the native OpenRouter web search tool, web search appears to work, but the returned provider metadata reportsOpenAIeven when the requested model is Anthropic.For example, this request uses:
but after the stream completes:
returns:
"OpenAI"The issue is not that web search fails. The issue is that provider metadata says the provider was OpenAI for an Anthropic model request when
openrouter:web_searchis enabled.Environment
@openrouter/ai-sdk-provider:2.2.3ai:6.0.97streamTextwithopenrouter.chat(...)openrouter:web_searchRepro
Actual output
The exact text varies, but the provider metadata reports OpenAI:
The generated text includes web-search-based citations, so the tool appears to be working.
Expected behavior
For a request using
openrouter.chat("anthropic/claude-opus-4.6"), provider metadata should not reportOpenAIunless OpenRouter intentionally routes Anthropic model requests with web search through an OpenAI-backed provider.If that routing is intentional, it would be helpful for the provider metadata or docs to make that explicit. Otherwise, this looks like incorrect provider metadata when
openrouter:web_searchis enabled.