Nano GPT logo
NanoGPT

Private AI

Back to Blog

How to Control AI API Spending Without Sharing One Giant Budget

Jul 16, 2026

AI API costs are easy to understand when one person is testing one model. They become harder to manage when the same account powers a production app, a development environment, a few experiments, and an agent that can make requests on its own.

A common but risky setup is a single API key tied to one shared pay-as-you-go balance. If spending rises, you know the total changed, but not necessarily what caused it. A forgotten test, an unexpected traffic spike, or an overactive agent can all look the same.

NanoGPT's API key controls let you put per-key guardrails around that shared balance, making each workload easier to manage. With a few sensible limits, you can make costs more predictable without setting up a complicated internal billing system.

Start with separate keys

Create a different API key for each important workload. For example:

  • Production
  • Development and testing
  • Experiments
  • Agents and automations
  • Shared tools or integrations

Give each key a clear name. This makes the Usage page easier to use because you can filter activity by key instead of trying to identify everything from a single total.

It also gives you a simple emergency control. If one integration behaves unexpectedly, you can disable or replace that key without rotating keys for unrelated workloads.

You don't need a separate key for every small script. The useful dividing line is responsibility: create a new key when a workload has a different owner, purpose, risk level, or budget.

Give each key its own limits

In a key's settings, under Usage Limits, you can set limits for:

  • Requests per day
  • Input tokens per day (roughly, how much prompt text you send)
  • Spending per day
  • Spending per week
  • Spending per month

Leave a field empty to keep that specific limit unset. Set it to zero to block that type of usage.

The right limits depend on what the key is for. A production app may need room for normal traffic, while an experiment should usually have a small allowance. An unattended agent needs tighter limits than a tool you run manually and watch closely.

Start with a limit that is comfortably above normal usage, then adjust it after a week or two. The goal isn't to interrupt legitimate work — it's to stop a small mistake from turning into an open-ended bill.

These limits work best as guardrails rather than forecasting tools. Use the Usage page to understand normal spending, then use limits to define what should count as abnormal.

Decide which balance each key may use

If you have a NanoGPT subscription, each API key can use one of three billing modes:

Subscription first

The key uses your subscription when the chosen model is included. If the requested model is not covered by your subscription, the key falls back to your balance.

If you want requests to subscription-included models to continue using your balance after subscription limits are reached, also enable Use balance after limits on the subscription page.

This is a good default for most general use.

Subscription only

The key never spends from your balance. Requests or features that would require balance spending are rejected.

Use this for shared integrations, experiments, or anything where avoiding balance spend matters more than keeping every request running.

Pay-as-you-go only

The key always uses your balance for text requests, even when the model is included in your subscription.

Choose this when you want a production app's pay-as-you-go costs kept separate while saving subscription usage for other keys.

Billing modes answer a different question than spending limits do. A billing mode decides where a key may spend. A limit decides how much usage you are willing to allow.

Restrict expensive models where they are not needed

Spending limits cap the total, while model restrictions stop expensive model choices before the request runs.

Each API key can be left open to all text models, restricted to a custom list, or set to follow the current subscription-included models.

For a summarization tool, you might allow only one or two affordable models that are good at that task. For development, you might allow a broader list. For a production feature, you can approve the exact models you have tested.

This also helps with configuration mistakes. If a misconfigured app asks for a model you never intended to pay for, the request is rejected instead of quietly billed.

Compare costs using your own recent requests

Price tables are useful, but they don't show how your prompts behave in practice. Long prompts, detailed responses, and optional features such as web search can all change the result.

The NanoGPT Cost Simulator analyzes up to 100 recent requests for one selected model and estimates what similar usage would cost on other models at current API prices.

This helps answer practical questions:

  • Would a smaller model meaningfully lower your costs?
  • Is the premium model costly enough that you should reserve it for difficult requests?
  • Does a cheaper alternative support the size of the prompts you actually send?

It uses a sample rather than every request in the selected period. Its results are estimates, and model features may behave differently between alternatives. Treat it as a practical comparison, not a promise of the next invoice.

Turn on request logging only when you need it

Unexpected spending is sometimes caused by repeated requests, oversized prompts, or responses that are much longer than expected. Per-key request logging can help you investigate those cases.

Logging is optional and applies only to new chat-completion requests (the /v1/chat/completions endpoint) made with that key after logging is enabled. You can then view the request and response bodies from the Usage details. Retention can be set from 1 to 30 days; the default is 7 days.

There is an important privacy tradeoff: logging temporarily stores prompt and response content. Do not enable it by default for sensitive work. Turn it on for the key you are debugging, keep the retention period short, then turn it off when you're finished. Disabling logging also removes the stored logs for that key.

A practical starting setup

For many teams and individual developers, here's a reasonable place to start:

  1. Use one key for production and another for development.
  2. Give experiments and autonomous agents their own keys.
  3. Add daily or monthly spending limits to anything that can run unattended.
  4. Restrict each key to models that make sense for its job.
  5. Use Subscription only for workloads that should never touch your balance.
  6. Check the Cost Simulator before moving a large workload to a different model.
  7. Enable request logging only for short debugging periods.

Separate workloads, give them appropriate limits, and make costs visible before they become a surprise.

You can create and manage keys from the NanoGPT API page, and review spending on the Usage page.

Milan de Reede

Milan de Reede

CEO & Co-Founder

milan@nano-gpt.com
Back to Blog