[PR #11978] fix(provider): apply config headers to fetch requests #14010

Closed
opened 2026-02-16 18:18:49 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11978

State: closed
Merged: No


Summary

Fixes #11789

Provider and model headers configured in opencode.jsonc were not being applied to actual API fetch requests.

Problem

In getSDK, the custom fetch function receives opts.headers from the AI SDK's init parameter, but options["headers"] (which contains the configured provider/model headers) was never merged into it.

Solution

Merge options["headers"] into opts.headers before calling fetch:

opts.headers = {
  ...(typeof opts.headers === "object" ? opts.headers : {}),
  ...options["headers"],
};

Changes

  • packages/opencode/src/provider/provider.ts: Merge config headers into fetch request headers
  • packages/opencode/test/provider/provider.test.ts: Add tests for header configuration

Testing

  • 68 tests pass
  • Typecheck passes
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11978 **State:** closed **Merged:** No --- ## Summary Fixes #11789 Provider and model headers configured in `opencode.jsonc` were not being applied to actual API fetch requests. ## Problem In `getSDK`, the custom fetch function receives `opts.headers` from the AI SDK's `init` parameter, but `options["headers"]` (which contains the configured provider/model headers) was never merged into it. ## Solution Merge `options["headers"]` into `opts.headers` before calling fetch: ```typescript opts.headers = { ...(typeof opts.headers === "object" ? opts.headers : {}), ...options["headers"], }; ``` ## Changes - `packages/opencode/src/provider/provider.ts`: Merge config headers into fetch request headers - `packages/opencode/test/provider/provider.test.ts`: Add tests for header configuration ## Testing - ✅ 68 tests pass - ✅ Typecheck passes
yindo added the pull-request label 2026-02-16 18:18:49 -05:00
yindo closed this issue 2026-02-16 18:18:50 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#14010