
Set AI credit session limits in Copilot CLI and SDK
Quick Answer
GitHub Copilot now allows users to set AI credit session limits in its CLI and SDK, enabling control over spending per session.
Quick Take
This feature is particularly beneficial for managing costs associated with AI usage, ensuring that agents do not exceed predefined budgets during their operations.
Key Points
- Users can define spending caps for AI sessions in Copilot CLI and SDK.
- This feature helps manage costs associated with AI usage effectively.
- Predefined limits prevent agents from exceeding budget during operations.
📖 Reader Mode
~2 min readYou can now set AI credit session limits in Copilot CLI and the GitHub Copilot SDK to cap the amount an agent spends in a session. This is especially useful for automation, where no one is actively monitoring the agent’s work.
Set a limit before you start work or kick off jobs, and Copilot tracks AI credit usage across the entire session, including model calls, subagents, and background work like compaction. When the limit is reached, the agent wraps up and lets you know instead of running until the task is finished or until you manually stop it.
- In an interactive session, use
/limitsto view, set, or remove your limit. When it’s reached, Copilot prompts you to raise or adjust it and then continues from where it stopped. There’s no need to restart the task. - For noninteractive runs, pass
--max-ai-creditsto bound a single run. The run ends when the limit is reached, so it’s easy to use in scripts.
Session limits are a soft cap. Since usage is only known after a response returns, a response that’s already underway finishes before Copilot stops, so actual usage may slightly exceed the number you set. A session limit controls spend for one session—it complements, but doesn’t replace, your overall budgets and spending limits.
Session limits are available in public preview for Copilot for Individuals, Business, and Enterprise, and are subject to change. They’re supported in Copilot CLI 1.0.66 and later, and in Copilot SDK 1.0.5 and later.
To get started, update GitHub Copilot CLI by running copilot update in your terminal. To learn more, see Setting a session limit in Copilot CLI and Optimize AI usage.
Share feedback with the /feedback command in a CLI session or open an issue in our public repository.
— Originally published at github.blog
Want this in your inbox every morning?
Daily brief at your local 8am — bilingual EN/中文, free.
More from GitHub Copilot Changelog
See more →
GitHub Copilot for JetBrains adds improved OpenTelemetry configuration and model management
The latest GitHub Copilot for JetBrains update enhances workflow control with OpenTelemetry configuration, improved model management, and support for servers in Claude agent flows, facilitating better observability and cost control for enterprise users.
