diff options
| author | Aiden Cline <[email protected]> | 2026-01-28 23:52:16 -0600 |
|---|---|---|
| committer | Aiden Cline <[email protected]> | 2026-01-28 23:52:23 -0600 |
| commit | 92eb98286373b54bab97c89cb63244a3aa0005c5 (patch) | |
| tree | 7ae2165878cf8ecd3e371b949a1ab1e10e37b853 | |
| parent | 33c5c100ff271f639f998079e380b3957713b63c (diff) | |
| download | opencode-92eb98286373b54bab97c89cb63244a3aa0005c5.tar.gz opencode-92eb98286373b54bab97c89cb63244a3aa0005c5.zip | |
fix: undo change that used anthropic messages endpoint for anthropic models on copilot due to ratelimiting issues, go back to completions endpoint instead
| -rw-r--r-- | packages/opencode/src/plugin/copilot.ts | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/packages/opencode/src/plugin/copilot.ts b/packages/opencode/src/plugin/copilot.ts index 51f29db5e..ef41ee38d 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() |
