---
title: "Environments"
description: "Environments keep production, staging, and development spend apart, with budgets of their own."
---

# Environments

An environment is where a service runs: `production`, `staging`, `development`, a developer's
laptop. Tidegate keeps each environment's spend apart, so you can give staging and local
development small budgets of their own, cap production on its own, and see what each one spends.

An environment is only its **name**, such as `staging`. Names use letters, digits, and `.`, `_`,
`:`, `-`. There's nothing to define first: a key or a budget that names a new environment is
enough. Every organization has `production`.

## Whose spend is where

An [API key](/tidegate/guide/keys) spends in one environment, chosen when the key is created: `production`,
unless you name another. Every reservation the key makes is in that environment. A service never
names an environment in a request, so a staging deployment can't spend as production, or slip
past production's budgets by claiming to be somewhere else.

Give a service one key for each place it runs, and put each in that environment's secrets: a
production key in production, a staging key in staging, a development key in your local
development secrets.

Keys created before environments, and everything they reserved, are production's.

## Budgets for an environment

A [budget](/tidegate/guide/budgets) counts one environment's reservations, or every environment's:

- An environment's budget counts only the reservations made by keys in that environment.
- A budget for every environment counts all of them, as every budget did before environments.

A reservation must fit every budget that counts it, so these stack. For example, on one meter:

- `anthropic-monthly`, for every environment: a total for everything.
- `production-monthly`, for `production`: production's part of it.
- `staging-per-user`, for `staging`, split by `member`: each user's cap in staging.
- `development-daily`, for `development`: a small daily cap on local work.

A budget can be for one app and one environment at once: what that app spends in staging, say.
Each budget is for one environment or for all of them; to cap each environment, give each its
own budget, which lets production and development have very different limits.

## Spend by environment

The [Spend](/tidegate/guide/spend) page groups by environment, alone or alongside another facet, such as each
app in each environment, and filters to some environments.

## Environments and labels

A label is what a service says about one call. An environment is where the service runs, which
Tidegate knows from the key. A label named `environment` is only a label.
