Quanta

← Back to Briefings

One Thin Wrapper for Claude Haiku 4.5 and Four Aliases

Platform engineeringEN2 reads

01 · Four Aliases and One Call Path Worth Centralizing

Most teams that call models heavily arrive at the same place: four or five services, each with its own client, its own retry logic, and its own way of naming models. The result is not chaos on day one. It is drift by month three, when one service retries twice on a timeout, another retries forever, and a third still points at a model the team decided to stop using. A thin internal wrapper fixes that without building a platform.

The word thin is doing real work in that sentence. A thin wrapper owns the call path and almost nothing else. It translates your internal alias into a model name, passes the request through to the relay, normalizes the response and the error, and returns usage numbers. It does not decide what to say to the model, does not cache prompts, and does not orchestrate multi-step agents. Everything below that boundary belongs to the calling service, and everything above it belongs to a higher layer.

Start with four aliases, not a registry. Something like fast for a small, economical model such as Claude Haiku 4.5, deep for a strong reasoning model such as GPT-5.6 Sol, and two more shaped by your own workload. Aliases are the contract your services depend on; model names are an implementation detail you will change several times a year.

This is also where a relay pays off. With Quanta, one balance covers the model families teams actually use, so a single wrapper can serve every service without a separate client and a separate billing conversation for each provider.

02 · The Surface: One Function, Typed Errors, No Prompt Logic

Keep the public surface small enough to read in one sitting. For most teams that means one function for ordinary calls and one for streaming, plus a shared request type and a shared result type. If a caller has to learn more than that to place a request, the wrapper has already grown past its job.

  • › Request. Alias, messages or prompt, a token ceiling, and optional metadata for cost attribution.
  • › Result. Output text, a finish reason, latency, and a usage block.
  • › Errors. A short, stable set: invalid request, rate limited, timeout, provider unavailable, and authentication failure.

Everything else should pass through untouched. Do not normalize prompts, rewrite system messages, or inject your own instructions. Services that need prompt logic should own it, because that logic changes weekly while the wrapper should change quarterly.

Typed errors matter more than typed requests. When a service can tell a timeout apart from an authentication failure, it makes a sensible decision without parsing strings. When it cannot, every caller grows a private parser, and the drift returns by another route.

03 · Metering Real Tokens, Cache Writes, and Cache Reads

Every call is metered on real tokens, and cache writes and cache reads are priced separately. That distinction is the most useful thing your wrapper can surface, because it is where heavy workloads quietly move money. A prompt that grows a cache should show up as writes, a repeated context served from cache should show up as reads, and a change that destroys a cache should show up as a fresh write.

Make the usage block first-class. Return it with every result and log it together with the alias, the service name, and a team tag. Then route those logs into whatever budgeting tool you already run. The wrapper is not a billing system; it is the one place where the numbers are guaranteed to exist.

Two habits keep this honest. First, tag every request at the call site with an owner and a workload, so a cost report is a query instead of an investigation. Second, review alias usage on a schedule: when one service routes a cheap task to a strong model, that is a wrapper-level conversation, not a finance escalation.

Budget owners should also know that referral rewards are available: people who refer others earn 19% of their top-ups. It rarely changes a technical decision, but it is worth knowing before a department standardizes on one relay.

04 · Retries, Timeouts, and Swapping Models Behind One Alias

Decide retry behavior once, inside the wrapper, and document it. A workable default is one retry on timeout or provider-unavailable errors, no retry on invalid requests, and a retry on rate limits only when the caller has budgeted the wait. Put a hard timeout on every call and carry it into the error, so a stuck service can be identified quickly.

Streaming needs the same discipline. If a stream is cut mid-response, return the partial text together with an explicit finish reason instead of discarding work the caller can salvage. Small decisions like this are what make a thin wrapper feel solid under load.

Aliases also make rollout boring, which is the goal. Promote a new model behind a single alias, move one low-risk service first, watch latency and usage, then widen the change. If the change disappoints, flip the alias back and every service is consistent again without a redeploy. When the team steps from one model generation to the next, the diff is one line and the migration is a calendar entry.

Keep a ceiling per service as well. A relay will let sustained workloads run as hard as they need to, so your wrapper is the right place to say that a background job stays inside its lane while a customer-facing path keeps priority.

05 · Ownership, Versioning, and the Deliberate Omissions

Assign one owning team and treat the wrapper like an internal product with a version number and a changelog. Publish the alias table where engineers can see it, and deprecate an alias before removing it: two release cycles of warning is enough for a team of any size.

Equally important is the list of things you deliberately leave out. Keep orchestration, evaluation harnesses, prompt libraries, and long-term caching outside the wrapper. Each is legitimate, and each has a different owner and a different release rhythm. When they live inside the call path, every prompt change becomes a wrapper release, and the wrapper becomes a bottleneck nobody trusts.

Keep credentials in your secret manager rather than in code or checked-in configuration, and rotate them on the schedule your security team already uses. The wrapper should accept a credential at construction time and never print it.

Do this and the wrapper stays thin for years: one call path, four aliases, honest usage numbers, and a rollout process nobody has to think about. For teams running sustained volume across several model families, a pay-as-you-go relay with one balance and per-token accounting is the simplest thing to place behind it. If you want to try the shape in practice, open a Quanta account and point your first alias at it.