There’s a moment when you hand a bigger task to Copilot CLI and wonder what it’s going to cost you. By default GitHub Copilot runs until the task is done or until you step in.
Yesterday I showed how to tackle this in Claude Code. Today let’s have a look on how GitHub lets you cap that.
Remark: Like with Claude Code, this isn’t a token limit. Copilot tracks AI credits, where each credit equals $0.01 USD. Usage depends on the model and the number of tokens consumed.
Setting a limit in an interactive session
Use /limits set:
/limits set max-ai-credits 100
That’s a ceiling of $1.00. The limit applies to the entire session and depletes with every message, no matter how many messages you send.
To remove it again:
/limits unset
Setting a limit in non-interactive mode
When you run the CLI programmatically, pass --max-ai-credits:
copilot -p "Run the test suite and fix the failing tests" --max-ai-credits 100
Here the limit applies for the duration of Copilot’s work on the task.
What happens when the limit is reached
The agent stops cleanly and lets you know.
- Interactive mode: you are prompted to reset the limit. Raise it with
/limits setand the session continues from where the agent stopped. - Non-interactive mode: the run ends.
Remark: The limit is soft. If a response is in progress when the limit is reached, that response completes first, so actual usage can (slightly) exceed your number.
Tip: The minimum value is 30 AI credits ($0.30). Anything lower is rejected.
That’s it! One command for interactive sessions, one flag for scripts.
