ai-sdk-provider icon indicating copy to clipboard operation
ai-sdk-provider copied to clipboard

Anthropic Beta Headers

Open ZakAtlas opened this issue 5 months ago • 4 comments

Issue: OpenRouter headers are not being passed down to downstream providers.

Anthropic has beta features that require a specific header/value to turn on. If I were to use the anthropic provider, pass the headers, the feature is on as I would expect. Unfortunately, if I were to switch to using the openrouter provider, it doesn't. I'm assuming the header is only passed to the open router server, and it's not being forwarded to the downstream provider.

Also, I understand that only certain downstream providers respect the beta header (Anthropic & Bedrock iirc). I tried specifying anthropic specifically, and still no luck.

What works:

createAnthropic({
    apiKey: env.anthropicApiKey,
    headers: {
      'anthropic-beta':
        'output-128k-2025-02-19,interleaved-thinking-2025-05-14',
    },
  })

What doesn't:

createOpenRouter({
    apiKey: env.openrouterKey,
    headers: {
      'anthropic-beta':
        'output-128k-2025-02-19,interleaved-thinking-2025-05-14',
    },
  })

ZakAtlas avatar Jul 17 '25 18:07 ZakAtlas

+1, seems like is OpenRouter that is not passing the headers at all.

cacoos avatar Jul 25 '25 01:07 cacoos

This would be fantastic to also support Fine grained tool call streaming through OpenRouter

niekert avatar Aug 06 '25 11:08 niekert

any updates on this, I would like the support for Fine grained tool call streaming

pankiljoshi avatar Aug 30 '25 22:08 pankiljoshi

I do would also really like fine grained tool call streaming. I might just switch to anthropic provider over it

demattosanthony avatar Oct 03 '25 21:10 demattosanthony

This is definitely required asap to align with latest anthropic suggestions around tools!

rcalv002 avatar Dec 06 '25 17:12 rcalv002