Connecting third-party models: API keys, OpenAI-compatible APIs, rate limits
Essence
Almost any AI tool can be pointed at a different model: another provider, an aggregator or a local server. You need three things: the API base URL, a key and a model name. The most common format is the OpenAI-compatible Chat Completions API: Xcode, Cursor, many agents and libraries understand it, and it's offered not only by OpenAI but also by Google, OpenRouter, Ollama, LM Studio and others.
The main engineering questions are where to keep the key, how to survive rate limits and errors, and how to be sure which model is actually answering.
The rest of this answer, with code and interview follow-ups, is in the DevPrep app.
Read the full answer in DevPrep