Resources / Integrations / Cloudflare AI Gateway

INTEGRATION · CLOUDFLARE AI GATEWAY

Cloudflare AI Gateway cost tracking per feature and customer

To see Cloudflare AI Gateway spend per feature and per customer, add an OpenTelemetry exporter pointing at LLMtrack in your gateway's settings, then send a cf-aig-metadata header with each request. No SDK and no code change beyond the header. See every gateway LLMtrack supports.

Setup: about 2 minutes · No SDK · Free plan: 3,000 requests a month · Checked against Cloudflare AI Gateway's docs on 13 Oct 2026

What you get on top of Cloudflare AI Gateway

Cloudflare AI Gateway logs, caches and rate-limits your requests. LLMtrack takes its traces and shows what each feature and each customer costs you, how caching is paying off, and where the month is heading.

These are the same views every LLMtrack workspace gets. See all six on the integrations overview. They're part of a complete approach to LLM cost.

Set it up

  1. 01

    Copy your LLMtrack ingest key

    Sign up free, open Keys & Integrations, and create a key named "Cloudflare". One key per connection lets you revoke it on its own.

  2. 02

    Add an OpenTelemetry exporter to your gateway

    In your AI Gateway's settings, add an exporter. JSON or protobuf both work:

    URL      https://otlp.llm-track.com/v1/traces
    Header   x-api-key: llmt_live_…

    Use the x-api-key header name. Cloudflare doesn't forward a custom Authorization header.

  3. 03

    Label your requests

    Send one header with each request:

    cf-aig-metadata: {"feature":"summarizer","customer":"acme-corp"}

    Tip Cloudflare keeps the first five metadata entries, so put feature and customer first. Already running the LLMtrack SDK on some of these calls? Add responseId: completion.id there and each request lands once.

Check it worked

Send one request through your gateway, then open your LLMtrack dashboard. It appears under the feature you set, with source "Cloudflare", the model, token counts, and the cost Cloudflare reported. Workers AI models show the provider as "workers-ai".

Troubleshooting

  • Feature or customer missingcf-aig-metadata keeps only five entries and drops the rest. Keys starting with "cf." are reserved by Cloudflare.
  • Values not showingMetadata values must be strings, numbers or booleans. Nested objects are dropped by Cloudflare.
  • Nothing arrivesCheck the exporter URL ends in /v1/traces and the header is named x-api-key with your llmt_live_ key as the value, with no "Bearer".
  • A request shows "Unpriced"That model isn't in LLMtrack's price sheet yet. It's recorded and flagged, never as $0. See the model price list.

What LLMtrack keeps from Cloudflare AI Gateway

LLMtrack reads only the fields below. Everything else in the trace, including any prompt or completion text, is dropped before anything is saved.

Kept

  • model and provider
  • token counts: input, output, cached, cache writes, reasoning, audio
  • the cost your gateway reported
  • your feature label and customer ID
  • latency and status

Dropped on arrival

  • prompts and system instructions
  • completions and tool calls
  • images and audio
  • anything else that holds content

Questions

Which Cloudflare plans include the exporter?

Cloudflare's OpenTelemetry page doesn't list plan limits as of 13 Oct 2026. Check your Cloudflare plan for the current terms.

Can I keep the exporters I already use?

Yes. Cloudflare lets you add more than one exporter, so LLMtrack sits next to the tools you already send traces to.

Do you store my prompts?

No. LLMtrack reads token counts, the model, your labels and timing. Any prompt or completion text in a trace is dropped before anything is written, and it never appears in logs.

I also send some of these calls through the LLMtrack SDK. Will they count twice?

No. Pass the provider's response ID to track() as responseId, and LLMtrack matches the two copies, keeps one row with the details from both, and counts it once. Calls that only look alike, with no ID to compare, are labelled "possible duplicate" and kept out of your totals until you decide. Hidden copies still count toward your monthly events, so sending responseId is the setup that keeps everything exact. You choose how both cases behave in Keys & Integrations.

How are events counted?

One request your gateway exports is one event. The free plan includes 3,000 a month, and Pro includes 25,000 for $11.99. Your usage page shows which connection used them, so a busy gateway is never a mystery.

Other gateways

See every integration on one page

Keep Cloudflare AI Gateway. See where the money goes.

One URL in your Cloudflare AI Gateway settings, and your next request shows up on your dashboard already priced.