Inventory the contract you actually use
Search for every direct provider client, model string, retry loop, and response parser. Note use of tools, JSON schemas, images in messages, streaming callbacks, custom headers, and provider-specific fields. An application can look OpenAI-compatible at the happy path while depending on a dozen undocumented quirks.
- List endpoints and SDK versions.
- Capture representative requests and expected outputs.
- Record timeout and retry behavior.
- Identify code that reads provider-specific usage fields.
Make provider settings configurable
Move the base URL, credential, and model ID into deployment configuration. Keep the old route available during the migration window so rollback is a configuration change, not an emergency patch.
Never translate provider formats in multiple call sites. If a compatibility shim is needed, put it behind one tested client wrapper.
Test protocol depth
Run a compact contract suite for ordinary completions, server-sent events, tool calls, structured output, long context, cancellations, and expected errors. Compare observable behavior rather than exact prose: finish reason, schema validity, event order, usage fields, and error classes.
Then run task-level evaluations. Protocol compatibility means the response can be parsed; it does not mean a different model is equally good for the job.
Canary and observe
Start with internal traffic, then a small percentage of production requests. Watch success rate, p95 latency, first-token latency, output validity, fallback rate, and cost per successful task. Promote only when the new path clears explicit thresholds.
Keep request identifiers consistent across the client and gateway. A canary without trace correlation turns every anomaly into guesswork.
