1 min lesson
Normalize provider differences
Map differences in authentication, streaming, errors and usage into one caller-facing contract.
Step 1 of 2
What the gateway normalizesprovider differences
Name the provider differences the interface must handle. This turns a vague abstraction into a design someone could implement.
- Surface
- Authentication
- How it diverges
- Headers, SDK tokens, organization keys and credential rotation
- What the gateway exposes
- One credential resolver keyed by provider and region
- Surface
- Request shape
- How it diverges
- Message roles, tool schemas and sampling field names
- What the gateway exposes
- One request type that each adapter serializes
- Surface
- Streaming
- How it diverges
- Event names, delta framing and completion markers
- What the gateway exposes
- One internal token stream
- Surface
- Errors
- How it diverges
- A 429 may mean rate limit, quota or overload
- What the gateway exposes
- Shared retryable, fatal and shed categories
- Surface
- Token accounting
- How it diverges
- Usage may appear in headers, trailers or estimates
- What the gateway exposes
- One usage record for cost and capacity
| Surface | How it diverges | What the gateway exposes |
|---|---|---|
| Authentication | Headers, SDK tokens, organization keys and credential rotation | One credential resolver keyed by provider and region |
| Request shape | Message roles, tool schemas and sampling field names | One request type that each adapter serializes |
| Streaming | Event names, delta framing and completion markers | One internal token stream |
| Errors | A 429 may mean rate limit, quota or overload | Shared retryable, fatal and shed categories |
| Token accounting | Usage may appear in headers, trailers or estimates | One usage record for cost and capacity |
The adapter translates provider details into the shared interface.