---
title: "Restrict an LLM API key to your server IPs | BroadRouter"
description: "Protect BroadNet Inference keys with IP allow-lists, separate inference keys from portal credentials, and revoke a leaked key in seconds. With curl examples."
url: https://broadrouter.com/guides/api-keys-ip-allow-lists/
lang: en
updated: 2026-11-16
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Lock API keys to your servers with IP allow-lists

Updated 2026-11-16

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:

```bash
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.

```bash
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](https://broadrouter.com/guides/errors-and-retries/). To make your first request with a new key, follow [the OpenAI Python SDK guide](https://broadrouter.com/guides/openai-python-sdk/). The [IP allow-list glossary entry](https://broadrouter.com/glossary/ip-allow-list/) explains the idea in general terms.

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

## Terms in this guide

[API key](https://broadrouter.com/glossary/api-key/)

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.

[IP allow list](https://broadrouter.com/glossary/ip-allow-list/)

An IP allow list is a security control that accepts requests only from listed IP addresses or CIDR ranges and refuses all others. On an API, it limits the damage from a leaked key, because the key does not work from networks that are not on the list.

[Pay-as-you-go](https://broadrouter.com/glossary/pay-as-you-go/)

Pay-as-you-go is a pricing model in which you pay only for what you use, metered per unit such as tokens, requests or audio minutes, with no subscription or minimum commitment. Most LLM APIs bill this way, from a prepaid balance or a periodic invoice.

## 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.

## Related guides

-   [BroadNet Inference error codes and when to retry](https://broadrouter.com/guides/errors-and-retries/)
-   [Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-api-keys-ip-allow-lists&utm_content=page-cta) ·

**Sources**

-   [BroadNet Inference API reference, IP allow-lists (checked 2026-11-16)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-api-keys-ip-allow-lists&utm_content=sources#ip-allow-lists)
-   [BroadNet Inference API reference, hourly keys and portal credentials (checked 2026-11-16)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-api-keys-ip-allow-lists&utm_content=sources#hourly-keys)
-   [BroadNet Inference API reference, limits (key lifetime and live keys) (checked 2026-11-16)](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-api-keys-ip-allow-lists&utm_content=sources#limits)
