Skip to content

Commit 87c5cf2

Browse files
saphidclaude
andcommitted
fix(opencode): a configured Anthropic authToken can't block or bypass the proxy
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 762bfd8 commit 87c5cf2

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎packages/provider-opencode/src/server/OpenCodeRuntime.environment.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ describe("applyOpenCodeProxyEnvironment", () => {
1818
options: {
1919
timeout: 60_000,
2020
apiKey: "sk-ant-direct",
21+
authToken: "direct-oauth-token",
2122
headers: { Authorization: "Bearer direct", "X-Trace": "1" },
2223
},
2324
models: { "claude-x": { headers: { "x-api-key": "sk-ant-direct", "X-Tier": "a" } } },

‎packages/provider-opencode/src/server/OpenCodeRuntime.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ export function applyOpenCodeProxyEnvironment(
124124
const providers = asRecord(base.provider);
125125
const routed = (id: string) => {
126126
const provider = asRecord(providers[id]);
127-
const options = asRecord(provider.options);
127+
// A configured authToken is a direct credential, and the Anthropic SDK rejects it next to apiKey.
128+
const { authToken: _authToken, ...options } = asRecord(provider.options);
128129
return {
129130
...provider,
130131
options: {

0 commit comments

Comments
 (0)