Skip to content

[Feature]: Add model info and limits display with plan-based calculations and default model grouping #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jun 23, 2025

This PR implements comprehensive model information and limits display as requested in the issue, adding plan-based request limits, model multipliers, cost calculations, and default model grouping.

✅ Features Implemented

1. Plan-Based Request Limits

Shows monthly request limits for each Copilot plan based on model multipliers:

  • Individual Plan: 150 premium requests/month
  • Business/Enterprise Plans: 500 premium requests/month
  • Automatically calculates per-model limits using: plan_limit / model_multiplier

2. Model Multipliers

Displays multipliers for each model based on GitHub's documentation:

  • Default models (GPT-4o, GPT-4.1): 1x multiplier
  • Other models: Configured multipliers based on GitHub docs
  • Unknown models default to 1x multiplier

3. Default Model Grouping

GPT-4o and GPT-4.1 models are now grouped together as "Default (GPT-4o, GPT-4.1)" with combined statistics as requested:

Before:
gpt-4o-2024-11-20    | 12,414 | 12,398 | 16
gpt-4.1-2025-04-14   | 33,902 | 33,896 | 6

After:
Default (GPT-4o, GPT-4.1) | 46,316 | 46,294 | 22

4. Excess Cost Calculation

Calculates and displays costs for exceeding requests:

  • Formula: exceeding_requests × model_multiplier × $0.15
  • Displayed in USD format (e.g., "$3.30")

🔧 Technical Implementation

Enhanced Table Display

The "Requests per Model" table now includes 8 columns:

Column Description
Model Model name (with grouping for defaults)
Total Requests Total usage
Compliant Within quota requests
Exceeding Over quota requests
Multiplier Model multiplier (e.g., "1x")
Individual Limit Monthly limit for Individual plan
Business/Enterprise Limit Monthly limit for Business/Enterprise plans
Excess Cost Calculated cost in USD

Code Changes

  • Extended ModelUsageSummary interface with new fields for multipliers, limits, and costs
  • Updated getModelUsageSummary() function to calculate plan limits and group default models
  • Added constants for Copilot plans, model multipliers, and cost calculations
  • Enhanced UI table to display all new information in organized layout

🧪 Testing

  • 7 new comprehensive test cases covering grouping, cost calculation, and plan limits
  • All existing 26 tests continue to pass ensuring backward compatibility
  • Build and type checking successful

Example Test Cases

// Test default model grouping
const defaultGroup = result.find(item => item.model === 'Default (GPT-4o, GPT-4.1)');
expect(defaultGroup.totalRequests).toBe(150); // Combined from both models

// Test cost calculation  
expect(defaultGroup.excessCost).toBe(50 * 1 * 0.15); // 50 excess × 1x × $0.15

📊 Example Output

Model                      | Total | Compliant | Exceeding | Multiplier | Individual | Business/Enterprise | Excess Cost
Default (GPT-4o, GPT-4.1) | 46,316| 46,294    | 22        | 1x         | 150        | 500                | $3.30
gpt-4.1-vision            | 26    | 26        | 0         | 1x         | 150        | 500                | $0.00
o3-mini-2025-01-31        | 8     | 8         | 0         | 1x         | 150        | 500                | $0.00

Fixes #56.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ation

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] [Feature]: Add info on model and limits Jun 23, 2025
@Copilot Copilot AI requested a review from rajbos June 23, 2025 13:44
Copilot finished work on behalf of rajbos June 23, 2025 13:44
src/lib/utils.ts Outdated
export const DEFAULT_MODELS = ['gpt-4o-2024-11-20', 'gpt-4.1-2025-04-14'];

// Cost per excess request (in USD) for premium requests
export const EXCESS_REQUEST_COST = 0.15; // $0.15 per excess request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That needs to be 0.04 per excess request

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated EXCESS_REQUEST_COST from $0.15 to $0.04 per excess request as requested (commit 7fa9eb4).

// O-series models (higher multipliers)
'o3-mini-2025-01-31': 1,
'o4-mini-2025-04-16': 1,
// Add other models as needed - fallback to 1x for unknown models
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the table to use:

