[feature]: GitHub Enterprise Copilot Quota
Pre-flight checks
- [x] I searched existing issues and did not find a duplicate request.
- [x] I reviewed current behavior on the production released OpenCode version.
OpenCode version reviewed
1.15.10
Problem statement
I have a Copilot setup in OpenCode from GitHub Enterprise server (GHE). The models work well but the quota is not working.
Proposed change
Add GHE (xyz.ghe.com) as a possibility for Copilot quota - now only GitHub is available.
Alternatives considered
No response
Acceptance criteria
- [ ] GHE Copilot quota can be shown
@buzzcz Is there documentation on GHE copilot, and is this still relevant after the Copilot changes?
From https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/billing/usage-based-billing-for-organizations-and-enterprises#how-do-ai-credits-work, I found:
A user's included AI credits are pooled at the billing entity level. For example, an enterprise with 100 Copilot Business users gets a shared pool of 190,000 AI credits rather than 100 individual buckets. This means power users can draw more when they need it, while lighter users offset that consumption.
Wouldn't this suggest quotas have to be pinged from the enterprise billing account?
I have a business account and I was quite puzzled about this too. For the business account it works like that, all credit is pooled at the org level. So one person could actually drain ALL the credit from all other users in the same org.
For that you can set per-user spending limits. You can configure a global one, which would be equivalent to having the old quota. So now that we are in the promotional period, you get 3000 AI credits per seat, if you configure a spending limit of 3000 AI per seat, you get the same per-user quota where each user can use up to what their subscription costed.
So the new system brings more confusion but more flexibility, basically you can move credit around inside the organization. You can also set individual limits, so you could potentially pay for seats and give them a 0 budget, and they will only access to free features (like unlimited AI completions), and give all the credit to another user, or leave the excess credit to use in GitHub actions for example.
@llucax Got it, thanks for the details. It roughly sounds like what I expected. I wasn't able to find API endpoints for the enterprise & their seats in the docs, which makes it quite difficult to address this issue #104.
I'm not sure how to address Copilot Enterprise directly if there are no endpoints.
But I am working on a feature that will let people configure any provider (especially if one is not hardcoded into the plugin).
I am very intersested in this feature too.
Implemented for v4.1.0., plugin recognizes a validated GHE.com enterprise URL from the existing Copilot authentication/configuration and routes Copilot quota requests through the matching enterprise API host.
Existing GitHub.com configurations continue to use api.github.com, and authentication is not silently changed.
Would love to have feedback of any issues.
Implemented for
v4.1.0., plugin recognizes a validated GHE.com enterprise URL from the existing Copilot authentication/configuration and routes Copilot quota requests through the matching enterprise API host.Existing GitHub.com configurations continue to use api.github.com, and authentication is not silently changed.
Would love to have feedback of any issues.
hello, gave it a try today. : ran again
npx @slkiser/opencode-quota@latest init
┌ Configure @slkiser/opencode-quota
│
◇ Which OpenCode interfaces do you use?
│ TUI
│
◇ Where should OpenCode Quota be configured?
│ Global OpenCode config (recommended)
│
◇ OpenCode config format
│ JSONC (recommended)
│
◇ Which automatic quota displays do you want?
│ Sidebar panel (TUI)
│
◇ Where should slash commands (e.g. /quota) appear?
│ Popup dialog
│
◇ How should pre-configured providers be selected?
│ Auto-detect providers
│
● Custom providers are configured after installation.
│
● npx @slkiser/opencode-quota@latest provider add
│
◇ Quota reset periods
│ All reset periods
│
◇ What should quota percentages show?
│ Used quota
│
◇ Session input/output tokens
│ Show
│
◇ Session token scope
│ Current session
│
◇ Show maintainer announcements on the TUI Home screen when available?
│ Yes
│
● Interface: TUI
│
● Scope: global (/Users/nbossard/.config/opencode)
│
● Config format: JSONC
│
● TUI surfaces: Sidebar
│
● Command display: Popup dialog
│
● Provider mode: Auto-detect
│
● Quota reset periods: All windows
│
● Quota percentage meaning: Used
│
● Session input/output tokens: Show
│
● Session token scope: Current session
│
● Maintainer announcements: Enabled
│
● update: /Users/nbossard/.config/opencode/opencode.jsonc
│
● = plugin already includes @slkiser/opencode-quota@latest
│
● convert: /Users/nbossard/.config/opencode/opencode-quota/quota-toast.json -> /Users/nbossard/.config/opencode/opencode-quota/quota-toast.jsonc
│
● + quotaToast.tuiCommandDisplay
│
● + quotaToast.sessionTokenScope
│
● ! Both quota-toast.jsonc and quota-toast.json exist; using JSONC and preserving the JSON file.
│
● convert: /Users/nbossard/.config/opencode/tui.json -> /Users/nbossard/.config/opencode/tui.jsonc
│
● = tui config already includes @slkiser/opencode-quota@latest
│
● Warnings:
│
● ! Both quota-toast.jsonc and quota-toast.json exist; using JSONC and preserving the JSON file.
│
◇ Apply these changes?
│ Yes
│
◆ Wrote /Users/nbossard/.config/opencode/opencode.jsonc
│
◆ Wrote /Users/nbossard/.config/opencode/opencode-quota/quota-toast.jsonc
│
◆ Wrote /Users/nbossard/.config/opencode/tui.jsonc
│
└ OpenCode Quota setup complete.
Interfaces: TUI
Configured paths:
- /Users/nbossard/.config/opencode/opencode.jsonc
- /Users/nbossard/.config/opencode/opencode-quota/quota-toast.jsonc
- /Users/nbossard/.config/opencode/tui.jsonc
Restart OpenCode and run /quota.
If OpenCode Quota helps, please consider a star: https://github.com/slkiser/opencode-quota
then launched opencode and got :
Copilot: GitHub API error 401: Bad credentials (https://docs.github.com/rest)
Session input/output tokens 31K in 19 out
@nbossard Could you open a new issue so we can troubleshoot this separately?
Please include:
- Whether you use a
company.ghe.comaccount or a self-hosted GitHub Enterprise Server - The Copilot section from
/quota_status - Whether
copilot-quota-token.jsonexists
Please don’t share any tokens or other private information.