Skip to content

[FEATURE]: Allow custom model headers #3499

@istarkov

Description

@istarkov

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"
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionUsed for feature requests, proposals, ideas, etc. Open discussiongood first issueGood for newcomershelp-wanted

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions