Getting "PermissionDeniedError: 403 No access to model: openai/o4-mini #169710
Replies: 6 comments 6 replies
-
That PermissionDeniedError: 403 No access to model: openai/o4-mini means your token/permissions or model access settings don’t allow sampling that model. Common causes and how to fix them: Wrong API / endpoint / token type — if you’re trying to call GitHub Models you must call the GitHub Models endpoint (https://models.github.ai/...) and authenticate with a GitHub PAT that has the models scope. If you instead call the OpenAI endpoint with a GitHub PAT (or vice versa) you’ll get 403s. See the GitHub Models quickstart for the correct curl example. PAT scope / fine-grained token permissions — verify your PAT includes the models scope (or models:read for fine-grained tokens). Create a new PAT with the right scope and try again. Model not enabled for your account / org / plan — o4-mini may require you to enable that model in your Copilot/GitHub settings or be on a plan that exposes the model. For personal use you may be prompted to “Allow” a model the first time you pick it; for org/enterprise the administrator must enable the model in Copilot policies. Ask your org admin to enable o4-mini if you’re in an organization. Plan / usage restrictions — some models are gated to particular Copilot plans or usage tiers. Confirm your account/plan includes o4-mini access. If you hit a rate/usage limit the API might refuse sampling. If everything looks correct — debug steps: (a) regenerate a new PAT with models scope and test a minimal curl (below); (b) call a simple listing or a known working model (e.g., openai/gpt-4.1) to confirm auth; (c) capture the full 403 response body (it often contains a reason like “model not enabled for org”); (d) if org-managed, ask your org admin or open a GitHub support ticket with the error + request. Minimal curl test (copy/paste and replace YOUR_GITHUB_PAT) bash TL;DR — check (A) you’re using the GitHub Models endpoint, (B) your PAT has models scope, and (C) the model is enabled for your account/org/plan. If all three are correct and you still get 403, capture the response body and contact GitHub support or your org admin. |
Beta Was this translation helpful? Give feedback.
-
Hello sathwik-3721, The
If you’ve checked all the above and the issue persists, please share more details about your code and how you’re attempting to access the model. This will help in diagnosing the problem further. Let me know if you need additional assistance! |
Beta Was this translation helpful? Give feedback.
-
A PermissionDeniedError: 403 No access to model: openai/o4-mini means your token is valid but the account or token you’re using does not have permission to use that specific model on GitHub Models. A few things to check: Model availability Not all models on GitHub Models are publicly accessible — some require you to be in a beta program or have been granted access to the publisher’s model. openai/o4-mini might be in limited preview. You’ll need to confirm it’s listed as “available” in your GitHub Models dashboard. Personal Access Token (PAT) scope For GitHub Models API, the token must have the read:models scope. Create or update your token in Settings → Developer settings → Personal access tokens and make sure you select the correct scope. Correct endpoint and authentication import requests headers = { url = "https://api.github.com/models/openai/o4-mini/infer" response = requests.post(url, headers=headers, json=data) Make sure your endpoint matches the model’s documentation. Account type If you’re using a work account, your org admin might need to enable access to external models. Test from GitHub Codespaces If it works in Codespaces but not locally, the issue might be firewall/proxy restrictions or local token environment variable setup. In short: Check if openai/o4-mini is available to your account. Ensure your PAT has read:models scope. Verify you’re calling the correct endpoint with proper headers. If you confirm all of the above and still get a 403, you’ll need to contact GitHub Support to check your account’s model access. |
Beta Was this translation helpful? Give feedback.
-
I am trying to use
|
Beta Was this translation helpful? Give feedback.
-
GitHub Actions Workflow for AI InferenceThis workflow runs an AI inference job using the name: AI Inference Workflow
on:
workflow_dispatch:
jobs:
inference:
runs-on: ubuntu-latest
permissions:
contents: read
models: read
steps:
- uses: actions/checkout@v5
- uses: actions/ai-inference@v1
with:
prompt: "Hi"
model: "anthropic/claude-3-5-sonnet-latest"
enable-github-mcp: false
token: ${{ github.token }}
github-mcp-token: ${{ secrets.MCP_**_TOKEN }} |
Beta Was this translation helpful? Give feedback.
-
My PAT worked for personal use but when I created a PAT owned by my org (so I could use their billing) it stopped working. After a lot of searching I realised the endpoint is different for orgs, i.e. It would be great to have this called out more explicitly in the guides. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Body
Hey all!!
I have been trying to access GitHub models through code, I have created my GitHub PAT and accessing the models. But while accessing them through code in my machine, Getting this error
Getting "PermissionDeniedError: 403 No access to model: openai/o4-mini while accessing GitHub Models via code through my machine
Could any one please help me out in solving this issue.
Thanks in advance!!
Beta Was this translation helpful? Give feedback.
All reactions