Calling a model API

A model API call consists of sending an HTTP request to a provider or a model server, with messages and parameters, then receiving the generated response. The call is made from the server, which keeps the API key secret and handles errors, timeouts, and costs.

Example

curl https://api.example.com/v1/chat -H "Authorization: Bearer $API_KEY" -d '{"model":"m","messages":[{"role":"user","content":"Bonjour"}]}'

Related concepts

The whole glossary