GitHub Copilot Models Query
Query and display available GitHub Copilot AI models with their capabilities, context limits, and features. Use when: "what models are available", "show copilot models", "list github models", "check model capabilities", "switch models". Examples: - user: "What models can I use with GitHub Copilot?" → fetch and display available models - user: "Show me models with vision support" → filter models by capability - user: "Which model has the largest context window?" → compare model specifications - user: "List all GPT-5 models" → filter by model family
npx skills add github:pantheon-org/tekhne --skill specialized--github-copilot-modelsQuery available GitHub Copilot AI models directly from the API to see what models you actually have access to (not just what OpenCode knows about).
Mindset
The model registry OpenCode ships with is a cache, not a source of truth — it is a config file bundled at OpenCode’s own release time, so it is always at least as stale as the gap since that release. The GitHub Copilot API is the only place that reflects your actual, current, per-subscription access: a model can be added, removed, or moved from preview to enabled (or the reverse) without OpenCode’s registry ever being updated. Every question about “what models can I use” or “why did this model stop working” should be answered by querying the live API first, then treating anything OpenCode’s own listing says as a claim to verify, not a fact to trust.
This distinction matters most under two conditions the registry can never reflect: subscription-tier gating (your org’s plan determines which models are enabled for you specifically, not globally) and policy-state churn (a model silently moving to disabled or preview is the single most common cause of “it worked yesterday” incidents).
When to Use
Use this skill when you need to:
- Validate model availability before committing to a specific model in scripts or config
- Compare context limits when working with large codebases (need 100K+ tokens)
- Check for new models that may have been added since OpenCode’s registry was last updated
- Troubleshoot model selection when a model isn’t responding or seems unavailable
- Filter by capability (e.g., vision support for screenshot analysis)
When NOT to Use
- The user already has a confirmed, currently-working model ID and only wants help with unrelated OpenCode configuration — don’t route a simple config edit through a model query
- Questions about a different provider’s model catalog (raw Anthropic API, OpenAI API directly, Azure OpenAI) — this skill is specifically for the GitHub Copilot proxy’s
/modelsendpoint and itspolicy/capabilitiesshape, which don’t apply elsewhere
Usage
Quick Query
Use the provided script to fetch your available models, run relative to this skill’s own directory:
# Plain listing
scripts/fetch-models.sh
# With JSON output for parsing
scripts/fetch-models.sh --json
# Filter by category
scripts/fetch-models.sh --category powerful
# Show only picker-enabled models
scripts/fetch-models.sh --picker-only
Script Options
| Option | Description | Example |
|---|---|---|
--json |
Raw JSON output | fetch-models.sh --json |
--picker-only |
Only show featured models | fetch-models.sh --picker-only |
--category <cat> |
Filter by category | fetch-models.sh --category versatile |
--family <name> |
Filter by model family | fetch-models.sh --family claude |
--vendor <name> |
Filter by vendor | fetch-models.sh --vendor Anthropic |
--vision |
Only models with vision | fetch-models.sh --vision |
--help |
Show all options | fetch-models.sh --help |
Manual API Query
See references/manual-queries-and-workflows.md for the raw curl/jq equivalent of the script, plus worked example workflows (large-context filtering, vision-model discovery, per-vendor comparison).
Authentication
The script automatically reads your OpenCode authentication from:
~/.local/share/opencode/auth.json
If authentication fails:
# Re-authenticate with GitHub Copilot
opencode auth add github-copilot
# Verify authentication
opencode auth list
Switching Models
After finding your desired model, specify it per-command or set a default:
# Per-command (recommended for testing)
opencode run --model gpt-5.2-codex "Refactor this code"
# Set project default in .opencode/opencode.json
{
"defaultModel": "gpt-5.2-codex"
}
Validation: Test the model is active and responding correctly:
opencode run "Echo back: model working" && echo "✓ Model active"
Decision Framework
Model Selection Criteria
When choosing a model after querying:
- Context window: Match to your typical task size (code review vs full codebase analysis)
- Policy state: Only
"enabled"models are usable; ignore"disabled"or restricted models - Preview status: Preview models may have limited availability based on subscription
- Capabilities: Check for required features (vision, function calling, streaming)
- Category tags: Use
powerfulfor complex tasks,versatilefor general use,fastfor quick iterations
Setting Defaults vs Per-Command
Per-command (recommended for testing):
- Use when trying new models
- Allows fallback if model fails
- Keeps project config stable
Project default (use after validation):
- Set in
.opencode/opencode.jsononly after confirming model stability - Avoids repeating
--modelflag on every command - Risk: breaks workflow if model becomes unavailable
Anti-Patterns
NEVER hardcode model IDs without verifying availability first
WHY: GitHub Copilot model availability varies by subscription tier and region; a hardcoded ID that worked for one teammate can fail silently for another, or fail for everyone after a policy change.
❌ BAD:
{ "defaultModel": "gpt-5.2-codex" }
set without ever checking whether the account actually has access.
✅ GOOD:
scripts/fetch-models.sh --json | jq -r '.data[].id' # confirm it's in the list first
Consequence: The failure mode is silent until runtime — the config parses fine, and the error only surfaces as an opaque “model unavailable” when a job actually tries to use it.
NEVER rely on OpenCode’s model registry alone
WHY: OpenCode’s registry is a snapshot baked in at release time; it does not track live per-account policy changes.
❌ BAD:
opencode models # trusts a potentially stale bundled list
✅ GOOD:
scripts/fetch-models.sh --json # queries the live GitHub Copilot API
Consequence: A model shown as available in opencode models can already be disabled on the account, and a genuinely new model can be invisible to OpenCode entirely.
NEVER ignore policy.state when selecting a model
WHY: models with "disabled" or "preview" state can appear in the listing yet still reject requests at runtime.
❌ BAD:
jq '.data[0].id' # takes the first model with no state check
✅ GOOD:
jq '.data[] | select(.policy.state == "enabled")'
Consequence: Scripts and configs built on an unfiltered list intermittently fail whenever the selected model happens to be preview- or disabled-gated for that account.
NEVER assume context window size from a model’s name
WHY: model names don’t reliably encode context limits — a “3.5” in a name is a version number, not a token count, and vendors change limits between releases without renaming the model.
❌ BAD: guessing “this sounds like a big model” from the name alone.
✅ GOOD:
jq '.data[] | {id, context: .capabilities.limits.max_context_window_tokens}'
Consequence: A pipeline sized for the wrong context window either truncates input silently or rejects requests that should have fit.
NEVER treat a preview model as production-safe
WHY: preview access is provisional and can be restricted or withdrawn without the standard deprecation notice a stable model would get, and preview models must always be cross-checked against policy.state before being wired into anything unattended.
❌ BAD: setting a preview-tagged model as a CI pipeline’s defaultModel.
✅ GOOD: use preview models for manual, interactive testing only, and require policy.state == "enabled" (not "preview") before a model is eligible for unattended use.
Consequence: A CI pipeline built on a preview model can start failing overnight with no corresponding code change, because the provider — not the user — changed the model’s availability.
Troubleshooting
Common issues (root causes and detailed diagnosis in references/troubleshooting.md):
- “Provider not found” — target the correct provider explicitly
- 401 / “Invalid token” — re-authenticate
- Models not showing up that you expect — OpenCode’s registry may be stale; query the API directly
- Model unavailable at runtime — check
policy.stateand thepreviewflag
Eval Scenarios
- Scenario 1: Model audit script for large-codebase tasks
- Scenario 2: Model recommendation report
- Scenario 3: Setting a project default model safely
- Scenario 4: Screenshot analysis pipeline — find vision models
- Scenario 5: Incident — default model stopped responding
References
| Topic | Reference | When to Use |
|---|---|---|
Raw curl/jq API query and worked example filters |
Manual Queries and Workflows | The packaged script isn’t available, or you need a custom jq filter beyond its flags |
| Root-cause diagnosis for auth, staleness, and runtime-unavailable errors | Troubleshooting | A query fails, a model that should be listed isn’t, or a previously-working model stops responding |
| Official model listing endpoint | GitHub Copilot Models API | Confirming the live response shape or endpoint behaviour directly |
Provider auth setup and auth.json format |
OpenCode Authentication Docs | Setting up or debugging GitHub Copilot authentication in OpenCode |
| Tier-based model availability | GitHub Copilot Subscription Plans | Explaining why a model is preview-gated or unavailable on a given subscription |
Explicit NEVER/WHY/consequence triplets with side-by-side bad/good examples. Generic warnings score low — concrete failure modes with real impact (security, correctness, performance) score high.
Runtime validation via eval scenarios proving the skill actually changes agent behaviour. Requires evals/ directory, instructions.json, ≥3 scenarios, and ≥80% instruction coverage in summary.json.
Appropriate rigidity for the skill type: strict rules for critical/security skills, balanced steps for process skills, flexible options for tool skills. Mismatched calibration (too rigid or too loose) reduces score.
Expert-only knowledge the AI couldn't derive on its own — domain-specific patterns, production gotchas, decision frameworks, and non-obvious tool behaviour. High scores mean <5% redundancy with what the model already knows.
A clear philosophy plus numbered step-by-step workflows with explicit entry/exit points. Should answer: what is the core principle, how to execute it, and when (and when not) to apply it.
Rich activation keywords and trigger scenarios in the description so the skill fires when needed. Best descriptions read like an exhaustive list of the tasks and concepts that should invoke this skill.
Copy-paste-ready code, complete runnable examples, real file paths and commands. Pseudocode and abstract descriptions score low — concrete, executable content scores high.
SKILL.md as a <100-line navigation hub pointing to focused references/ files. Content should be lazy-loaded on demand, not front-loaded. Includes actionable 'When to Use' conditions per reference.
Proper frontmatter, single-task focus, activation keywords, and cross-harness portability. Skills must work across 40+ agentic harnesses without hardcoded paths or agent-specific references.
Expert-only knowledge the AI couldn't derive on its own — domain-specific patterns, production gotchas, decision frameworks, and non-obvious tool behaviour. High scores mean <5% redundancy with what the model already knows.
A clear philosophy plus numbered step-by-step workflows with explicit entry/exit points. Should answer: what is the core principle, how to execute it, and when (and when not) to apply it.
Explicit NEVER/WHY/consequence triplets with side-by-side bad/good examples. Generic warnings score low — concrete failure modes with real impact (security, correctness, performance) score high.
Proper frontmatter, single-task focus, activation keywords, and cross-harness portability. Skills must work across 40+ agentic harnesses without hardcoded paths or agent-specific references.
SKILL.md as a <100-line navigation hub pointing to focused references/ files. Content should be lazy-loaded on demand, not front-loaded. Includes actionable 'When to Use' conditions per reference.
Appropriate rigidity for the skill type: strict rules for critical/security skills, balanced steps for process skills, flexible options for tool skills. Mismatched calibration (too rigid or too loose) reduces score.
Rich activation keywords and trigger scenarios in the description so the skill fires when needed. Best descriptions read like an exhaustive list of the tasks and concepts that should invoke this skill.
Copy-paste-ready code, complete runnable examples, real file paths and commands. Pseudocode and abstract descriptions score low — concrete, executable content scores high.
Expert-only knowledge the AI couldn't derive on its own — domain-specific patterns, production gotchas, decision frameworks, and non-obvious tool behaviour. High scores mean <5% redundancy with what the model already knows.
A clear philosophy plus numbered step-by-step workflows with explicit entry/exit points. Should answer: what is the core principle, how to execute it, and when (and when not) to apply it.
Explicit NEVER/WHY/consequence triplets with side-by-side bad/good examples. Generic warnings score low — concrete failure modes with real impact (security, correctness, performance) score high.
Proper frontmatter, single-task focus, activation keywords, and cross-harness portability. Skills must work across 40+ agentic harnesses without hardcoded paths or agent-specific references.
SKILL.md as a <100-line navigation hub pointing to focused references/ files. Content should be lazy-loaded on demand, not front-loaded. Includes actionable 'When to Use' conditions per reference.
Appropriate rigidity for the skill type: strict rules for critical/security skills, balanced steps for process skills, flexible options for tool skills. Mismatched calibration (too rigid or too loose) reduces score.
Rich activation keywords and trigger scenarios in the description so the skill fires when needed. Best descriptions read like an exhaustive list of the tasks and concepts that should invoke this skill.
Copy-paste-ready code, complete runnable examples, real file paths and commands. Pseudocode and abstract descriptions score low — concrete, executable content scores high.
No eval scenarios available.
Manual API Queries and Example Workflows
Load this reference when the packaged scripts/fetch-models.sh script isn’t available in the current environment, or when composing a custom jq filter beyond what the script’s flags expose.
Manual API Query (no script)
# Get auth token from OpenCode config
AUTH_TOKEN=$(jq -r '.["github-copilot"].access' ~/.local/share/opencode/auth.json)
# Query GitHub Copilot API directly
curl -s -H "Authorization: Bearer $AUTH_TOKEN" \
"https://api.githubcopilot.com/models" | jq .
This is exactly what scripts/fetch-models.sh does internally — reach for the script first; use this only when the script isn’t present or you need a one-off jq expression the script’s flags don’t cover.
Example Workflows
Find best model for large-codebase analysis
# Find models with 200K+ context
scripts/fetch-models.sh --json | jq '.data[] | select(.capabilities.limits.max_context_window_tokens > 200000) | {id, context: .capabilities.limits.max_context_window_tokens}'
Find models with vision for screenshot analysis
scripts/fetch-models.sh --vision
Compare all models from one vendor
scripts/fetch-models.sh --vendor Anthropic
Get model IDs for scripting
scripts/fetch-models.sh --json | jq -r '.data[].id'
Build an allow-list of production-safe models
Combine the policy.state and context-window checks into one filter, since neither alone is sufficient for a pipeline that must not break overnight:
scripts/fetch-models.sh --json | jq '
.data[]
| select(.policy.state == "enabled")
| select(.capabilities.limits.max_context_window_tokens >= 100000)
| .id
'
Troubleshooting GitHub Copilot Model Access
“Provider not found”
The provider name OpenCode expects doesn’t match what’s configured. Target it explicitly:
opencode models github-copilot
If this still fails, the GitHub Copilot provider itself may not be configured in this OpenCode installation — check opencode auth list for github-copilot in the output before assuming a model-specific problem.
401 / “Invalid token”
The cached auth token has expired or been revoked. Re-authenticate:
opencode auth add github-copilot
opencode auth list # confirm the new token is present
A 401 from the models endpoint specifically (rather than from every OpenCode command) usually means the token is stale rather than missing — GitHub Copilot tokens have a shorter lifetime than the OpenCode session itself.
Models not showing up that you expect
OpenCode’s bundled registry is a release-time snapshot (see the skill’s Mindset section) — it does not reflect live account changes. Always cross-check with a direct query before concluding a model genuinely isn’t available:
scripts/fetch-models.sh --json | jq '.data[] | select(.id == "the-model-you-expect")'
An empty result here (rather than just “not shown by OpenCode”) means the account genuinely does not have that model, which is a different problem — subscription tier, region, or org policy — than a stale local registry.
Model unavailable at runtime despite being listed
Check both gating fields, since either alone can cause a runtime rejection even though the model appears in a plain listing:
scripts/fetch-models.sh --json | jq '.data[] | select(.id == "the-model-in-question") | {policy: .policy.state}'
policy.state != "enabled"(i.e."disabled"or restricted) — the model is not usable regardless of what the listing shows; pick a different"enabled"model.previewflag set — availability may depend on subscription tier and can be withdrawn without notice; treat as unsuitable for anything unattended (see the “NEVER treat apreviewmodel as production-safe” anti-pattern inSKILL.md).
Diagnosing a sudden “it worked yesterday” failure
This is almost always a policy.state change on GitHub’s side, not a local configuration regression. The fastest diagnosis:
- Re-query the model’s current
policy.statedirectly — don’t trust the last-known-good assumption. - If
disabledor newly restricted, that confirms the root cause: a provider-side policy change, not a bug in the pipeline. - Discover a replacement with the same category tags (
powerful/versatile/fast) and an"enabled"state, then validate it with a single test call before wiring it in as the new default.