An API is a defined contract through which one program requests services from another. Most AI providers expose their models over HTTP APIs, typically following the REST architectural style described by Fielding (2000); requests carry the prompt and parameters, and responses return generated tokens as structured JSON.
APIs are how AI is embedded into other products — back-ends, automations and apps — rather than used only through a chat window.