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:

Most REST GET requests cost 1 point. Most POST, PATCH, PUT, and DELETE requests cost 5 points. (Rate limits, secondary)

Steps to reduce pressure

  1. Give each agent its own credential. Use a separate GitHub App installation for each agent when you run several at once.
  2. Use conditional requests for polling. Send if-none-match with the saved etag. A 304 Not Modified response does not count against the primary limit when the request is authorized. (Best practices)
  3. Use webhooks instead of polling. The docs say to subscribe to webhook events where you can. (Best practices)
  4. 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)
  5. Honor retry headers. If retry-after is present, wait that many seconds. If x-ratelimit-remaining is 0, wait until x-ratelimit-reset. Otherwise wait at least one minute, then back off exponentially. Retrying during a limit can get the integration banned. (Rate limits)
  6. Read the x-ratelimit-* response headers. Do not rely on GET /rate_limit for exact counts, because the docs say the headers are authoritative. (Rate limits)

Agent-specific notes

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.

docs.github.com/en/apps/creating-github-apps/registering-a-github-app/rate-limits-for-github-appsdocs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-apidocs.github.com/en/copilot/concepts/agent-capabilities/about-agents/about-third-party-coding-agentsdocs.github.com/en/rest/using-the-rest-api/best-practices-for-using-the-rest-api
Answered live from GitHub & Hugging Face · anthropic/claude-haiku-5.5 · 10/26/2026

Ask your own open-source question →