Skip to content

Commit ef9bc4e

Browse files
Krulerekram1-node
andauthored
feat(gitlab): send context-1m-2025-08-07 beta header to enable 1M context window (anomalyco#16153)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
1 parent 5838b58 commit ef9bc4e

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

packages/opencode/src/provider/provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ export namespace Provider {
480480

481481
const aiGatewayHeaders = {
482482
"User-Agent": `opencode/${Installation.VERSION} gitlab-ai-provider/${GITLAB_PROVIDER_VERSION} (${os.platform()} ${os.release()}; ${os.arch()})`,
483+
"anthropic-beta": "context-1m-2025-08-07",
483484
...(providerConfig?.options?.aiGatewayHeaders || {}),
484485
}
485486

packages/opencode/test/provider/gitlab-duo.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,30 @@ test("GitLab Duo: config apiKey takes precedence over environment variable", asy
198198
})
199199
})
200200

201+
test("GitLab Duo: includes context-1m beta header in aiGatewayHeaders", async () => {
202+
await using tmp = await tmpdir({
203+
init: async (dir) => {
204+
await Bun.write(
205+
path.join(dir, "opencode.json"),
206+
JSON.stringify({
207+
$schema: "https://opencode.ai/config.json",
208+
}),
209+
)
210+
},
211+
})
212+
await Instance.provide({
213+
directory: tmp.path,
214+
init: async () => {
215+
Env.set("GITLAB_TOKEN", "test-token")
216+
},
217+
fn: async () => {
218+
const providers = await Provider.list()
219+
expect(providers["gitlab"]).toBeDefined()
220+
expect(providers["gitlab"].options?.aiGatewayHeaders?.["anthropic-beta"]).toContain("context-1m-2025-08-07")
221+
},
222+
})
223+
})
224+
201225
test("GitLab Duo: supports feature flags configuration", async () => {
202226
await using tmp = await tmpdir({
203227
init: async (dir) => {

0 commit comments

Comments
 (0)