Skip to content

[FEATURE]: Support custom HTTP body fields in provider configuration #29592

Closed as not planned

Description

@timxx

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

opencode supports adding custom HTTP headers to provider requests via provider..options.headers in the config. This is useful for API gateways, proxies, and providers that require additional authentication or routing metadata.

However, there is no equivalent mechanism for injecting custom fields into the HTTP request body.
For our internal gateway, it requires to pass extra body to make the response work correctly, currently isn't possible.

Proposed solution

Add a body option under the provider options config, parallel to the existing headers option:
// opencode.json

{
    "provider": {
        "my-provider": {
            "options": {
                "baseURL": "https://my-api.example.com/v1",
                "headers": {
                    "X-Custom-Auth": "token-123"
                },
                "body": {
                    "custom_routing": "fast",
                    "metadata": {
                        "source": "opencode"
                    }
                }
            }
        }
    }
}

Activity

  1. timxx commented on May 27, 2026

    @timxx
    Author

    I’ve created a patch that attempts to resolve this issue in commit 7a81ea0.

    Please note that I’m new to the OpenCode codebase, and the patch was generated by an automated agent. I’m not fully certain if it follows all the project conventions or is the optimal approach, but it does work for our specific use case.

  2. github-actions commented on Jul 27, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions