API Error: Gemini 3 Pro not supported
Thanks for maintaining this great project!
Issue
Claude Code fails when configured to use gemini-3-pro-preview model.
Error:
API Error: 400 {"error":{"message":"{"error":{"message":"invalid request body","code":"invalid_request_body"}}\n","type":"error"}}
Configuration:
export ANTHROPIC_BASE_URL=http://localhost:4141
export ANTHROPIC_AUTH_TOKEN=dummy
export ANTHROPIC_MODEL=gemini-3-pro-preview
export ANTHROPIC_DEFAULT_SONNET_MODEL=gemini-3-pro-preview
export ANTHROPIC_SMALL_FAST_MODEL=claude-haiku-4.5
export ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-haiku-4.5
export DISABLE_NON_ESSENTIAL_MODEL_CALLS=1
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
@foamzou https://github.com/ericc-ch/copilot-api/pull/152 in lastest claude code, also need "CLAUDE_CODE_SUBAGENT_MODEL": "gpt-5-mini" , if not warm up request will use gemini-3-pro-preview.
@foamzou #152 in lastest claude code, also need "CLAUDE_CODE_SUBAGENT_MODEL": "gpt-5-mini" , if not warm up request will use gemini-3-pro-preview.
get this when it receive the tool call result : ERROR HTTP error: { error: { message: 'invalid request body', code: 'invalid_request_body' } } 8:06:28 PM
--> POST /v1/messages?beta=true 400 484ms <-- POST /v1/messages --> POST /v1/messages 200 4s <-- POST /v1/messages
ERROR Failed to create chat completions Response {} 8:07:38 PM
ERROR Error occurred: Failed to create chat completions 8:07:38 PM
at <anonymous> (src/services/copilot/create-chat-completions.ts:39:15)
at async handleCompletion (src/routes/messages/handler.ts:41:26)
at async <anonymous> (src/routes/messages/route.ts:12:18)
at async dispatch (node_modules/hono/dist/compose.js:22:23)
at async cors2 (node_modules/hono/dist/middleware/cors/index.js:84:11)
at async dispatch (node_modules/hono/dist/compose.js:22:23)
at async logger2 (node_modules/hono/dist/middleware/logger/index.js:38:11)
at async dispatch (node_modules/hono/dist/compose.js:22:23)
at async <anonymous> (node_modules/hono/dist/hono-base.js:201:31)
at processTicksAndRejections (native:7:39)
ERROR HTTP error: { error: { message: 'invalid request body', code: 'invalid_request_body' } }
@Louis454545 try https://github.com/caozhiyuan/copilot-api/tree/feature/chat-completions-reasoning
@Louis454545 try
https://github.com/caozhiyuan/copilot-api/tree/feature/chat-completions-reasoning
This forked branch doesn't work for me when doing the sub agent mode. Getting the same error. Anyone know of a fix?
@patrickrho-patty what's error and you claude code version and settings.json ?
@caozhiyuan This is super weird, I was trying to capture the invalid request body error so I tried again, spawning a sub agent tool, but this time it worked perfectly fine. Thanks so much for the fork and your work!
@Louis454545 try
https://github.com/caozhiyuan/copilot-api/tree/feature/chat-completions-reasoning
@caozhiyuan
Does this version (branch) support both responss-API (codex) and gemini 3 pro simultaneously?
@nickfan https://github.com/caozhiyuan/copilot-api/tree/all
@caozhiyuan using your repo but still get the error. i am using claude-opus-4.5 now
@caozhiyuan using your repo but still get the error. i am using claude-opus-4.5 now
what's error ? @lab16k5u
@lab16k5u please run https://github.com/caozhiyuan/copilot-api/tree/all bun run start start -v , and see log in user\xxx.local\share\copilot-api\logs\ .
@lab16k5u because claude model support thinking , microsofe copilot change api logic . now it's fixed. you can pull latest code
still same error @caozhiyuan
{
Authorization: "Bearer tid=REDACTEDexp=1765439896;sku=copilot_enterprise_seat_quota;proxy-ep=proxy.enterprise.githubcopilot.com;st=dotcom;ssc=1;chat=1;cit=1;malfil=1;editor_preview_features=0;agent_mode=1;agent_mode_auto_approval=1;mcp=0;ccr=1;8kp=1;ip=REDACTED;asn=REDACTED",
"content-type": "application/json",
"copilot-integration-id": "vscode-chat",
"editor-version": "vscode/1.107.0",
"editor-plugin-version": "copilot-chat/0.35.0",
"user-agent": "GitHubCopilotChat/0.35.0",
"openai-intent": "conversation-panel",
"x-github-api-version": "2025-10-01",
"x-request-id": "REDACTED",
"x-vscode-user-agent-library-version": "electron-fetch",
}
ERROR Failed to create chat completions Response {}
ERROR HTTP error: { error:
{ message: 'The requested model is not supported.',
code: 'model_not_supported',
param: 'model',
type: 'invalid_request_error' } }
@lab16k5u you need vpn
@caozhiyuan 大佬Hi there, thanks for your fork(https://github.com/caozhiyuan/copilot-api/tree/feature/responses-api) that allowed me to use GPT5.2's xhigh on Codex. However, I'm currently encountering an issue where occasionally the following error appears in conversations—sometimes retrying a few times lets it continue, but other times it just gets stuck indefinitely:
<-- POST /responses
ERROR Failed to create responses Response {} 2:36:47 PM
ERROR Error occurred: Failed to create responses 2:36:47 PM
at <anonymous> (/data/private/yangdeyu/copilot-api/src/services/copilot/create-responses.ts:351:15)
at async <anonymous> (/data/private/yangdeyu/copilot-api/src/routes/responses/handler.ts:52:26)
at async <anonymous> (/data/private/yangdeyu/copilot-api/src/routes/responses/route.ts:11:18)
at async dispatch (/data/private/yangdeyu/copilot-api/node_modules/hono/dist/compose.js:22:23)
at async cors2 (/data/private/yangdeyu/copilot-api/node_modules/hono/dist/middleware/cors/index.js:84:11)
at async dispatch (/data/private/yangdeyu/copilot-api/node_modules/hono/dist/compose.js:22:23)
at async logger2 (/data/private/yangdeyu/copilot-api/node_modules/hono/dist/middleware/logger/index.js:38:11)
at async dispatch (/data/private/yangdeyu/copilot-api/node_modules/hono/dist/compose.js:22:23)
at async <anonymous> (/data/private/yangdeyu/copilot-api/node_modules/hono/dist/hono-base.js:201:31)
at processTicksAndRejections (native:7:39)
ERROR HTTP error: Internal Server Error 2:36:47 PM
--> POST /responses 500 26s
<-- POST /responses
ERROR Failed to create responses Response {} 2:42:33 PM
ERROR Error occurred: Failed to create responses 2:42:33 PM
at <anonymous> (/data/private/yangdeyu/copilot-api/src/services/copilot/create-responses.ts:351:15)
at unknown
at unknown
at async dispatch (unknown)
at async cors2 (unknown)
at async dispatch (unknown)
at async logger2 (unknown)
at async dispatch (unknown)
at unknown
at processTicksAndRejections (native:7:39)
ERROR HTTP error: Internal Server Error 2:42:33 PM
--> POST /responses 500 36s
What's the problem here ? Thank you
@Deyu008 I mainly use it in claude code. Judging from your logs, it should be a network issue or an error reported by the copilot-api server. I haven't encountered this problem when using it in claude code. Currently, I primarily use the branch https://github.com/caozhiyuan/copilot-api/tree/all, started with bun run start start -v, and the logs are located in the home .local\share\copilot-api\logs folder.
@Deyu008 You can also let the AI add a try-catch in responses handler.ts to log detailed exception information.
OK,Thanks @caozhiyuan