copilot-api icon indicating copy to clipboard operation
copilot-api copied to clipboard

Proxy stopped working with cluade code with recent updates

Open vishnuvr opened this issue 1 year ago • 3 comments

It used to work. now it does not work with any model on the cluade code.   export ANTHROPIC_BASE_URL=http://localhost:4141 ANTHROPIC_AUTH_TOKEN=dummy ANTHROPIC_MODEL=claude-sonnet-4 ANTHROPIC_SMALL_FAST_MODEL=gpt-4.1 && claude

API Error: 400 {"error":{"message":"Bad Request\n","type":"error"}} on claude code

on proxy

--> POST /v1/messages/count_tokens?beta=true 200 1ms

ERROR Failed to create chat completions Response { status: 400, 12:28:28 am statusText: 'Bad Request', headers: Headers { 'content-security-policy': "default-src 'none'; sandbox", 'content-type': 'text/plain; charset=utf-8', 'copilot-edits-session': '1759604308.26a7207ac37f63d6a191b2d9b4bdb7ea2f17090976c128d99cdff7eb3499f151', 'strict-transport-security': 'max-age=31536000', 'x-content-type-options': 'nosniff', 'x-request-id': 'd4a5fee5-da89-4c77-948c-5bda29a137b4', date: 'Sat, 04 Oct 2025 18:58:28 GMT', 'content-length': '12', 'x-github-backend': 'Kubernetes', 'x-github-request-id': '4EB3:2003EB:2734D0:39CCE3:68E16E52' }, body: ReadableStream { locked: false, state: 'readable', supportsBYOB: true }, bodyUsed: false, ok: false, redirected: false, type: 'basic', url: 'https://api.githubcopilot.com/chat/completions' }

ERROR Error occurred: Failed to create chat completions 12:28:28 am

at createChatCompletions (.npm/_npx/b3c0db1118356182/node_modules/copilot-api/dist/main.js:783:9)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async handleCompletion (.npm/_npx/b3c0db1118356182/node_modules/copilot-api/dist/main.js:1227:19)
at async .npm/_npx/b3c0db1118356182/node_modules/copilot-api/dist/main.js:1265:10
at async dispatch (.npm/_npx/b3c0db1118356182/node_modules/hono/dist/compose.js:22:17)
at async cors2 (.npm/_npx/b3c0db1118356182/node_modules/hono/dist/middleware/cors/index.js:84:5)
at async dispatch (.npm/_npx/b3c0db1118356182/node_modules/hono/dist/compose.js:22:17)
at async logger2 (.npm/_npx/b3c0db1118356182/node_modules/hono/dist/middleware/logger/index.js:38:5)
at async dispatch (.npm/_npx/b3c0db1118356182/node_modules/hono/dist/compose.js:22:17)
at async .npm/_npx/b3c0db1118356182/node_modules/hono/dist/hono-base.js:201:25

ERROR HTTP error: Bad Request 12:28:28 am

--> POST /v1/messages?beta=true 400 1s

vishnuvr avatar Oct 04 '25 19:10 vishnuvr

Should be fixed in the latest release, probably regression related to reading proxy env variables

ericc-ch avatar Oct 05 '25 03:10 ericc-ch

I don't have Claude in my available models anymore

7HHHHH avatar Oct 06 '25 05:10 7HHHHH

I don't have Claude in my available models anymore

@7HHHHH check your ip, is it in China? consider use a proxy. i had same issue, when using proxy, claude models come back

cuipengfei avatar Oct 22 '25 14:10 cuipengfei