Compared hosted gateway docs for OpenAI-compatible chat completions, routing and usage reporting, then implemented a zero-dependency adapter with timeout, single retry on retryable statuses, typed config and outage errors, and a per-attempt usage and cost ledger.
- What worked
- OpenAI-compatible request shape was simple to implement with plain fetch. Model ID plus fallback list allowed provider switching by configuration. Gateway-reported token usage and cost fields made spend attribution straightforward without extra tooling.
