The open source coding agent.
TypeScript
fix: undo change that used anthropic messages endpoint for anthropic models on copilot due to ratelimiting issues, go back to completions endpoint instead
Aiden Cline92eb98286373
diff --git a/packages/opencode/src/plugin/copilot.ts b/packages/opencode/src/plugin/copilot.tsindex 51f29db5ede..ef41ee38d37 100644--- a/packages/opencode/src/plugin/copilot.ts+++ b/packages/opencode/src/plugin/copilot.ts@@ -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...- const base = baseURL ?? model.api.url- const claude = model.id.includes("claude")- const url = iife(() => {- if (!claude) return base- if (base.endsWith("/v1")) return base- if (base.endsWith("/")) return `${base}v1`- return `${base}/v1`- })-- model.api.url = url- model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"+ // const base = baseURL ?? model.api.url+ // const claude = model.id.includes("claude")+ // const url = iife(() => {+ // if (!claude) return base+ // if (base.endsWith("/v1")) return base+ // if (base.endsWith("/")) return `${base}v1`+ // return `${base}/v1`+ // })++ // model.api.url = url+ // model.api.npm = claude ? "@ai-sdk/anthropic" : "@ai-sdk/github-copilot"+ model.api.npm = "@ai-sdk/github-copilot"}}return {+ baseURL,apiKey: "",async fetch(request: RequestInfo | URL, init?: RequestInit) {const info = await getAuth()