answered from live GitHub & Hugging Face data
How can I optimize rate limits when using multiple AI coding agents like Claude Code and Copilot on the same GitHub repository?
Verdict: Your agents share a rate limit only when they share a credential. Give each agent its own GitHub App installation, and the limits stop competing.
Your real question is which credential each agent uses, because the limit applies per credential. Below are the limits from GitHub's docs, followed by the steps.
The limits that matter
| Credential | Primary limit (REST) | Source |
|---|---|---|
| Personal access token or user token | 5,000 requests per hour, shared by everything that uses that user's token | REST rate limits |
| GitHub App installation token | 5,000 per hour minimum | REST rate limits |
| Installation, more than 20 repositories | Plus 50 per hour for each repository | REST rate limits |
| Installation, organization with more than 20 users | Plus 50 per hour for each user | REST rate limits |
| Installation on a GitHub Enterprise Cloud organization | 15,000 per hour | REST rate limits |
Installation limits cap at 12,500 per hour, except on Enterprise Cloud. A user token counts all requests made on that user's behalf, including requests from other apps. If one app makes many requests, the user's personal budget shrinks for every other tool.
Secondary limits
Secondary limits trigger on bursts, not totals. The documented thresholds are:
- No more than 100 concurrent requests, shared across REST and GraphQL.
- No more than 900 points per minute for REST endpoints.
- No more than 80 content-generating requests per minute and 500 per hour.
Most REST GET requests cost 1 point. Most POST, PATCH, PUT, and DELETE requests cost 5 points. (Rate limits, secondary)
Steps to reduce pressure
- Give each agent its own credential. Use a separate GitHub App installation for each agent when you run several at once.
- Use conditional requests for polling. Send
if-none-matchwith the savedetag. A304 Not Modifiedresponse does not count against the primary limit when the request is authorized. (Best practices) - Use webhooks instead of polling. The docs say to subscribe to webhook events where you can. (Best practices)
- Serialize requests. Put a queue in front of each agent's API calls. Wait at least one second between large batches of writes. (Best practices)
- Honor retry headers. If
retry-afteris present, wait that many seconds. Ifx-ratelimit-remainingis0, wait untilx-ratelimit-reset. Otherwise wait at least one minute, then back off exponentially. Retrying during a limit can get the integration banned. (Rate limits) - Read the
x-ratelimit-*response headers. Do not rely onGET /rate_limitfor exact counts, because the docs say the headers are authoritative. (Rate limits)
Agent-specific notes
- Copilot third-party agents. Claude and Codex agents can run on your Copilot subscription. The docs state that "All usage is subject to GitHub rate limits and billing." When you enable the Claude agent, GitHub installs an
anthropic code agentGitHub App. Its actions appear in the audit log. (Third-party coding agents) - Local agents. The docs say org and account policies do not apply to local agents in VS Code. Local agents use whatever credential you give them. If that is your personal token, they share your 5,000-per-hour budget. (Third-party coding agents)
- Unverified. I did not confirm which bucket each Copilot-hosted agent draws from. Check the response headers from each agent before you plan around it.
How they relate
Every app identity has its own budget. One GitHub App shared by several agents uses one budget and shows every agent as the same bot. Separate apps give separate budgets and separate attribution, but each app needs setup and installation.
Recommendation
Use one GitHub App per agent, and keep personal tokens out of agent runs. This gives each agent its own budget, its own bot name, and its own revocation switch. Add conditional requests and a request queue on top.
Choose a single shared app if you run one agent at a time and the work is light. Choose separate apps if you run several agents in parallel on a large repository.
If you want this set up for you, githug gives each agent its own key. That key mints one-hour tokens scoped to one repository, and can also run as the agent's own GitHub App, so its commits and PRs show as its own bot with its own rate limit. The hug init --repo owner/repo command sets this up for Claude Code, Codex, Cursor, or any agent that runs git. It is free during the beta.