OpenAI integration

Know what each OpenAI call costs—and who it serves.

Add the Grow or Die SDK to your backend. It records provider-returned usage facts from calls your application already makes, then prices those facts on the Grow or Die server.

Start with your product

What it reads

Usage facts, not conversation content

  • Requested and resolved model, operation, and provider request ID.
  • Uncached input, cached input, output, and reasoning tokens when OpenAI reports them.
  • Latency, stream completion, success, error, timeout, and cancellation state.
  • Opaque account, user, visitor, feature, and prompt-version labels you explicitly attach.

What stays private

Your OpenAI key and content never come to us

  • No prompts, messages, tool arguments, or generated responses.
  • No OpenAI API key; your own OpenAI client continues to make the call.
  • No token price is calculated in the SDK or trusted from the browser.

How to connect

Wrap one real server-side call

  1. Choose the JavaScript, Python, Ruby, Java, Go, .NET, or PHP server SDK.
  2. Generate a site-scoped, write-only Grow or Die ingest key.
  3. Wrap your existing OpenAI client, or use the typed observation helper around the call.
  4. Send one request and wait for one accepted usage event.
  5. Optionally attach stable account IDs so model cost can join payment revenue.

What it unlocks

From tokens to product economics

Priced events unlock AI cost per visitor, cost by model and feature, reliability signals, and cost-based Actions. Customer-level profit appears only after the same account is linked to observed payment revenue.

Current limits

Unknown remains unknown

Provider-internal retries are not visible unless you disable them and retry through application code. An interrupted stream may have partial or unknown usage. Unknown models remain unpriced until a trustworthy server-side rate is available, and SDK-priced cost is provisional until reconciled with provider billing.

Primary source

Check the provider contract

See the official OpenAI Responses API reference for response and usage fields.

Responses streaming evidence

Record final stream usage once, without changing the stream.

Grow or Die wraps the official OpenAI client on your server. It preserves normal and streaming return values, waits for final stream usage, and keeps cached tokens separate from uncached input.

Final usage is the boundary

Text deltas are not an accounting record. The completed response supplies input, output, cached, and reasoning usage; a cancelled stream without final usage stays visibly unknown.

Cached tokens stay separate

input_tokens_details.cached_tokens is retained as its own meter so the server can apply the exact cached-input rate for the model, tier, and date.

Business identity comes from your backend

Attach opaque account, user, feature, and prompt-version IDs before the request. Prompts, generated responses, provider keys, and request bodies are not sent.

Hidden retries remain unknown

Retries inside the provider client are below the wrapper boundary. For attempt-level cost, disable provider retries and retry explicitly with one logical request ID and increasing attempt numbers.

Full implementation recipe

OpenAI Responses streaming cost by account

See the tested server pattern, identity boundary, and fail-closed usage rules in the streaming cost recipe.