KeyBark

OpenAI project model allowlist: limit which models an agent can use

An agent that is meant to run on a small model shouldn't be one config typo away from the most expensive one. OpenAI lets you limit each project to a list of models, from the dashboard, the Admin API or Terraform. Here is how each works, which mode to pick, what a blocked request looks like, and what an allowlist does not do.

Last reviewed 15 Nov 2026

The short version

  • It's per project, not per key. All keys in a project share its model list. One agent, one project.
  • Dashboard: organization settings → select the project → Limits → Model usage.
  • API: POST /v1/organization/projects/{project_id}/model_permissions with mode (allow_list or deny_list) and model_ids. GET reads it, DELETE removes it. Needs an Admin API key.
  • Terraform: the openai_project_model_permissions resource does the same.
  • Use allow_list for agents, so models released later stay off until you add them.
  • It is not a spend cap. An allowed model can still burn money; pair it with a project hard limit.
Want a heads-up before the bill does?

KeyBark checks your OpenAI, Anthropic or OpenRouter spend about every 15 minutes during the beta and emails you when it crosses a daily or monthly threshold you set, or jumps above its 7-day average. It doesn't set or enforce limits for you. Free for one key, no card.

Three ways to set it

WhereHowGood for
DashboardProject → Limits → Model usageOne or two projects, by hand
Admin APIPOST …/projects/{id}/model_permissionsScripts that create a project per agent or customer
Terraformopenai_project_model_permissionsReviewed config with drift checks

OpenAI added the model allowlist to the Admin API on 26 May 2026, together with spend alerts, data retention and hosted tool permissions (API changelog). Before that it was dashboard only.

1. In the dashboard

Per OpenAI's Managing projects help article (read 15 Nov 2026):

  1. Go to organization settings and select the project.
  2. Open Limits.
  3. Use Model usage to choose which models the project can use.
  4. Set a rate limit for each model as needed (same page).

The same page holds the project's monthly spend limit and the Enforce a hard limit switch, so set both while you're there. The Default project can't be deleted and inherits the organization's full configuration, but you can still set its model permissions, rate limits and spend limits.

2. With the Admin API

From the Modify project model permissions reference, allow only two models in one project:

curl -X POST "https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions" \
  -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode": "allow_list", "model_ids": ["gpt-5.4-mini", "gpt-4.1"]}'
  • The response is a project.model_permissions object with the mode and model_ids now in force.
  • The reference describes model_ids as the model IDs included in the policy and says nothing about merging, so send the complete list every time.
  • Each ID must be visible to your organization, including any fine-tuned model snapshot you list (Admin APIs guide).
  • Read it back with GET on the same path. DELETE removes the policy and returns project.model_permissions.deleted.
  • The Admin APIs guide shows the same call in the SDKs (client.admin.organization.projects.model_permissions.update in Python; Admin API support needs Python 2.34.0 or Node 6.36.0 or later).

An Admin API key can only call administration endpoints, not models. Keep it in the job that sets up projects, never in the agent.

3. With Terraform

OpenAI's project controls guide uses:

resource "openai_project_model_permissions" "agent" {
  project_id = "proj_123"
  mode       = "allow_list"
  model_ids  = ["gpt-5.4-mini"]
}

terraform plan -detailed-exitcode exits with 2 when someone changed the setting in the dashboard. One catch from the same guide: removing this resource from your config deletes the project's model permissions, so the project goes back to all models. (Removing the hosted-tool or data-retention resources leaves those settings in place.)

allow_list or deny_list?

  • allow_list permits only the listed models. A new, pricier model is blocked until you add it. This is the one you want for an agent with a known job.
  • deny_list permits every available model except the listed ones. New models are allowed by default, so the list goes stale on every release.

The docs don't say whether allowing an alias such as gpt-5.4-mini also allows its dated snapshots, or the reverse. If your code pins a snapshot, put that exact ID in the list and make one test request with each ID you use before you rely on it.

What a blocked request looks like

OpenAI's rate limits guide lists model_not_found as the symptom and, among the checks, asks you to review the project's model permissions and to call List models with the same key and project headers as the failed request. Developers on the OpenAI forum have posted the full error:

