|
6 | 6 | // This module exports patch functions and data that the upstream provider.ts |
7 | 7 | // calls at well-defined injection points (each marked with kilocode_change). |
8 | 8 |
|
9 | | -import { DEFAULT_HEADERS, OPENCODE_SERVER, OPENCODE_USER_AGENT } from "@/kilocode/const" |
| 9 | +import { DEFAULT_HEADERS, OPENCODE_SERVER } from "@/kilocode/const" |
10 | 10 | import { optionalOmitUndefined } from "@opencode-ai/core/schema" |
11 | 11 | import { normalizeServerUrl } from "@/account/url" // kilocode_change - use the v2 account token for OpenCode |
12 | 12 | import { Account } from "@/account/account" // kilocode_change - use the v2 account token for OpenCode |
@@ -187,9 +187,10 @@ export function LegionCustomLoaders(dep: CustomDep): Record<string, CustomLoader |
187 | 187 | } |
188 | 188 | }), |
189 | 189 |
|
190 | | - // OpenCode Zen. Two differences from the upstream loader: |
191 | | - // - account auth comes from the v2 account service instead of a pasted key |
192 | | - // - requests must identify as the opencode CLI to reach the free tier |
| 190 | + // OpenCode Zen. One difference from the upstream loader: account auth comes |
| 191 | + // from the v2 account service instead of a pasted key. OpenCode's free tier |
| 192 | + // is reserved for their own clients and is rejected here with a FreeTierError, |
| 193 | + // so signing in only unlocks the paid models. |
193 | 194 | opencode: Effect.fnUntraced(function* (input: any) { |
194 | 195 | const env = yield* dep.env() |
195 | 196 | const hasKey = iife(() => { |
@@ -234,7 +235,6 @@ export function LegionCustomLoaders(dep: CustomDep): Record<string, CustomLoader |
234 | 235 | // Upstream resolves env/auth/config credentials itself, so only supply |
235 | 236 | // a key when we have to: the account token first, public access last. |
236 | 237 | ...(explicit ? {} : accountToken ? { apiKey: accountToken } : { apiKey: "public" }), |
237 | | - headers: { "User-Agent": OPENCODE_USER_AGENT }, |
238 | 238 | }, |
239 | 239 | } |
240 | 240 | }), |
|
0 commit comments