OpenAI Project API Keys: Per-Project Permissions and Limits (2026)

Blog / Developer tools

OpenAI Project API Keys: Per-Project Permissions and Limits (2026)

An OpenAI project API key belongs to a single project, not to the whole organization. If you create one project per application and per environment, each with its own key, you can manage permissions, model access and limits separately, and a leaked key only affects that one project. This article covers how to split projects, create keys, and check the result, in order.

Console menu names and options change over time. This article describes the approach and the general steps; for exact UI details, follow OpenAI's official documentation.

Why shouldn't everyone share one key?

Sharing a single key causes three common problems:

  • Usage is mixed together, so you can't tell which application spent the money.
  • If the key leaks, the only option is to revoke it, and every service that depends on it goes down at once.
  • When someone leaves or changes roles, you can't take back just that person's access.

Projects split the resources under an organization into separate units. A member who joins a project can only create and use keys inside that project, and usage and limits are tracked and set per project.

How do projects, members and keys relate?

  • Organization: the top-level unit for billing and administration.
  • Project: an isolated unit under the organization, with its own members, keys, model access and limits.
  • Key: either a user key tied to an individual (the older approach) or a project key that belongs to a project. For new keys, use project keys; for how user keys are handled, check the official documentation.
  • Service account: a machine identity not tied to a person, meant for servers and CI. Its key doesn't depend on any particular member; for exact behavior, check the official documentation.

How do you split by project? Six steps

  1. Plan the projects first. Splitting by "application x environment" works well, for example chatbot-prod, chatbot-dev and batch-eval. These names are only examples.
  2. Create the projects. Create them in the project management section of the Platform console. Don't put secrets or customer information in project names.
  3. Add members and assign roles. Add only the people who need access to each project. The available project roles are described in the official documentation; the principle is to give most people the lowest permissions and keep admins to a few.
  4. Create separate keys for people and for services. Developers debugging use their own project key; anything deployed to a server uses a service account key. Don't put a personal key in production config.
  5. Restrict the key's permissions. When creating a key you can usually choose all permissions, restricted permissions or read-only; the exact options depend on the official documentation and the console. For a restricted key, check only the endpoints you use and leave the rest off. A read-only key suits scripts that only view resources.
  6. Set model access and a budget. In the project settings, limit which models are available and set a budget or usage alert. Whether a budget is just a notification or a hard cap depends on the official documentation, so don't assume it will automatically stop requests.

Service account key or personal key?

ScenarioRecommendationWhy
Local debuggingA project key you create yourself inside the projectProblems can be traced to a person
Production services, CIService account keyDoesn't depend on a specific member, so staff changes don't affect it
Read-only reporting scriptsKey with read-only permissionEven if it leaks, it can't call generation endpoints
Contractors or temporary teammatesA separate project, deleted when the engagement endsThey never touch the production project

How do you verify the setup?

First confirm that the key really has only the intended permissions in the project. Keep the key in an environment variable, not in code:

export OPENAI_API_KEY="sk-proj-你的项目密钥"
curl https://api.openai.com/v1/models \
  -H "Authorization: Bearer $OPENAI_API_KEY"

Checklist:

  • Send a request to a restricted model and confirm it is rejected; the exact error code and message are described in the official documentation.
  • Call an endpoint outside the permissions of a restricted or read-only key and confirm it is rejected.
  • Check that the console's usage page shows the request you just made under the right project.
  • Make sure development and production keys are not mixed.

If a request times out instead of returning a permission error, first check cdnping's OpenAI status page and the is it down page to see whether it's a server-side problem, then go back to checking the key.

How do you rotate and retire keys?

What if you have no ChatGPT account or overseas payment method?

If your goal is to use large models in tools like Codex or Claude Code, rather than to manage an OpenAI organization yourself, you could consider an aggregation gateway. AGI Plan is a multi-provider LLM gateway: one subscription maps to several capability groups, you pay in RMB, no overseas credit card is needed, and Claude Code and Codex only need the endpoint address changed in one place. The site states that it is not an officially authorized channel and that some models are available only outside mainland China; see the models page for the current list. AGI Plan is a commercial partner of cdnping; for the first steps, see the AGI Plan quick start.

For how to connect Codex specifically, see Can you use Codex without a ChatGPT account: connect with an API key and a custom provider.

One point worth stressing: accounts and keys should comply with the provider's terms of use and local regulations. If an account is restricted, use only the official support and appeal channels.

Next steps

  1. List your existing applications and environments, and create projects by "application x environment".
  2. Create a service account key for each production service, and remove the old shared key written into code.
  3. Open the usage page and confirm each project's requests show up separately.
  4. Check the official documentation to confirm exactly how model access and budgets behave.

Related articles

Keep reading