[FEATURE]: Allow custom model headers #2309

Closed
opened 2026-02-16 17:35:04 -05:00 by yindo · 1 comment
Owner

Originally created by @istarkov on GitHub (Oct 28, 2025).

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

https://github.com/sst/opencode/blob/3c56dbcf5840e540eb8970805a6c725cce8e4f85/packages/opencode/src/session/prompt.ts#L271-L277

Im using anthropic models like sonnet 3.7
And there are beta headers flags which I use in my workflows

"anthropic-beta": "fine-grained-tool-streaming-2025-05-14,token-efficient-tools-2025-02-19",

fine-grained-tool-streaming-2025-05-14 - affects tools streaming (Some tools I use has really huge input (like think tool, where I'm asking the model to call tool with generated input) and would be interesting to see this streaming on the fly

token-efficient-tools-2025-02-19 for some reason allows parallel tools calls for sonnet 3.7

Pretty sure other provider/models with various flags exists.

I would like to define such headers in opencode.jsonc like

{
  "model": "...",
  "headers": {
    "openrouter/anthropic/*": {
      "anthropic-beta": "fine-grained-tool-streaming-2025-05-14,token-efficient-tools-2025-02-19"
    }
  }
}
Originally created by @istarkov on GitHub (Oct 28, 2025). ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request https://github.com/sst/opencode/blob/3c56dbcf5840e540eb8970805a6c725cce8e4f85/packages/opencode/src/session/prompt.ts#L271-L277 Im using anthropic models like sonnet 3.7 And there are beta headers flags which I use in my workflows ``` "anthropic-beta": "fine-grained-tool-streaming-2025-05-14,token-efficient-tools-2025-02-19", ``` `fine-grained-tool-streaming-2025-05-14` - affects tools streaming (Some tools I use has really huge input (like think tool, where I'm asking the model to call tool with generated input) and would be interesting to see this streaming on the fly `token-efficient-tools-2025-02-19` for some reason allows parallel tools calls for sonnet 3.7 Pretty sure other provider/models with various flags exists. I would like to define such headers in `opencode.jsonc` like ```jsonc { "model": "...", "headers": { "openrouter/anthropic/*": { "anthropic-beta": "fine-grained-tool-streaming-2025-05-14,token-efficient-tools-2025-02-19" } } } ```
yindo added the help-wanteddiscussiongood first issue labels 2026-02-16 17:35:04 -05:00
yindo closed this issue 2026-02-16 17:35:04 -05:00
Author
Owner

@rekram1-node commented on GitHub (Oct 28, 2025):

itd probably make more sense under model definition, but yeah we can add this, something like allowing u to do this:

{
 "provider": {
    "anthropic": {
      "models": {
        "claude-sonnet-4": {
          "headers": {
            // string : string pairs
          }
        }
      }
    }
  }
}

but for whatever provider

@rekram1-node commented on GitHub (Oct 28, 2025): itd probably make more sense under model definition, but yeah we can add this, something like allowing u to do this: ``` { "provider": { "anthropic": { "models": { "claude-sonnet-4": { "headers": { // string : string pairs } } } } } } ``` but for whatever provider
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2309