How to manage API client access for LLM applications

Guide · Gateways

An API client is any application, service, script, or agent that calls an API with its own credential, and to manage API client access is to decide which clients may call which APIs, how much each may use, and how quickly any one of them can be cut off. LLM APIs add two requirements to that job: scope has to name providers and models, and limits have to count tokens and dollars as well as requests. This guide walks through the four steps (issue, scope, limit, and revoke) with the controls Google, OpenAI, and Anthropic already provide, then builds the same setup in Bifrost, an open-source AI gateway by Maxim AI. It belongs to the AI gateways and LLM routing hub.

What managing API client access means for LLM applications#

Managing API client access means controlling the life of each client's credential: issuing it, scoping what it may call, limiting how much it may use, and revoking it without disturbing other clients. For LLM applications, a client is any caller that sends model requests, such as a support bot, a batch job, a coding agent, or a developer's laptop.

Scope for LLM traffic has to name providers and models, not only endpoints, because changing one model name in a config file can move an app to a model that costs far more per token. Limits have to count tokens and dollars, because one long-context request can cost as much as many short ones.

The OWASP Top 10 for LLM applications lists runaway usage as LLM10:2025 Unbounded Consumption, and its mitigations include rate limiting, user quotas, role-based access control, and least privilege.

Client access lifecycle in four steps: issue one credential per client, scope its providers and models, limit its usage, revoke it, then rotate or re-issue. IssueOne credentialper clientScopeProviders, models,and toolsLimitRequests, tokens,and dollarsRevokeDisable, expire,or deleteRotate or re-issueAfter a leak or on a schedule
Figure 1: The client access lifecycle for LLM APIs. Every control in this guide belongs to one of these four steps.

API access management on Google, OpenAI, and Anthropic#

Most API platforms already include basic API access management: a credential type for each client, a way to narrow what that credential reaches, and a way to end its access. The table compares three platforms with an AI gateway, as each documented its controls in November 2026.

Platform Client credential How access is scoped How access ends
Google Workspace domain-wide delegation Service account or OAuth client ID OAuth scopes that a super administrator authorizes per client Delete the client; apps that depend on it stop working immediately
OpenAI API platform Project API key or service account key Project, allowed models, per-model rate limits, and a monthly spend limit Set an expiration date at creation, or revoke the key
Anthropic Claude API API key scoped to one workspace Workspace, with its own monthly spend limit and per-model rate limits Archiving the workspace archives its keys within seconds, and cannot be undone
AI gateway, such as Bifrost Gateway-issued virtual key Providers, models, provider keys, budgets, and rate limits per key Disable, expire, rotate, or delete the key, with no change to provider keys

Google Workspace is where many searches for this phrase start. Its domain-wide delegation page, under Security > Access and data control > API controls, lets a super administrator authorize a client ID for a set of OAuth scopes. Google asks admins to keep those scopes narrow and to delete clients that are no longer in use.

OpenAI projects carry their own API keys and service accounts, a list of allowed models, per-model rate limits, and a monthly spend limit that can be enforced as a hard limit. Anthropic workspaces scope API keys to one workspace, with spend and rate limits that can sit below the organization's limits but never above them.

Each console can manage API client access for one provider only, so a team that calls both manages two sets of keys, limits, and offboarding steps. An AI gateway in front of every provider replaces them with one credential per client and one place to change policy, as the explainer on what an AI gateway is describes.

Step 1: API key management starts with one credential per client#

Good API key management gives each client its own credential and keeps every provider key on a server the client cannot read. A dedicated credential lets a team attribute usage to one app and cut that app off without rotating a key other services share. A shared key allows neither: one leak or one departure forces a rotation everywhere.

OpenAI's API key safety guidance recommends a unique key for each team member, keys created with an expiration date, a regular rotation process, and never deploying a key in a browser or mobile app. Anything that runs on a user's device therefore needs a server in the middle: the app authenticates its user to a backend, and the backend, or a gateway behind it, holds the credential that reaches the model.

Record ownership on the day a credential is issued. One credential per app per environment suits most teams, tagged with an owner, an environment, and a cost center, because rotation, audits, and offboarding all start from knowing who owns a key.

For CI pipelines and cloud workloads, prefer short-lived platform identity tokens, such as GitHub Actions OIDC or AWS STS tokens, over keys stored on a build runner.

Step 2: scope each client to the providers and models it needs#

Scoping a client means listing what it may call and denying everything else. LLM access control has three parts: which providers a client can reach, which models it can use on each, and which environment it runs in. Agents add a fourth, the tools they may call, because a tool call can read data or take actions.

  • Providers: a bot built on one provider should hold no credential that reaches another.
  • Models: allow the models the app was tested against, so a config change cannot move it to a pricier or untested model.
  • Environments: issue separate credentials for development, staging, and production, with lower limits outside production.
  • Tools: allow only the MCP servers and tools an agent's task needs, enforced at an MCP gateway or the server; the MCP security guide covers tool-level authorization.

Deny by default is the rule that matters most in LLM access control. A credential scoped to everything today gains every model added tomorrow, including more expensive ones. An allowlist that fails closed turns configuration mistakes into visible errors instead of unexpected invoices.

Step 3: cap requests, tokens, and spend for every client#

Every client needs three limits: a request rate, a token rate, and a dollar budget. Each one catches a failure the other two miss. Set them at more than one level (per client, per team, and for the whole organization) so that a runaway loop in one app cannot exhaust a budget that other teams depend on.

Limit What it catches What it misses
Requests per minute Retry storms and tight loops that send many small calls A few very long prompts that stay under the request count
Tokens per minute or hour Long contexts, large documents, and agents whose context grows each turn A switch to a model with a higher price per token
Dollar budget per period Any change that raises cost, including a move to a pricier model Short bursts that hit a provider's rate limit before spend moves

Give clients errors they can act on. A client that hits a rate limit should back off and retry, while a client that exhausts its budget should stop and alert its owner, because retrying will not help. Rate limits usually return HTTP 429 while budget errors vary by platform, so clients should branch on the returned error type.

Check how hard each limit is before relying on it. OpenAI's project settings distinguish spend alerts, which never stop requests, from an enforced hard limit, and note that enforcement is not instantaneous, so recorded spend can slightly exceed the configured amount.

Step 4: revoke access so the next request fails#

Revocation works only if the client's next request fails. Any delay between the decision to revoke and the credential stopping leaves a window in which a leaked key or a departed contractor can keep spending. Plan for three tools: disable a credential that may come back, expire temporary access, and delete what is no longer needed.

  1. Disable a credential when access may be restored. It stays on record for audits.
  2. Expire access for pilots, demos, and contractors, so it ends without anyone remembering to act.
  3. Delete the credential when its history is no longer needed.

Rotate on a schedule and after any suspected leak, with a short overlap so clients can move to the new value.

Token lifetimes decide how fast revocation lands. RFC 7009, the OAuth token revocation standard, notes that revoking a self-contained access token at once needs non-standard coordination between the authorization server and the API, and suggests short-lived tokens to cap how long a revoked one stays usable. It also acknowledges propagation delays, in which some servers learn of a revocation before others.

People's access should follow the identity provider, so that deprovisioning someone removes their model access in the same step. Test the whole path before an incident: disable a staging credential and confirm the next call fails with the error the application expects.

How to manage API client access in Bifrost#

Bifrost implements all four steps with virtual keys, which are gateway credentials with an sk-bf- prefix that clients send in place of a provider key. Each virtual key carries its own provider and model allowlist, budgets, rate limits, and active status. Bifrost holds the provider keys and calls each provider on the client's behalf, so clients never see them.

The virtual key glossary entry covers the general concept. In Bifrost, virtual keys with budgets and rate limits are part of the open-source core, while access profiles, SCIM sync, workload identity, and signed audit logs are Enterprise features, as the Bifrost governance overview shows.

A client sends its virtual key to Bifrost, which checks scope, limits, and budgets, refuses failures, or calls the provider with a key the client never sees. Client appHolds sk-bf- keyBifrostHolds provider keysModel providerOpenAI and others1request with virtual key2check scope, limits, budgets3401, 402, 403, or 4294request with provider key5response and token usage6response, cost recorded
Figure 2: A request through Bifrost. The client holds only a virtual key, and Bifrost refuses the call with 401, 402, 403, or 429 when a check fails.

Issue virtual keys per app and environment#

Create one virtual key per app and environment in the dashboard or through the governance API, which takes an admin token rather than a virtual key. This example gives a production support bot one OpenAI model, a 200-dollar monthly budget, and token and request limits, tagged with an owner and a cost center:

curl -X POST http://localhost:8080/api/governance/virtual-keys \
  -H "Authorization: Bearer $BIFROST_ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "support-bot-prod",
    "description": "Customer support assistant, production",
    "team_id": "team-support",
    "metadata": { "owner": "support-platform", "env": "prod", "cost_center": "cc-1234" },
    "provider_configs": [
      { "provider": "openai", "allowed_models": ["gpt-4o-mini"], "key_ids": ["*"] }
    ],
    "budgets": [ { "max_limit": 200.00, "reset_duration": "1M" } ],
    "rate_limit": {
      "token_max_limit": 50000, "token_reset_duration": "1h",
      "request_max_limit": 100, "request_reset_duration": "1m"
    },
    "is_active": true
  }'

A key has at most one owner: team_id and customer_id are mutually exclusive, and Enterprise adds business units and users. Each request copies the key's metadata into its log entry, so spend can be filtered by owner, environment, or cost center. Clients send the key in whichever header their SDK already uses: x-bf-vk, Authorization: Bearer, x-api-key, x-goog-api-key, or api-key.

Then make keys mandatory. With client.enforce_auth_on_inference on (Settings > Security in the dashboard), a request without a valid key is rejected with 401 and virtual_key_required; with it off, a request that carries no credential passes without governance checks. The security hardening checklist treats this switch as required for production and notes that callers cannot inject their own provider keys through headers.

Scope the key with provider_configs#

provider_configs is the key's allowlist, and provider access is deny-by-default: a provider without an entry is blocked, and an empty list blocks every provider. Each entry names a provider, its allowed_models, and the key_ids of the provider keys the client may use. ["*"] allows all of that provider's keys, while an empty or missing key_ids denies them all, so a half-finished entry fails closed.

Model lists accept exact names or regex: patterns, and blacklisted_models wins over allowed_models. Setting allow_all_providers opens every configured provider, including ones added later. A call outside the scope fails with 403 and provider_blocked or model_blocked, and GET /v1/models with the key lists only the providers it can reach. For CI pipelines and internal services, the hardening guide recommends one provider config, one model alias, and one budget envelope per virtual key.

Set budgets and rate limits on the key#

budgets caps dollars per period, and rate_limit caps tokens and requests per window. Reset durations run from 1m to 1Y, the quarterly 1Q applies to budgets only, and calendar_aligned resets an owner's budgets and counters at UTC calendar boundaries instead of on a rolling window.

Budgets stack across the hierarchy. Bifrost checks every applicable budget (provider config, virtual key, team, and customer), lets a request through only if all of them have room, and deducts its cost from each one. Rate limits are checked at the same levels. A request over budget fails with 402 and budget_exceeded, and one over a rate limit fails with 429 and rate_limited, token_limited, or request_limited, so a client can tell "stop" from "slow down" by the error type.

When a team needs headroom for a launch, add a budget override instead of editing the base budget: send PUT /api/governance/virtual-keys/{vk_id}/budgets/{budget_id}/override with an amount and a mode of cycles (which clears itself once its windows close) or forever.

Map identity provider groups to access profiles#

In Bifrost Enterprise, people get model access from the identity provider instead of from hand-issued keys. An access profile is a reusable policy covering allowed providers and models, budgets, rate limits, and MCP tools, applied to a user, a role, a team, a business unit, or a customer.

Under Governance > User Provisioning, mapping rules turn IdP claims or SCIM attributes into roles, teams, business units, and access profiles, with setup guides for Okta, Microsoft Entra, Google Workspace, and other OIDC providers. A user who receives a profile gets their own copy of its budget and rate-limit counters, plus a virtual key if they have none. That key is locked to its profile, so nobody can loosen their own policy by editing it. Bifrost has no default role, so a sign-in that resolves to no role is refused.

Services follow the same model through workload identity: a CI pipeline, Lambda function, or Kubernetes pod presents a short-lived token from its own platform and runs as a service account whose access profile sets its models, budget, and limits, with no stored virtual key.

The Bifrost Gateway is the control plane for all of these policies. Bifrost Edge extends the same governance and security controls, including virtual keys, budgets, guardrails, and audit logs, to the AI apps and coding agents on employee machines, with enforcement on each device.

Disable, expire, rotate, or delete a key#

Bifrost maps each revocation tool from Step 4 to one field or call on the virtual key:

  1. Disable: send PUT /api/governance/virtual-keys/{vk_id} with "is_active": false. Requests fail with 403 and access_blocked ("virtual key is inactive") until the field is set back to true.
  2. Expire: set expires_at to a future RFC 3339 timestamp. Once it passes, Bifrost blocks both LLM inference and MCP tool execution for the key. The key stays visible for audits unless daily cleanup of expired keys is on, per key (delete_after_expire) or for the workspace.
  3. Rotate: POST /api/governance/virtual-keys/{vk_id}/rotate issues a new value and keeps the key's budgets, limits, and assignments. With client.vk_rotation_cooldown set, the old value works until the cooldown ends; without it, the old value stops at once.
  4. Delete: send DELETE /api/governance/virtual-keys/{vk_id}.

In an Enterprise cluster, peer nodes pick up a rotation asynchronously, so wait for convergence before treating the old value as dead everywhere. For people, offboarding runs through the IdP: when SCIM deactivates or deletes a user, Bifrost removes their virtual keys and access profiles, team memberships, and sessions.

Enterprise audit logs record virtual_key.created, virtual_key.updated, virtual_key.rotated, and virtual_key.deleted events and sign each row with HMAC-SHA256 so entries can be verified later. Because clients never held the provider key, revoking one client never requires rotating the provider key that other clients depend on.

Common API access control mistakes with LLM clients#

Most API access control failures with LLM clients come from shortcuts taken early: shared keys, provider keys on devices, spend alerts in place of caps, and offboarding by hand. Each one is cheap to avoid when a client is onboarded and expensive to fix after a leak or an unexpected invoice.

  • One key for many apps: usage cannot be attributed, and revoking the key breaks every app that shares it. Per-client credentials also make LLM observability data attributable to a caller.
  • Provider keys in clients: browser bundles, mobile apps, and shared notebooks expose a key to anyone who opens them.
  • Alerts instead of caps: a spend alert reports an overrun, and only an enforced budget stops one.
  • Offboarding by hand: keys issued outside the IdP outlive the person who requested them.

A checklist for onboarding a new LLM client#

Run the same checklist each time a new app, agent, or team asks for model access. It gives every credential an owner, a scope, limits, and a tested way to shut it off. The steps apply whether the credential is a project key, a workspace key, or a gateway virtual key.

  1. Record the client's name, owner, environment, and cost center.
  2. Issue a dedicated credential, never the raw provider key.
  3. Allow only the providers, models, and tools the client was tested with.
  4. Set a request limit, a token limit, and a monthly budget below the team's cap.
  5. Add an expiry date if the access is temporary.
  6. Grant people access through the identity provider, so offboarding removes their keys.
  7. Disable the credential once in staging and confirm the next request fails with the error the application expects.

Teams that manage API client access across several providers usually move these steps into a gateway. The AI gateways directory lists open-source and managed options, the LiteLLM alternatives roundup compares nine of them, and the Bifrost vs LiteLLM comparison covers two in depth.

Teams evaluating Bifrost for virtual keys and access profiles can request a Bifrost demo or review the Bifrost governance resources, which cover budgets, rate limits, and role-based access across both tiers.

Frequently asked questions

What is an API client?

An API client is any application, service, script, or agent that sends requests to an API with a credential the API can identify. For LLM APIs, clients include chat assistants, batch jobs, coding agents, internal tools, and CI pipelines. Giving each client its own credential is what makes it possible to scope, limit, attribute, and revoke its access without affecting any other client.

What is API access?

API access is permission for a program to call a service's API, usually granted through an API key, an OAuth token, or a service account credential. The service uses the credential to identify the caller and to decide what it may reach, such as which endpoints, data, or models, and how many requests or tokens it may use in a period.

Where is Manage API client access in the Google Admin console?

Google Workspace handles API client access through domain-wide delegation, under Menu > Security > Access and data control > API controls > Manage Domain Wide Delegation. A super administrator adds a service account or OAuth client ID and the OAuth scopes it may use. A June 2020 Admin console update moved this page from Security > Advanced settings to the API controls section.

How do I revoke an API key if it's compromised?

Disable or delete the key first, so its next request fails, then issue a replacement and move legitimate clients to it. Check usage logs for calls made with the leaked key, and confirm the revocation has reached every server or gateway node. If the leaked credential was a raw provider key, rotate it at the provider; a gateway virtual key can be revoked without touching provider keys.

What is a virtual key?

A virtual key is a credential issued by an AI gateway that maps a caller to its allowed providers and models, budgets, and rate limits, while the gateway keeps the real provider keys. Clients send the virtual key instead of a provider key, so a platform team can scope, cap, rotate, or revoke one client's access without rotating credentials that other clients share.

How do you limit LLM API usage per team?

Give each team its own credential and attach a token limit, a request limit, and a monthly budget to it. OpenAI projects and Anthropic workspaces support spend and rate limits per project or workspace. An AI gateway such as Bifrost adds budgets at the key, team, and customer levels and lets a request through only when every applicable budget still has room.

Terms in this guide

Cite this guide

The AI Engineering Editors. "How to manage API client access for LLM applications." The AI Engineering, updated Nov 23, 2026. https://theaiengineering.com/articles/manage-api-client-access

Title
How to manage API client access for LLM applications
Author
The AI Engineering Editors
Publisher
The AI Engineering
Published
Updated
View as Markdown

The AI Engineering Editors ·