BroadRouter
Get started

Lock API keys to your servers with IP allow-lists

Updated

Add your servers' egress IPv4 or IPv6 addresses or CIDR ranges to the account allow-list, up to 32 entries. New keys inherit the list unless you pass allowed_ips when you create one. Requests from other addresses get a 403, and allow-list changes or revocations take effect within five seconds.

A leaked key is the most common way an API bill runs away. BroadNet Inference gives you two controls: an IP allow-list and fast revocation.

Two kinds of credential

Credential Use it for Treat it as
Inference key Model requests to /v1/* A secret for one app or agent
Portal credential Account automation: keys, allowed IPs, purchases Full account authority

Both are shown once. The portal keeps only a SHA-256 hash, so it cannot show the key again. A pay-as-you-go inference key lasts one year from creation, and an account can hold up to ten live keys.

Set an allow-list

On the account page, add one IPv4 or IPv6 address or CIDR range per line, up to 32 entries. An empty list means no IP restriction. New keys inherit this account list. The edge checks the client IP that Cloudflare reports on every API request.

To manage the account list from a script, PUT /portal/allowed_ips replaces it in one call (portal credential required).

Give one key its own list when you create it with a portal credential:

curl -X POST https://inference.broadnet.ai/portal/keys \
  -H "Authorization: Bearer $BROADNET_PORTAL_CREDENTIAL" \
  -H "Content-Type: application/json" \
  -d '{"label":"worker-1","allowed_ips":["203.0.113.7","198.51.100.0/24"]}'

A per-key allowed_ips replaces the inherited account list for that key. The response contains the raw key once; store it straight away.

Revoke a leaked key fast

DELETE /portal/keys/{alias} revokes a pay-as-you-go key, and DELETE /portal/keys/hourly/{alias} revokes an hourly key (the original purchase charge stays). After a revocation or allow-list change, new requests stop within five seconds.

curl -X DELETE https://inference.broadnet.ai/portal/keys/$KEY_ALIAS \
  -H "Authorization: Bearer $BROADNET_PORTAL_CREDENTIAL"

Set KEY_ALIAS to the alias shown for the key on the account page or in GET /portal/keys. The alias is not the secret key. If a portal credential leaks, revoke it with DELETE /portal/credentials/{id}: it can do everything your account can.

Troubleshooting

  • 403 from a server you listed. The edge sees your public egress address, not the server’s private IP. Servers behind a NAT gateway, proxy or load balancer leave through that device’s address. A server with IPv6 may leave over IPv6 even if you listed only its IPv4 address. List the address the request actually leaves from, or a CIDR range that covers it.
  • A new key ignores the account list. A per-key allowed_ips array replaces the inherited account list for that key. Check what you passed at creation.
  • 409 key_limit_reached. The account already has ten live keys. Revoke one you no longer use.
  • Requests still succeed a few seconds after revoking. Expected for up to five seconds while the cache catches up.

A request from an address that isn’t on the list gets a 403. See all BroadNet error codes and when to retry. To make your first request with a new key, follow the OpenAI Python SDK guide. The IP allow-list glossary entry explains the idea in general terms.

A metal key whose bow is shaped like curly braces { }, with the text "One API key. More possibilities."

Questions

How do I restrict an LLM API key to my server's IP address?

Add the server's public egress address, or a CIDR range, to the account allow-list on the BroadNet account page, or pass allowed_ips when you create the key through POST /portal/keys. Requests from any other address are refused with a 403.

Does an empty allow-list block everything?

No. An empty list means no IP restriction, so the key works from any address. Add at least one entry to turn the restriction on.

Can I use an inference key to create other keys?

No. Inference keys only call /v1/* model routes. Creating and revoking keys, changing allowed IPs and buying hourly keys need a portal credential, which carries full account authority.

How fast does revoking a leaked key work?

BroadNet's docs say new requests stop within five seconds of a revocation or an allow-list change, because authorization decisions can stay in a replicated cache for that long.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity