Skip to content

Add Copilot AI-credits fallback pricing and skip AI-credits guardrails for BYOK - #46986

Closed
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/aw-failures-fix-auto-pricing
Closed

Add Copilot AI-credits fallback pricing and skip AI-credits guardrails for BYOK#46986
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/aw-failures-fix-auto-pricing

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Copilot runs routed through AWF were hard-failing before the first turn when the resolved model had no AI-credits pricing entry (model: auto and other unknown models), and BYOK Copilot requests were incorrectly hitting the same pricing gate even though they do not consume GitHub AI credits.

  • Config generation: emit fallback pricing for unresolved Copilot models

    • Extend generated apiProxy config to include defaultAiCreditsPricing.
    • Use a conservative default for Copilot-backed requests so unresolved aliases/models no longer 400 at the proxy.
  • BYOK handling: disable AI-credits enforcement for external providers

    • Detect Copilot BYOK mode from COPILOT_PROVIDER_* engine env.
    • Omit apiProxy.maxAiCredits for BYOK runs.
    • Skip runtime GH_AW_MAX_AI_CREDITS injection and token-steering when BYOK is active, so requests to user-owned endpoints do not enter the AI-credits pricing path.
  • Coverage updates

    • Add focused tests for:
      • fallback pricing in generated Copilot AWF config
      • BYOK omission of AI-credits guardrail config
      • BYOK omission of runtime max-AIC injection
    • Refresh Copilot WASM goldens to match the new generated config output.

Example of the generated apiProxy shape after this change for standard Copilot runs:

{
  "apiProxy": {
    "enabled": true,
    "maxAiCredits": "${GH_AW_MAX_AI_CREDITS}",
    "defaultAiCreditsPricing": {
      "input": 3.0,
      "output": 15.0,
      "cachedInput": 0.3,
      "cacheWrite": 3.75
    }
  }
}

For Copilot BYOK runs, maxAiCredits and defaultAiCreditsPricing are intentionally omitted so the request bypasses GitHub AI-credits enforcement entirely.

Copilot AI and others added 2 commits July 21, 2026 06:23
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add AI-credits pricing for auto model in api-proxy Add Copilot AI-credits fallback pricing and skip AI-credits guardrails for BYOK Jul 21, 2026
Copilot AI requested a review from pelikhan July 21, 2026 06:34
@pelikhan pelikhan closed this Jul 21, 2026
@github-actions
github-actions Bot deleted the copilot/aw-failures-fix-auto-pricing branch July 29, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants