Skip to content

A tools/llm run is refused, though the key works and the credits are there ​

Symptoms ​

A tool in tools/llm/ stops with one of these messages, and nothing is spent:

  • Credit balance is too low, from headless.py or skillcheck.py, while ask.py works with the same key.
  • Claude Code 2.1.190 does not support this model; version 2.1.280 or newer is required.
  • This API key is not scoped to a workspace, so this request must include the anthropic-workspace-id header.
  • Set GAMEFRAME_ANTHROPIC_API_KEY for GAMEFRAME_LLM_PROVIDER=anthropic.

Cause ​

Each message has its own cause (observed on 2026-10-24).

  • The credits pay for API-key use. They do not pay for Claude Code started from the desktop app. A run started from inside a Claude Code session inherited that session's CLAUDE* variables, such as CLAUDE_CODE_ENTRYPOINT, and counted as part of the session.
  • The installed claude was older than the model.
  • The key belonged to the organization and to no workspace.
  • The key was not in the environment or in the .env of the current folder, the project or GameFrame.

Evidence ​

A request through the SDK with the same key and max_tokens up to 64000 succeeded, while claude -p --bare failed. With the CLAUDE* variables left out, the same claude -p call succeeded for $0.004.

What to do ​

Pull GameFrame: since 2026-10-24, client.py leaves the CLAUDE* variables out of every run it starts. Then fix whichever message remains.

  • An old claude: run claude update, or set GAMEFRAME_CLAUDE to a newer claude.
  • No workspace: create the key in a workspace, or put GAMEFRAME_ANTHROPIC_WORKSPACE_ID=... in .env.
  • No key: put GAMEFRAME_ANTHROPIC_API_KEY=... in the project's .env, then select the service with GAMEFRAME_LLM_PROVIDER=anthropic for the task.
  • Check the setup with ./gameframe run tools/llm/client.py.

Tried ​

  • A larger or smaller max_tokens: no change; the balance was never the cause.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.