Skip to content

Commit 92eb982

Browse files
committed
fix: undo change that used anthropic messages endpoint for anthropic models on copilot due to ratelimiting issues, go back to completions endpoint instead
1 parent 33c5c10 commit 92eb982

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

packages/opencode/src/plugin/copilot.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,25 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
4040
},
4141
}
4242

43+
// TODO: re-enable once messages api has higher rate limits
4344
// TODO: move some of this hacky-ness to models.dev presets once we have better grasp of things here...
44-
const base = baseURL ?? model.api.url
45-
const claude = model.id.includes("claude")
46-
const url = iife(() => {
47-
if (!claude) return base
48-
if (base.endsWith("/v1")) return base
49-
if (base.endsWith("/")) return `${base}v1`
50-
return `${base}/v1`
51-
})
52-
53-
model.api.url = url
54-
model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"
45+
// const base = baseURL ?? model.api.url
46+
// const claude = model.id.includes("claude")
47+
// const url = iife(() => {
48+
// if (!claude) return base
49+
// if (base.endsWith("/v1")) return base
50+
// if (base.endsWith("/")) return `${base}v1`
51+
// return `${base}/v1`
52+
// })
53+
54+
// model.api.url = url
55+
// model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"
56+
model.api.npm = "@ai-sdk/github-copilot"
5557
}
5658
}
5759

5860
return {
61+
baseURL,
5962
apiKey: "",
6063
async fetch(request: RequestInfo | URL, init?: RequestInit) {
6164
const info = await getAuth()

0 commit comments

Comments
 (0)