01

Define the contract

Define the business capabilities you actually need before writing adapters: text, images, structured output, tools, streaming, state continuation, and asynchronous work. Mark each required, optional, or unsupported.

02

Protect credentials

Use separate credentials, budgets, alerts, and rotation records per provider. Store secrets on the server with authenticated encryption and return only configuration status and a last-four hint to the browser.

03

Track capabilities

Maintain a model allowlist with modalities, tool support, structured output, streaming, state behavior, limits, version, and retirement date. A listed model does not prove the current account has access, so run a minimal health request.

04

Adapt requests

Keep a common business request while preserving provider-specific message roles, content blocks, tools, and state fields in adapters. Test changed system instructions, images, tool call IDs, and two-turn conversations.

05

Normalize responses

Normalize text, structured data, tool calls, finish reason, usage, request ID, raw status, and warnings. For streaming, keep original events while exposing a stable application event set.

06

Test failures

Do not retry authentication and permission errors. Back off on rate limits and bound retries for network and server failures. Run a fixed regression pack whenever an adapter or model changes.