Model | Multiplier for paid plans | Multiplier for Copilot Free -- | -- | -- GPT-4.1 | 0 | 1 GPT-4o | 0 | 1 GPT-4.5 | 50 | Not applicable Claude Sonnet 3.5 | 1 | 1 Claude Sonnet 3.7 | 1 | Not applicable Claude Sonnet 3.7 Thinking | 1.25 | Not applicable Claude Sonnet 4 | 1 | Not applicable Claude Opus 4 | 10 | Not applicable Gemini 2.0 Flash | 0.25 | 1 Gemini 2.5 Pro | 1 | Not applicable o1 | 10 | Not applicable o3 | 1 | Not applicable o3-mini | 0.33 | 1 o4-mini | 0.33 | Not applicable
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated MODEL_MULTIPLIERS using the provided table with all the correct multipliers for paid plans (commit 7fa9eb4).


if (defaultGroup) {
expect(defaultGroup.multiplier).toBe(1);
expect(defaultGroup.individualPlanLimit).toBe(150); // 150 / 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is 50 a month

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated Individual plan limit from 150 to 50 requests per month (commit 7fa9eb4).

if (defaultGroup) {
expect(defaultGroup.multiplier).toBe(1);
expect(defaultGroup.individualPlanLimit).toBe(150); // 150 / 1
expect(defaultGroup.businessPlanLimit).toBe(500); // 500 / 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is 300 a month

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated Business plan limit from 500 to 300 requests per month (commit 7fa9eb4).

expect(defaultGroup.multiplier).toBe(1);
expect(defaultGroup.individualPlanLimit).toBe(150); // 150 / 1
expect(defaultGroup.businessPlanLimit).toBe(500); // 500 / 1
expect(defaultGroup.enterprisePlanLimit).toBe(500); // 500 / 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is 1000 a month

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated Enterprise plan limit from 500 to 1000 requests per month (commit 7fa9eb4).

…on feedback

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
@Copilot Copilot AI requested a review from rajbos June 23, 2025 14:58
Copilot finished work on behalf of rajbos June 23, 2025 14:58
@rajbos
Copy link
Collaborator

rajbos commented Jun 23, 2025

Change the display of the newly added columns on the different license types into a dropdown for the user to select. Use the Copilot Business type as the default.

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 23, 2025

Change the display of the newly added columns on the different license types into a dropdown for the user to select. Use the Copilot Business type as the default.

Implemented plan selection dropdown with Business as default. The table now shows a single "Plan Limit" column that dynamically updates based on the selected plan type. Models with 0x multiplier display "Unlimited" for better clarity (commit 018139a).

@rajbos
Copy link
Collaborator

rajbos commented Jun 23, 2025

Plan limit now shows the end of a calculation, where it should just be the number / user / month.

…results

Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jun 23, 2025

Plan limit now shows the end of a calculation, where it should just be the number / user / month.

Fixed the plan limit display to show constant plan values (50, 300, 1000 requests/month) instead of calculated results. The Plan Limit column now displays the base monthly limit per user regardless of model multiplier (commit a90de0a).

Copilot finished work on behalf of rajbos June 23, 2025 15:38
@rajbos
Copy link
Collaborator

rajbos commented Jul 1, 2025

Build fails after fixing the merge conflict:

✓ 3 modules transformed.
✗ Build failed in 100ms
error during build:
[vite:esbuild] Transform failed with 2 errors:
/home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/src/App.tsx:770:7: ERROR: The character "}" is not valid inside a JSX element
/home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/src/App.tsx:774:3: ERROR: Expected "}" but found ";"
file: /home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/src/App.tsx:770:7

The character "}" is not valid inside a JSX element
768|
769|
770| )}
| ^
771|
772|

Expected "}" but found ";"
772|
773|
774| );
| ^
775| }
776|

at failureErrorWithLog (/home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/node_modules/esbuild/lib/main.js:1477:15)
at /home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/node_modules/esbuild/lib/main.js:756:50
at responseCallbacks.<computed> (/home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/node_modules/esbuild/lib/main.js:623:9)
at handleIncomingPacket (/home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/node_modules/esbuild/lib/main.js:678:12)
at Socket.readFromStdout (/home/runner/work/github-copilot-premium-reqs-usage/github-copilot-premium-reqs-usage/node_modules/esbuild/lib/main.js:601:7)
at Socket.emit (node:events:517:28)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

Updated 1 path from the index
Build complete! The files are in the ./dist directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants