Keep staging and production API keys separate

Give experiments and live applications clear project ownership, separate credentials and deliberate spending controls.

Reviewed 2026-11-13

Name the workloads before creating their keys

A support feature is ready for an internal trial while the existing application continues serving customers. Give the trial and live application separate projects with names your team recognises. This makes their future consumption easier to review as the feature moves from experiments into everyday use.

Choose each project before issuing its key. A key's project allocation stays fixed after creation so its historical usage remains attributable. Separate projects organise access and reporting; they do not create an independent balance for every workload or remove the paying account's permissions.

Give experiments a limited credential

Create the staging key for its intended project. Select only the models and access group the experiment needs, set an expiry and choose a key quota appropriate to the trial. Check that the paying account has sufficient balance and that its permissions allow the selected workload.

Treat the project budget as a monitoring target. Reaching that budget does not automatically block calls. The key's quota and expiry are separate controls. Review them deliberately before increasing test traffic, and avoid allowing a convenient unlimited test key to become a shared production dependency.

Make the application's environment explicit

Store each credential in a secret manager for the corresponding server environment. Keep the endpoint, concrete model ID and credential reference clear in your deployment configuration. Separate configuration helps reviewers see which project will pay for a call before the application runs.

Use synthetic or suitably authorised examples for experiments, and keep usable keys out of repositories, screenshots and support messages. If your application stores prompts or responses, decide its own logging and access rules. Project separation alone does not establish an end-to-end data-processing guarantee.

Promote the configuration deliberately

When the feature is ready, create or select a key belonging to the live project's workload. Confirm its model restrictions, quota, expiry and paying account, then place it in the production environment. Record the intended configuration so a teammate can review the change.

Promote application settings rather than moving a staging key between projects. Existing keys keep their original allocation and past usage. If the feature needs another project or client owner, issue a new key for future calls and update the relevant application configuration.

Review test and live consumption together

Select the same UTC month for both projects when reviewing requests, tokens and consumption. Compare the workload you intended with the usage actually recorded. Reports depend on retained logs, so preserve the records your team needs for longer-term reconciliation.

Look for unexpected model choices, continued staging traffic and unusually long outputs before raising limits. A consumption report supports operational review; it does not tell you whether a draft was useful or create a client invoice. Keep application quality checks alongside the API usage figures.

Keep a clear path for changes and recovery

Document how your team replaces a credential and rolls back an application configuration. If a key is exposed, revoke it and supply a replacement through your normal deployment process. Retiring access and reviewing retained historical consumption are different operational tasks.

For model routes, check approved alternatives and session behaviour before changing a live conversation workflow. Preserve the application's work when requests fail, and review retry boundaries for tools or provider-bound state. Clear project ownership and explicit configuration make those decisions easier to inspect.