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