ZuploZuplo
LoginStart for Free
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop in the portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingDynamic MCP Server - Quickstart
    Develop locally with the CLI
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingDynamic MCP Server - Quickstart
Concepts
Development
Policies
Handlers
API Keys
Rate Limiting
Caching
MCP Server
MCP Gateway
AI Gateway
    IntroductionGetting StartedSource ControlUniversal API
    Providers
    Teams
    Apps
    Policies
      OverviewAPI key authenticationModel FilteringFallback ModelBudgets and CostsSemantic cacheAkamai AI FirewallComet Opik tracingGalileo tracing
    Cookbooks
    Integrations
Developer Portal
Monetization
GraphQL
Deploying & Source Control
Analytics
Observability
Networking & Infrastructure
Account Management
Programming API
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsVersion Support PolicySecuritySupportTrust & ComplianceChangelog
powered by Zudoku
Policies

Budgets and Costs

ai-gateway-metering-v2

The Budgets and Costs policy records what an app uses and enforces its budgets. It meters three things—spend, tokens, and requests—each with independent daily and monthly periods, and each with an optional warning threshold that notifies without blocking.

When a limit is exceeded, the policy either routes the request to the model selection's quotaFallback if Fallback Model supplied one, or rejects it with 429.

An app's own limits aren't the only ones that apply. The policy also checks the parent team's and the gateway's limits, which are enforced centrally rather than from this policy's options—so a request can be blocked by a limit that isn't visible in the app's chain.

Place Budgets and Costs after Model Filtering and Fallback Model, so an exceeded budget can activate the quota fallback.

Budgets fail open by default

throwOnFailure defaults to false, so if the metering service is unavailable the request proceeds unmetered—no limit is checked, even for an app that's already over budget. Set it to true to reject the request instead.

Each limit period carries an enabled flag next to its number, and so does each warning threshold. A period enforces nothing until enabled is true and limit is set. Watch for this when editing options directly, such as in config/policies.json or a policy template.

For the portal workflow and the gateway and team levels see Usage Limits; for every option see the generated reference.

Edit this page
Last modified on August 5, 2026
Fallback ModelSemantic cache