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

'max_tokens' is not supported with this model

Open chongsan33 opened this issue 7 months ago • 4 comments

启动claude-code的命令:

export ANTHROPIC_BASE_URL=http://localhost:4141 ANTHROPIC_AUTH_TOKEN=dummy ANTHROPIC_MODEL=gpt-5.3-codex ANTHROPIC_DEFAULT_SONNET_MODEL=gpt-5.3-codex ANTHROPIC_SMALL_FAST_MODEL=gpt-5.4-mini ANTHROPIC_DEFAULT_HAIKU_MODEL=gpt-5.4-mini DISABLE_NON_ESSENTIAL_MODEL_CALLS=1 CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1 && claude

报错信息 HTTP error: { error: 1:13:39 AM { message: "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.", code: 'invalid_request_body' } }

chongsan33 avatar Apr 02 '26 17:04 chongsan33

有解决这个问题?

yuxingfei avatar Apr 09 '26 06:04 yuxingfei

so do I :(

gk2qf avatar Apr 12 '26 08:04 gk2qf

You can use this with the latest release:

npx betahi-copilot-api@latest start

Then either:

  1. pass the model explicitly:
  • claude --model gpt-5.3-codex
  • claude --model gpt-5.4
  • claude --model gpt-5.4-mini
  1. or configure ~/.claude/settings.json:
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:4141",
    "ANTHROPIC_AUTH_TOKEN": "dummy",
    "ANTHROPIC_MODEL": "gpt-5.3-codex",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-5.3-codex",
    "ANTHROPIC_SMALL_FAST_MODEL": "gpt-5.4-mini",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-5.4-mini",
    "COPILOT_REASONING_EFFORT": "medium",
    "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}

Supported reasoning effort:

  • gpt-5.4: low, medium, high, xhigh
  • gpt-5.3-codex: low, medium, high, xhigh
  • gpt-5.4-mini: none, low, medium

More details: https://github.com/betaHi/copilot-api?tab=readme-ov-file#gpt-support

betaHi avatar Apr 15 '26 05:04 betaHi

我是自己修改代码解决的,https://github.com/ericc-ch/copilot-api/pull/234

yuxingfei avatar Apr 15 '26 05:04 yuxingfei