Why it matters
Many hosts expose OpenAI-style /v1/chat/completions; treat base URL, model id and keys as config — and ACK before the call.
Practical steps
- Put OPENAI_BASE_URL, API key and model in env.
- Set hard timeouts and max tokens on every request.
- Strip tool results before logging.
- Retry only idempotent reads.
- Measure cost per chat id for attribution.
Watch out for
- Assuming every compatible API streams identically.
- Logging full prompts with user PII.