fix: undo change that used anthropic messages endpoint for anthropic models on copilot due to ratelimiting issues, go back to completions endpoint instead

This commit is contained in:
Aiden Cline
2026-01-28 23:52:16 -06:00
parent 33c5c100ff
commit 92eb982863

View File

@@ -40,22 +40,25 @@ export async function CopilotAuthPlugin(input: PluginInput): Promise<Hooks> {
}, },
} }
// TODO: re-enable once messages api has higher rate limits
// TODO: move some of this hacky-ness to models.dev presets once we have better grasp of things here... // TODO: move some of this hacky-ness to models.dev presets once we have better grasp of things here...
const base = baseURL ?? model.api.url // const base = baseURL ?? model.api.url
const claude = model.id.includes("claude") // const claude = model.id.includes("claude")
const url = iife(() => { // const url = iife(() => {
if (!claude) return base // if (!claude) return base
if (base.endsWith("/v1")) return base // if (base.endsWith("/v1")) return base
if (base.endsWith("/")) return `${base}v1` // if (base.endsWith("/")) return `${base}v1`
return `${base}/v1` // return `${base}/v1`
}) // })
model.api.url = url // model.api.url = url
model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot" // model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"
model.api.npm = "@ai-sdk/github-copilot"
} }
} }
return { return {
baseURL,
apiKey: "", apiKey: "",
async fetch(request: RequestInfo | URL, init?: RequestInit) { async fetch(request: RequestInfo | URL, init?: RequestInit) {
const info = await getAuth() const info = await getAuth()