BroadRouter
Get started

API key

Updated

An API key is a secret string that identifies and authorizes a client calling an API. LLM APIs usually expect it in an Authorization: Bearer header, and anyone who holds the key can make requests that are billed to the account that owns it.

Also called: API token, secret key, bearer token, inference key

An API key works like a password for a program. It is also a spending authority: whoever holds it can use your balance.

How it works

LLM APIs treat the key as a bearer token. The client sends it on every request:

curl https://inference.broadnet.ai/v1/models \
  -H "Authorization: Bearer $BROADNET_API_KEY"

RFC 6750 defines a bearer token as one where “any party in possession of the token” can use it. There is no second factor. That is why the same RFC says clients must always send bearer tokens over TLS (https://).

The provider looks up the key, finds the account, checks limits and policies, and then serves or refuses the request. A missing or wrong key usually returns 401; a key refused by policy, such as an IP allow list, usually returns 403.

Why it matters

A leaked key is one of the most common ways an API bill runs away, because bots scan public code for secrets. It can also expose data if the key reaches endpoints that return account details. Good practice, in line with the OWASP secrets guidance:

  • Load keys from environment variables or a secrets manager. Never commit them or bake them into container images.
  • Give each app or agent its own key, so you can revoke one without stopping everything.
  • Rotate keys on a schedule and immediately after any suspected leak.
  • Limit where a key works, for example with an allow list of server IPs.

On BroadNet Inference

BroadNet separates two credentials. An inference key calls models on /v1/*. A portal credential automates the account: keys, allowed IPs and purchases. Treat the second as full account authority.

Both are shown once. BroadNet keeps only a SHA-256 hash, so it cannot show the key again. A pay-as-you-go key lasts one year, and an account can hold up to ten live keys. Each key can carry its own list of allowed IPs. After a revocation or an allow-list change, new requests stop within five seconds.

Plan keys for the flat-rate plans are separate and never draw on your balance. Setup steps are in API keys and IP allow lists, and the status codes are in errors and retries.

Common mistakes

  • Logging full request headers. That writes the key into your logs.
  • Sharing one key across a team. You lose the ability to revoke one person’s access.
  • Sending the key to support. Send the X-Request-ID header value instead.

Questions

Can I put an LLM API key in a browser or mobile app?

No. Anything shipped to a client can be extracted. Keep the key on a server and have your app call your server, which then calls the LLM API.

What should I do if a key leaks?

Revoke it at once, create a new one, and check usage for the period it was exposed. Then find how it leaked, for example a commit, a log line or a screenshot.

How many keys can I have on BroadNet Inference?

Up to ten live pay-as-you-go keys per account. Each lasts one year from creation. Plan keys are separate.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity