Skip to content
Heimdallm
Marketplace/Documentation
Documentation · Guides

Production checklist

Six items a production integration has to handle that a first integration can skip. Each one names what the platform does on its own and what is left to your client.

1. Retry what a retry can fix

  • Retry 408, 429, 502, 503 and 504 with exponential backoff and jitter. Routing re-runs on every attempt, so a retry often lands on a different endpoint. It is not a rerun of the same failure.
  • Honour Retry-After on 429 (seconds) and the X-RateLimit-* headers generally. Pacing to the limit is cheaper than tripping it.
  • Do not retry the other 4xxs. An invalid body, an oversized payload or a 402 fails identically until the request itself changes.
  • Failover is already built in. During a routed request Heimdallm walks the eligible endpoints on its own, and only errors no other endpoint could fix (invalid body, oversized payload, client abort) come back without alternatives having been tried.

2. Set a timeout under the ceiling

A request may legitimately run long, since big prompts and slow models exist. Before the answer begins a stream is bounded twice: 120 seconds of silence on any one endpoint, and ten minutes in total across every endpoint tried. Once the answer has begun the gap between frames is bounded at 60 seconds, and a stream that sends only keep-alive comments is bounded at 30 minutes without model output, so a long answer that keeps arriving is never cut by the platform and runs until the model finishes or max_tokens is reached. A buffered (non-streaming) request is bounded at ten minutes end to end. Past any of these the request fails with 504. Set the client timeout by what the product can wait, and for long generations prefer streaming with an idle timeout over a total one.

Aborting a request mid-flight is safe. Billing uses only the usage the endpoint reported before the connection closed, and a stream closed before its usage report has no token count to bill; known priced components are still charged. The outcome is queryable afterwards with GET /generation, as a cancelled generation or as an unrecorded request carrying its receipt once finalized.

3. Give every call path a fallback

  • Pass models: up to 20 fallback ids, tried in order when the primary cannot be served at all. A primary and one backup turns an endpoint outage into a slower request rather than a failed one.
  • Constrain the choice deliberately: provider.only / ignore for provider trust, provider.order to pin, max_price so a market price move can never route an unbounded price to you.
  • Where a capability is load-bearing (tools, structured outputs, a seed), send it explicitly. Routing selects only endpoints that declare support for every requested optional setting.

4. Handle both ways a stream ends

  • Parse per the wire contract: split on blank lines, ignore comment keep-alives, stop at [DONE], and take the final data frame for usage.
  • A stream that ends without data: [DONE] was cut off. Treat it as failed, not complete.
  • A chunk with an error member is terminal. Billing uses only the usage the provider reported before the failure; no count is inferred from delivered text.
  • Keep the X-Generation-Id from the response headers, so any stream can be reconciled later whichever way it ended.

5. Bound spend in the request

  • Send a realistic max_tokens. The credit hold covers prompt plus the completion ceiling, so a ceiling of "whatever the model allows" makes small balances unusable and parallel requests trip over their own reservations.
  • Leave a reasoning model room to answer. Reasoning tokens count against max_tokens and are billed as output. A budget spent on reasoning ends with 200, finish_reason: "length" and empty content, with usage.completion_tokens_details.reasoning_tokens close to usage.completion_tokens. Retrying the same request gives the same result, so check finish_reason and raise max_tokens or lower reasoning_effort.
  • Set spend limits at the right scopes. Per key for integration-level caps, per workspace for projects, per account as the hard fence. A breached limit answers 402 with metadata.scope naming which one.
  • Lead with the stable part of a prompt. On cache-capable endpoints, repeated prompt prefixes bill at the published input_cache_read rate, and the discount shows up in usage.prompt_tokens_details.cached_tokens.
  • Rate limits count requests, not tokens. Batch embeddings inputs into arrays; prefer one longer conversation turn over several tiny round-trips.

6. Log what makes a request findable

  • Log X-Generation-Id with each response, and usage.cost where the body is parsed. It is the join key to GET /generation for anything that went wrong, and the string to quote to support.
  • Poll GET /key for limit headroom and GET /credits for balance; alert on downward trends, not just zeroes.
  • For daily reconciliation, GET /activity returns one UTC day of requests, tokens and spend per model. Pair it with your own ledger of generation ids.
  • Branch error handling on metadata.error_type, not on messages. A 402 is a state to handle, not a crash.
DiscoverFind your next modelModel libraryAll models, versions, prices and capabilitiesBenchmarksMeasured quality, cost and time by serving configurationModel requestsAsk for a model, and vote on what is listed nextShowcaseImages, video and 3D made on the marketplaceProvidersCompare independent inference providersActivityMarketplace traffic and usageNetwork statusAvailability, latency and endpoint healthChatConversations, model settings and filesImage, video & 3DGenerate images, video and 3D assetsScene studioStage a shot in 3D, direct it and render it as a videoCoding playgroundBuild software with an AI agent on a machine of your ownOverview & routingIdentity, workspaces and routing preferencesBalance & depositsBalance, deposits, ledger and reserved fundsAPI keysKeys scoped to workspaces, limits and expirationOrganizationsTeams, members and shared workspacesRequest historyRequests, receipts, sandbox sessions and account historyReferralsInvitations and referral earningsPrivacyData settings, exports and deletionDocumentationQuickstart, SDKs, pricing and guidesAPI referenceInteractive endpoint referenceList your modelsProvider guide: requirements, the fee, payouts and what is measuredProvider payoutsMonthly statements, the marketplace fee and payout walletsProvider dashboardApply as a provider, add sources and track earnings