An API lets a program use a model without running it. Your software sends a request over the internet, naming the model and including the prompt and settings, and receives the response, often streamed piece by piece as it is generated. Most providers also support features such as tool calling, image input and structured output through the same interface.

Access is controlled with an API key, which is a secret. Anyone who has it can run requests at your expense, so it should never be placed in public code or in a web page. Providers also set rate limits, and requests can fail or time out, so your code needs retries and error handling.

Models are versioned, and a provider may update or retire the one you use. Behavior can change when that happens.

Store keys in a secret manager, set spending limits, pin the model version where possible and test again when it changes.