403 {"error": {"message": "Project `proj_...` does not have access to model `gpt-3.5-turbo-instruct`",
      "type": "invalid_request_error", "param": null, "code": "model_not_found"}}

It looks like a missing model, but the model exists; the project just isn't allowed to use it. Don't retry: fix the model name in the agent or add the model to the list.

Pair it with per-model rate limits

The allowlist says which models; project rate limits say how much per minute or per day. GET /v1/organization/projects/{id}/rate_limits lists one entry per model, and POST …/rate_limits/{rate_limit_id} changes it: max_tokens_per_1_minute, max_requests_per_1_minute, and for some models max_requests_per_1_day or batch_1_day_max_input_tokens. A low tokens-per-minute limit slows a runaway loop; it does not stop a slow, steady one.

What a model allowlist can't do

  • No per-key list. Every key in the project, including service account keys, gets the same models.
  • No spend cap. A loop on an allowed model still bills you. That needs a project hard limit: OpenAI spend limit API.
  • Hosted tools are separate. Web search, image generation, remote MCP, file search and Code Interpreter have their own project permissions (openai_project_hosted_tool_permissions). To turn one off for a single project, the organization policy must first allow that tool for selected projects only. How: OpenAI hosted tool permissions.
  • Not a leak response. A leaked key still works on every allowed model. Delete it first: OpenAI API key leaked.
  • The Admin key can undo it. Anyone with it can widen or delete the list. Treat it like a production secret.

Checklist for an agent project

  1. One project per agent, customer or environment.
  2. allow_list with only the models (and pinned snapshots) the agent calls; test each ID once.
  3. Hosted tools the agent doesn't need turned off.
  4. Per-model rate limits a little above normal traffic.
  5. A project hard spend limit, plus alerts below it.
  6. Alerts on model_not_found in your logs, and something that tells you the same day when spend jumps.

Not sure your OpenAI (and Anthropic / OpenRouter) limits would stop a leaked key or a runaway loop? The free AI key limit audit walks through them in a few minutes (no sign-up, no key needed). Related: runaway AI agent cost, OpenAI cost per API key, OpenAI spend limit not working.

Where KeyBark fits (and where it doesn't)

KeyBark covers the "tell you the same day" item. With an OpenAI Admin key you connect, it reads your organization's costs from our servers about every 15 minutes during the beta and emails you when a daily or monthly threshold you set is crossed, or when today's spend jumps above its 7-day average.

Limits, honestly: KeyBark does not set or read model permissions, rate limits or spend limits, and it watches the organization total, not each project, model or key. OpenAI's cost data comes in daily buckets and checks run on a schedule, so an alert can arrive after money has been spent. KeyBark is not a proxy and can't block a request; the project settings above are what stop traffic.

FAQ

Can I restrict which models an OpenAI API key can use?

Not per key. Model access is set per project: in the dashboard under the project's Limits → Model usage, or with the Admin API's POST /v1/organization/projects/{project_id}/model_permissions. Every key in that project gets the same model list, so give each agent its own project if it needs its own list.

Should I use allow_list or deny_list?

For agents, allow_list. It permits only the model IDs you list, so a model released later is not usable until you add it. deny_list permits every available model except the ones you list, so new models are allowed by default.

What error does a blocked model return?

OpenAI's rate limits guide groups it under model_not_found and says to check the project's model permissions. Developers on the OpenAI forum have posted the full message as HTTP 403 with code model_not_found: "Project proj_... does not have access to model ...". Treat it as a configuration error, not something to retry.

Does a model allowlist limit my OpenAI spend?

No. It only decides which models the project can call. An allowed model can still run up a large bill in a loop or through a leaked key. Pair it with a project hard spend limit, per-model rate limits and an alert that tells you when daily spend jumps.

Sources (read 15 Nov 2026): OpenAI Admin APIs guide, Model, tool, and data controls with Terraform, Help Center Managing projects in the API platform, Rate limits guide (model availability), API changelog (26 May 2026), API reference: modify, retrieve and delete project model permissions, list and modify project rate limits; error example from an OpenAI Developer Community thread. KeyBark is not affiliated with OpenAI.

Want a second line of defence?

KeyBark watches your OpenAI, Anthropic and OpenRouter spend from the server and flags a crossed threshold or spike by email and on your dashboard. Free for one key.