Docs · how to

Sell tokens

Turn an endpoint into a product for other people — customers, keys, rate limits, prices per million tokens, usage export and invoicing through your own billing.

If you own or rent GPUs, you can sell GPU-hours or you can sell tokens. Selling tokens means you carry the utilization: the better your batching, cache reuse and routing, the more each GPU-hour earns. denv meters every request per customer; you set prices and invoice through your own billing.

1. Create a customer and a key

denv customer create acme-labs
denv key create --customer acme-labs --env ds-flash --stage prod-us

The key is shown once. A key scoped to one stage can only call that stage's endpoint.

2. Set rate limits

denv limit set --customer acme-labs --env ds-flash --rpm 600 --tpm 2000000

Requests over a limit get HTTP 429 with a Retry-After header. They are not metered.

3. Set prices

Prices are per million tokens, per environment, with an optional customer-specific override.

denv price set --env ds-flash --input 0.30 --cached-input 0.03 --output 1.10
denv price set --env ds-flash --customer acme-labs --input 0.25 --cached-input 0.03 --output 0.95

The numbers above are placeholders. Price cached input lower than fresh input if you want callers to structure requests for cache reuse. See Configure the KV cache.

4. Check usage

denv usage --customer acme-labs --since 2026-10-01
CUSTOMER    ENV        REQUESTS   INPUT        CACHED INPUT   OUTPUT       AMOUNT
acme-labs   ds-flash   184,220    912.4M       603.1M         141.7M       (at your prices)

Usage counts input, cached input and output tokens separately. Reasoning tokens count as output.

5. Export usage to your billing

As CSV:

denv usage --since 2026-10-01 --export csv > october.csv

Or as events, through a webhook registered with the API. Each event carries the customer, environment, stage, token counts and amount for a period. Use either to create invoice items in your own billing system, such as Stripe. denv does not charge your customers' cards.

6. Share a parity report

Buyers of open-model tokens increasingly ask whether a provider serves the full model. Run parity on a schedule and share the report:

denv parity schedule ds-flash/prod-us --every 6h
denv parity report ds-flash/prod-us --public

See Run parity checks.

7. List on aggregators

Aggregators route requests across providers by price, latency and reliability. Your endpoint already speaks the OpenAI Chat Completions and Responses APIs, and Anthropic Messages if the release enables it. Each aggregator has its own onboarding and requirements; check with them directly. Create a customer for each aggregator so its traffic and limits are separate from direct customers.

8. Watch revenue per GPU-hour

denv metrics ds-flash/prod-us

Two numbers decide whether selling tokens beats selling GPU-hours:

Metric Meaning
Cost per GPU-hour What the fleet costs you, by fleet
Revenue per GPU-hour Metered amount at your prices divided by GPU-hours served

The gap moves with utilization, KV cache hit rate, topology and price. Change one thing at a time, as a release, and compare.

Keep customers safe from your changes

Every change to what a customer calls goes through the stage's rollout: canary, health checks, parity, bake, automatic rollback. Customers keep one URL while releases change behind it. See Rollout policy.