This setup routes a local Claude Code session through OMP's Anthropic-compatible gateway, then uses the GitHub Copilot credential already stored by OMP.
Claude Code
|
| POST /v1/messages
v
OMP auth-gateway :4000 -----------------> GitHub Copilot -> selected model
|
| credential lookup and refresh
v
OMP auth-broker :8765
The broker does not carry inference traffic. It stores, resolves, and refreshes credentials. The gateway receives Claude Code requests, obtains the appropriate credential from the broker, and calls the selected provider.
- This applies to the local Claude Code CLI. It does not route claude.ai, the web app, or mobile apps.
- Sonnet through GitHub Copilot is the lower-risk first test because the client and final model both use Anthropic semantics.
- GPT through GitHub Copilot is experimental. OMP translates the Anthropic Messages request into the provider protocol and translates the response back. Anthropic does not guarantee Claude Code compatibility with non-Claude models.
- GitHub Copilot entitlement, quota, and organization policies still apply.
- Keep both services on
127.0.0.1. Do not expose them publicly.
- OMP already works with your GitHub Copilot account.
omp auth-broker --helpandomp auth-gateway --helpboth work.- Claude Code 2.1.257 or newer is installed. Check with:
claude --versionUpdate Claude Code if needed:
claude updateRun the broker and gateway as the same operating-system user and with the same OMP configuration directory used by your normal OMP installation. That is how the broker finds the existing GitHub Copilot credential.
No OMP config file change is required for this trial. The commands below use a terminal-scoped environment variable instead.
Open terminal 1.
omp auth-broker serve --bind=127.0.0.1:8765omp auth-broker serve --bind=127.0.0.1:8765Leave this terminal running.
The broker uses the GitHub Copilot OAuth credential already stored by OMP. You do not need to copy that credential into Claude Code.
If OMP is not yet logged into GitHub Copilot, stop here and run:
omp auth-broker login github-copilotThe command is the same in PowerShell.
Open terminal 2.
export OMP_AUTH_BROKER_URL="http://127.0.0.1:8765"
omp auth-gateway serve --bind=127.0.0.1:4000$env:OMP_AUTH_BROKER_URL = "http://127.0.0.1:8765"
omp auth-gateway serve --bind=127.0.0.1:4000Leave this terminal running. The gateway should print a listening URL and the path of its bearer-token file.
Do not use --no-auth. When both services run under the same user and OMP configuration directory, the gateway resolves the broker token automatically. You do not need to set OMP_AUTH_BROKER_TOKEN.
Open terminal 3.
GATEWAY_URL="http://127.0.0.1:4000"
GATEWAY_TOKEN="$(omp auth-gateway token)"
curl -fsS "$GATEWAY_URL/v1/models" \
-H "Authorization: Bearer $GATEWAY_TOKEN" \
| jq -r '
.data[]
| select(.owned_by == "github-copilot")
| select(.id | test("claude-sonnet|gpt-5"))
| [.id, .display_name, .api]
| @tsv
'jq is only used to format the response. On macOS, install it with brew install jq, or remove the pipe to see the raw JSON.
$gatewayUrl = "http://127.0.0.1:4000"
$gatewayToken = (omp auth-gateway token).Trim()
$headers = @{
Authorization = "Bearer $gatewayToken"
"anthropic-version" = "2023-06-01"
}
$models = (
Invoke-RestMethod `
-Uri "$gatewayUrl/v1/models" `
-Headers $headers
).data
$models |
Where-Object {
$_.owned_by -eq "github-copilot" -and
$_.id -match "claude-sonnet|gpt-5"
} |
Sort-Object id |
Format-Table id, display_name, apiUse the complete provider-qualified ID, such as:
github-copilot/claude-sonnet-4.6
github-copilot/gpt-5.6-sol
These are examples, not fixed recommendations. Use IDs returned by your running gateway.
A model appearing in /v1/models means OMP knows how to route it. It does not prove that your GitHub Copilot account is entitled to use it. The next step checks that.
Test Sonnet first. If it works, repeat the request with a GPT model ID.
Set the exact model ID returned by /v1/models:
MODEL="github-copilot/claude-sonnet-4.6"
REQUEST_BODY="$(jq -nc --arg model "$MODEL" '{
model: $model,
max_tokens: 32,
messages: [
{role: "user", content: "Reply with exactly: OK"}
]
}')"
curl -sS \
-w '\nHTTP %{http_code}\n' \
"$GATEWAY_URL/v1/messages" \
-H "Authorization: Bearer $GATEWAY_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
--data "$REQUEST_BODY"Change MODEL, rebuild REQUEST_BODY, and rerun the curl command to test GPT:
MODEL="github-copilot/gpt-5.6-sol"$model = "github-copilot/claude-sonnet-4.6"
$body = @{
model = $model
max_tokens = 32
messages = @(
@{
role = "user"
content = "Reply with exactly: OK"
}
)
} | ConvertTo-Json -Depth 6
try {
$response = Invoke-RestMethod `
-Method Post `
-Uri "$gatewayUrl/v1/messages" `
-Headers $headers `
-ContentType "application/json" `
-Body $body
$response.content |
Where-Object { $_.type -eq "text" } |
ForEach-Object { $_.text }
}
catch {
$_.ErrorDetails.Message
}Change $model, rebuild $body, and rerun the request to test GPT:
$model = "github-copilot/gpt-5.6-sol"Keep only model IDs that return a real response. model_not_supported usually means the model is present in OMP's catalog but unavailable to your account or organization.
Use one Sonnet ID that passed the request above. Add a GPT ID only if its request also passed.
~/.claude/profiles/omp-github-copilot.json
Create it with:
mkdir -p "$HOME/.claude/profiles"
${EDITOR:-nano} "$HOME/.claude/profiles/omp-github-copilot.json"$HOME\.claude\profiles\omp-github-copilot.json
Create it with:
New-Item -ItemType Directory -Force "$HOME\.claude\profiles" | Out-Null
notepad "$HOME\.claude\profiles\omp-github-copilot.json"Paste this strict JSON. Replace every <SONNET_MODEL_ID> and <GPT_MODEL_ID> with IDs that passed the direct gateway test.
{
"apiKeyHelper": "omp auth-gateway token",
"model": "<SONNET_MODEL_ID>",
"availableModels": [
"<SONNET_MODEL_ID>",
"<GPT_MODEL_ID>"
],
"enforceAvailableModels": true,
"env": {
"ANTHROPIC_BASE_URL": "http://127.0.0.1:4000",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "<SONNET_MODEL_ID>",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "<SONNET_MODEL_ID>",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "<SONNET_MODEL_ID>",
"ANTHROPIC_DEFAULT_FABLE_MODEL": "<SONNET_MODEL_ID>",
"CLAUDE_CODE_SUBAGENT_MODEL": "<SONNET_MODEL_ID>",
"CLAUDE_CODE_SUBAGENT_MODEL_FORCE": "1"
},
"modelPicker": {
"options": [
{
"model": "<SONNET_MODEL_ID>",
"label": "Sonnet via GitHub Copilot",
"description": "Primary Claude Code route through OMP"
},
{
"model": "<GPT_MODEL_ID>",
"label": "GPT via GitHub Copilot",
"description": "Experimental non-Claude route through OMP"
}
],
"replaceBuiltInOptions": true
}
}If no GPT model passed the direct test, remove <GPT_MODEL_ID> from availableModels and remove its object from modelPicker.options.
This profile deliberately maps Claude Code's internal Opus, Sonnet, Haiku, Fable, and subagent choices to the tested Sonnet route. That prevents background work from selecting an unavailable model. The main session can still switch to the tested GPT entry from /model.
CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY is intentionally omitted. The profile exposes only the models you tested instead of importing the full gateway catalog.
Shell-level ANTHROPIC_* variables can override values from a settings file. Start the gateway profile without inherited Anthropic endpoint or credential variables.
env \
-u ANTHROPIC_BASE_URL \
-u ANTHROPIC_AUTH_TOKEN \
-u ANTHROPIC_API_KEY \
claude --settings "$HOME/.claude/profiles/omp-github-copilot.json"Use a dedicated PowerShell terminal:
Remove-Item Env:ANTHROPIC_BASE_URL -ErrorAction SilentlyContinue
Remove-Item Env:ANTHROPIC_AUTH_TOKEN -ErrorAction SilentlyContinue
Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
claude --settings "$HOME\.claude\profiles\omp-github-copilot.json"Inside Claude Code:
- Run
/statusand confirm that the extra settings file is listed. - Run
/model. The custom Sonnet and GPT labels should be the available choices. - Test Sonnet first with a simple prompt and a read-only tool call.
- Switch to GPT and repeat the test.
- Use the session-only model-selection action. Do not save the gateway model as the global Claude default.
The profile uses apiKeyHelper to run omp auth-gateway token. Claude Code receives only the local gateway token. It does not receive the GitHub Copilot OAuth credential or the broker token.
Exit Claude Code, then launch it normally without the profile:
claudeThe command is the same in PowerShell.
--settings and the profile's environment variables apply only to the gateway launch. A normal launch continues to use your existing Claude configuration and login.
Stop the services with Ctrl+C when finished. Stop auth-gateway first, then auth-broker.
Set OMP_AUTH_BROKER_URL in the same terminal that starts the gateway. An export in terminal 1 does not affect terminal 2.
Confirm that omp auth-gateway token prints one token with no surrounding log output. If Claude Code reports that the helper cannot find omp, use command -v omp on macOS or Get-Command omp in PowerShell, then put the resulting absolute executable path in apiKeyHelper.
The catalog and your account entitlement are different things. Try another provider-qualified model ID returned by /v1/models.
Check claude --version, then inspect /status for the effective setting sources. Organization-managed Claude Code settings can override local model restrictions.
Authentication and basic routing are working. The failing operation likely depends on Claude-specific behavior that does not translate to that GPT endpoint. Keep Sonnet as the default route.