Skip to content

[Feature] Add GITHUB_MODEL env var, resolved model display, and rate-limit surfacing (#822)#1

Merged
LoackyBit merged 2 commits intomainfrom
feature/github-model-env-var
Apr 25, 2026
Merged

[Feature] Add GITHUB_MODEL env var, resolved model display, and rate-limit surfacing (#822)#1
LoackyBit merged 2 commits intomainfrom
feature/github-model-env-var

Conversation

@LoackyBit
Copy link
Copy Markdown
Owner

@LoackyBit LoackyBit commented Apr 24, 2026

Description

When using OpenClaude with CLAUDE_CODE_USE_GITHUB=1, users previously had no way to specify which model to use (unlike every other provider), couldn't see the resolved model ID at startup, and had no visibility into rate-limit quota consumption. This PR addresses all three issues.

Related Issues

Gitlawb#822

Changes

1. GITHUB_MODEL env var support

  • Added GITHUB_MODEL env var with higher priority than OPENAI_MODEL (backward-compatible fallback), consistent with GEMINI_MODEL, MISTRAL_MODEL, etc.
  • resolveProviderRequest() now reads GITHUB_MODELOPENAI_MODEL → default when isGithubMode
  • createOpenAIShimClient() propagates GITHUB_MODELOPENAI_MODEL if the latter is unset

2. Default model → auto for Copilot API (10% discount)

  • normalizeGithubCopilotModel() now maps copilot, empty, and auto to the literal "auto" model ID, which gets the ~10% discount on the Copilot API
  • normalizeGithubModelsApiModel() maps autogpt-4o (since the Models API doesn't support native "auto")

3. Startup screen shows resolved model

  • detectProvider() in StartupScreen.ts now uses resolveProviderRequest() to show the actual model ID (e.g., auto, gpt-4.1) instead of the raw alias github:copilot
  • getGithubProviderModel() in ProviderManager.tsx now checks GITHUB_MODEL first

4. Rate-limit header surfacing

  • New githubRateLimit.ts singleton that parses x-ratelimit-* headers from GitHub API responses
  • Wired into openaiShim.ts to capture headers after every successful response in GitHub mode
  • formatTotalCost() in cost-tracker.ts appends the rate-limit summary when available

5. Documentation

  • .env.example updated with GITHUB_MODEL and GITHUB_BASE_URL in both system-wide and provider sections

Tests

  • 25 tests pass in providerConfig.github.test.ts (added 13 new tests for GITHUB_MODEL, normalizeGithubCopilotModel, and auto mapping)
  • 7 tests pass in githubRateLimit.test.ts (new file: parsing, formatting, partial data, reset)
  • Build passes ✅

Checklist

  • Code follows style guidelines
  • Tests added/updated
  • Documentation updated
  • No new warnings

…rate-limit (Gitlawb#822)

Add GITHUB_MODEL env var support with higher priority than OPENAI_MODEL
(backward-compatible fallback). Map default copilot alias to "auto" on
the Copilot API for the ~10% discount. Show the resolved model name in
the startup screen instead of the raw "github:copilot" alias.

Parse x-ratelimit-* headers from GitHub API responses and surface them
in the session cost summary at exit.

Closes Gitlawb#822
@LoackyBit LoackyBit marked this pull request as draft April 24, 2026 22:04
…able and migrate from copilot aliases to explicit models
@LoackyBit LoackyBit marked this pull request as ready for review April 25, 2026 10:39
@LoackyBit LoackyBit merged commit db1f9f3 into main Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant