Skip to contentNewKimi K3.1 Pro is now availableTry it now
Docs / API keys and authentication

API keys and authentication

Create and revoke API keys, understand how they are scoped, and authenticate requests with a Bearer token.

Manage API keys

Create and revoke keys on the API keys page of the dashboard.

  1. Open API keys and choose Create key.
  2. Give the key a recognizable name.
  3. If you hold an active Inference Pass plan in the selected team, the dialog defaults to creating a plan key. Team owners and admins can switch Uses to the team's API credits option (<Team> API credits) to create a credit-billing key instead (required for async, Group, Batch, Files, gateway passthrough, and platform/MCP write routes). Other members with an active plan can create plan keys only; ask an owner or admin for a credit-billing key if you need those routes.
  4. Copy the key. The dashboard shows the plaintext key once; store it in your password manager or secret store before closing the dialog.

To revoke a key, use its action in the keys table. Requests using a revoked key stop working immediately.

Per-key spend limits

Team owners and admins can set or clear an optional USD inference spend cap on any API key via PUT /api-keys/{apiKeyId}/spend-limit, tRPC apiKey.setSpendLimit, or the MCP tool api_key_set_spend_limit (all require a Better Auth user-session token with team:update permission; header API keys and MCP OAuth project grants are not accepted):

  • Send { teamId, spendLimitUsd, window } with a minimum cap of $0.01 and window set to "day" or "month" (UTC).
  • Send null for both spendLimitUsd and window to remove the limit.
  • API key responses include spendLimitUsd and spendLimitWindow (null when uncapped).
  • Enforcement is soft: spend is read from usage rolled up approximately every 10 minutes plus several minutes of edge verdict caching, so a key can overshoot its cap by whatever it spends within that combined lag. Other keys on the team keep working.

API key spend-limit errors

When an API key's spend in its current UTC window reaches its cap, new proxy-routed synchronous and asynchronous inference requests with that key fail with HTTP 402 and error.type: "ApiKeySpendLimitExceeded". Requests succeed again when the UTC day or month resets, or after a team admin raises or clears the cap via PUT /api-keys/{apiKeyId}/spend-limit. Enforcement is soft (approximately 10 minutes of usage rollup lag plus several minutes of edge verdict caching), completed requests are always billed, and Batch API submissions are not currently gated by per-key spend limits.

The fast CLI creates its own project-scoped key, named for your machine, the first time you connect a coding agent.

Project scoping

API keys are scoped to a project. Select a team and project using the pickers at the top of the dashboard before creating a key. The key is granted read and write access to the selected project, and usage made with it is reported for that project. If no valid project selection is saved for that team in this browser, the dashboard selects its first available project. See Getting started.

Permissions

Keys created in the dashboard have read and write access to their project.

Authentication

Pass the key as a Bearer token in the Authorization header (or as x-api-key for Anthropic-compatible clients when Authorization is not set; Authorization takes precedence if both are sent), or set it as the API key in whichever SDK you use:

curl
curl https://api.inference.net/v1/chat/completions \
  -H "Authorization: Bearer $INFERENCE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.2",
    "messages": [{ "role": "user", "content": "Hello" }]
  }'

A key that bills API credits works across every endpoint:

  • Synchronous API: https://api.inference.net/v1, including the Anthropic-compatible /v1/messages endpoint
  • Asynchronous API: /v1/slow and the Group API
  • Batch API: https://batch.inference.net/v1
  • Generation results: /v1/generation/{id}
  • Webhooks: asynchronous requests that reference a webhook registered for your team

Plan keys

If you have an Inference Pass plan, a key created for the plan draws from the plan's usage allowance first (and only draws from prepaid API credits if your team enables prepaid overage and the allowance is used up). Plan keys work only on interactive requests to models included in your plan:

  • POST /v1/chat/completions, /v1/completions, /v1/embeddings, /v1/responses, and /v1/messages (plus /v1/messages/count_tokens)
  • GET /v1/models, /v1/generation/{id} (or /v1/generations/{id}), and /v1/usage

GET /v1/usage returns the plan's usage without using the allowance. It is rate-limited to 60 requests per minute per API key (exceeding the limit returns 429 with error.code usage_rate_limit and a Retry-After header) and responds with Cache-Control: private, max-age=5:

json
{
  "object": "plan_usage",
  "plan": { "plan": "pro" },
  "allowances": [
    {
      "id": "usage",
      "window": "week",
      "used_percent": 42.5,
      "status": "ok",
      "resets_at": "2026-12-01T00:00:00.000Z",
      "period_start": "2026-11-24T00:00:00.000Z"
    }
  ],
  "overage": {
    "enabled": true,
    "spent_usd": 12.5,
    "cap_usd": 100,
    "cap_used_percent": 12.5,
    "hosted_mode": "full_speed"
  },
  "alert_thresholds_percent": [80, 100],
  "in_flight": { "limit": 2, "in_use": null },
  "lane": "full_speed",
  "dashboard_url": "https://inference.net/plans"
}
  • window: week or month.
  • status: ok, warning (80% or more used), or exhausted.
  • overage: null when overage is disabled; otherwise an object with enabled, spent_usd (current UTC month), cap_usd, cap_used_percent, and hosted_mode (slow_lane or full_speed).
  • alert_thresholds_percent: the usage alert thresholds (in percent) active for the plan.
  • in_flight.limit: how many full-speed requests can run at once. in_use is always null.
  • lane: the lane a new request to an Inference.net-hosted model would get, with open requests left out: full_speed, slow, or refused (including full-speed prepaid overage when enabled, funded, and within cap). Requests already in flight can still send it to the slow lane or refuse it with concurrency_limit, and partner-served models follow their own limits.

Model responses to a plan key carry these headers. Browsers can read them (they are listed in Access-Control-Expose-Headers):

HeaderValue
x-inference-planThe plan: starter, pro, or fleet.
x-inference-plan-laneThe lane the request ran in: full_speed or slow. refused or rejected when the request did not run.
x-inference-plan-fundingHow the request was funded when admitted: pool (included plan allowance) or overage (prepaid API credits).
x-inference-plan-used-percentAllowance used this period, 0 to 100, to one decimal place.
x-inference-plan-resets-atWhen the allowance resets, as an ISO 8601 UTC timestamp.
x-inference-inflight-limitHow many full-speed requests can run at once.
x-inference-inflight-remainingFull-speed slots still free, when an in-flight count is available (can be omitted for hosted slow-lane responses and included for successful partner-served responses).
x-inference-overage-spent-usdIncluded when overage is enabled: your monthly prepaid overage spend in USD (e.g. 12.50) for the current UTC month.
x-inference-overage-cap-used-percentIncluded when overage is enabled: percentage of your monthly overage cap used (0 to 100, one decimal place).
x-inference-request-used-percentProvisional percentage of the period allowance used by this request, included on non-streaming responses when per-request usage reporting is enabled.

When per-request streaming usage reporting is enabled, final usage SSE events on streaming /v1/chat/completions, /v1/responses, and /v1/messages responses also include an additive inference_pool object:

json
{
  "inference_pool": {
    "request_used_percent": 0.4,
    "used_percent": 42.9,
    "resets_at": "2026-12-01T00:00:00.000Z"
  }
}
  • inference_pool.request_used_percent: provisional percentage of the period allowance used by this request (0 for requests funded by prepaid overage).
  • inference_pool.used_percent: provisional cumulative allowance percentage used after this request (0 to 100, one decimal place).
  • inference_pool.resets_at: when the allowance resets (ISO 8601 UTC).
  • On /v1/chat/completions, inference_pool appears on the terminal chunk (or usage-only final chunk when stream_options.include_usage: true is sent). On /v1/responses, it appears on response.completed. On /v1/messages, it appears on message_delta. Values are provisional estimates computed at the edge; authoritative settled usage is shown on GET /v1/usage and the Plan usage page.

Requests to Inference.net-hosted models run at full speed while the allowance lasts and a full-speed slot is free. Once the allowance is used up, they run in the slow lane at lower priority by default — or stay at full speed billed to prepaid API credits if your team enables overage, allows full-speed hosted overage, you choose Full speed in your overage preferences, and both cap headroom and prepaid credit balance remain. Partner-served models have no slow lane: when the allowance is used up, they continue at full speed on prepaid API credits if overage is enabled with remaining cap and credit balance, and otherwise stop with 402. Plan keys also count against your team's rate limits.

Plan key errors carry a machine-readable error.code:

Statuserror.codeRetry
402usage_limitNo while exhausted. Partner-served models only: settled usage has reached the plan's allowance or partner-model limit and prepaid overage is not enabled. error.type is usage_limit_reached, there is no Retry-After, and x-should-retry is false. Requests work again at x-inference-plan-resets-at, or once overage is enabled. Inference.net-hosted models keep running in the slow lane.
402overage_cap_reachedNo until next UTC month or cap increase (error.type is usage_limit_reached, x-should-retry is false, no Retry-After). Your monthly member overage cap or the team's monthly overage cap has been reached.
402overage_no_creditNo until prepaid credits are added (error.type is usage_limit_reached, x-should-retry is false, no Retry-After). Prepaid overage is enabled, but the team has no available prepaid credit balance.
429usage_rate_limitYes, after Retry-After. GET /v1/usage exceeded 60 requests per minute for this API key.
429concurrency_limitYes, after Retry-After. Too many requests in flight, or for partner-served models while remaining allowance is temporarily held by concurrent or recently finished unmeasured requests (for up to 60 seconds while usage settles).
429slow_lane_pausedYes, after Retry-After. Inference.net-hosted models only: the request needed the slow lane (allowance used up, full-speed slots taken, or the plan is limited to the slow lane), and the slow lane is paused.
429slow_lane_busyYes, after Retry-After. The slow lane has no spare capacity.
403plan_restrictedNo (x-should-retry is false, no Retry-After). The plan is limited to the slow lane, which partner-served models do not have; switch to an Inference.net-hosted model.
402payment_past_dueNo (x-should-retry is false, no Retry-After). Partner-served models only: the team's Inference Pass payment is past due and its grace period ended. Pay in billing settings or switch to an Inference.net-hosted model, which keeps working at reduced speed.
403plan_inactiveNo. The plan ended or is paused, or the key's plan is no longer active in the team.
403model_not_in_planNo. Your plan does not include the model.
403plan_route_not_supportedNo. The asynchronous, Group, Batch, and Files APIs. Use a key that bills API credits.
403plan_passthrough_not_supportedNo. Requests that bring your own provider credentials or route to an external provider.
403plan_feature_not_supportedNo. Auto-train requests.
404no_planNo. GET /v1/usage with a key that has no active plan.
500plan_model_mismatchNo. The request's model changed after it was admitted.

The 429 errors in this table have error.type rate_limit_error. Other 429 errors a plan key can get, such as capacity_exceeded from a busy model, keep their own type.

If the team's Inference Pass payment is past due, plan keys keep full service for a short grace period. After that, requests to partner-served models return 402 with payment_past_due (x-should-retry: false, no Retry-After), and Inference.net-hosted models keep working at reduced speed. If the payment is still not made, the plan is suspended: model requests return 403 with plan_inactive, GET /v1/usage returns 404 with no_plan, and POST /v1/messages/count_tokens still answers because it uses none of the allowance. A team owner or admin can update the payment method in the team's billing settings.

Clients built for the Anthropic API can send the key via x-api-key (ANTHROPIC_API_KEY) or as Authorization: Bearer (ANTHROPIC_AUTH_TOKEN). If both headers are sent, Authorization takes precedence for Inference auth; x-api-key is stripped on Inference.net-hosted requests, and on external-provider (BYOK) gateway requests it is forwarded unchanged unless a provider credential replaces it.

My plans

Open My plans to see each plan you hold: usage, reset and end dates, lane, and its keys. Personal and team plans are separate allowances.

To buy a plan for yourself:

  1. Open My plans and pick a plan.
  2. If you manage a company team, choose For me (billed to you personally).
  3. Confirm the price and pay. The plan is billed to your Personal team.

To change your personal plan, pick another plan in Change plan on the plan. You can upgrade each plan once per usage-reset period (weekly or monthly, depending on the plan). An eligible upgrade starts at once and charges the difference for the rest of the billing period. A downgrade starts at the next renewal.

To cancel your personal plan, click Cancel plan and confirm. The plan stays active until the end of the paid period, with no refund. Until then, Undo cancel keeps it.

To create a plan key:

  1. Open My plans.
  2. On the plan, click Create key.
  3. Copy the key. It is shown once.

A plan key uses the plan's allowance. Any other key in the team bills API credits. Use a credits key for requests a plan key does not support.

If you leave a team or are removed from it, your plan in that team ends and your keys for that team stop working.

Plan usage and overage preferences

Open Plan usage from My plans to inspect your allowance meter, browse past billing periods, view a by-model breakdown, and page through your recent request history (timestamps, models, lanes, and percentage of allowance or overage USD).

When your team enables prepaid overage, the Overage preferences panel on Plan usage shows your monthly spend against your monthly overage cap and lets you choose how Inference.net-hosted models behave after your included allowance runs out: Slow lane (stay at $0 extra cost) or Full speed (continue at full speed billed to the team's prepaid credits, when your team allows full-speed hosted overage).

Manage team plans

Owners and admins see each member's plan and its usage in Settings → Members. The plan column shows only in a desktop-width window. Each member's row has a Plan select:

  • Give a plan: pick a plan for a member without one and confirm. The team reuses a plan it already paid for this period when it has one; otherwise the team is charged for a new plan.
  • Change a plan: pick another plan. You can upgrade each plan once per usage-reset period (weekly or monthly, depending on the plan). An eligible upgrade starts at once and charges the difference; a downgrade starts at the next renewal.
  • Take a plan away: pick No plan and confirm. The member's plan keys stop using the plan at once. The plan itself runs to the end of the current billing period.

An owner's plan can be changed or taken away only by that owner. A pending change shows on the row with Undo until it starts.

To invite someone with a plan, click Invite, enter the email, and pick a plan in Plan. When the team has no reusable plan, the invitation is sent after payment.

Team overage and monthly statements

Only team owners and admins can configure team overage or open monthly statements:

  • Team overage controls (open My plans → Team statements, then use Team overage controls): turn prepaid overage on or off for the team, set a monthly team overage cap and default per-member monthly cap, set optional per-member cap overrides, and choose whether members may opt into full-speed overage on Inference.net-hosted models. Overage charges are deducted from the team's prepaid credit balance and reset on the 1st of each UTC month.
  • Team statements & overage: open My plans → Team statements to review an itemized monthly statement combining prorated member plan subscriptions and per-member overage spend, and download the statement as CSV or PDF.

To buy plans for several people with one payment, add a row per person, each with a plan, when you create a team. On inference.net you can do the same for an existing team: open My plans, pick a plan, and choose For people in your team. On platform.inference.net, give each member a plan from their row in Settings → Members.

If sales are sold out or paused, you cannot buy a new plan. When the waitlist is available, join it for your team. If fewer plans are available than you request, you can buy the available plans and join the team waitlist for the rest. People added beyond the available plans during team creation receive invitations without a plan. Joining the waitlist holds your team's place in line; it does not buy, reserve, or give anyone a plan. Give those people plans after your team buys them.

During the limited sale a team can hold up to 5 plans. Members and Billing show how many the team holds (for example, "3 of 5 plans"). At the limit, buying, inviting with a new plan, and giving a plan that is not reusable are off. Contact sales for more.

Plan billing actions (buying, giving, inviting with a plan, changing plans, and previewing prices) are rate-limited to 30 requests per user per action per minute. If you receive Too many plan billing requests, wait up to a minute and retry. See Plan billing rate limits.

Best practices

  • Keep API keys out of source control.
  • Rotate keys periodically.
  • Store keys in environment variables in your application.