The chat API is the boundary between your app and a model
An AI chat API accepts a prompt or a sequence of messages and returns a model-generated response. Your application typically handles authentication, conversation state, user permissions, interface design, and the decision to call an LLM. The model provider handles inference.
While interfaces differ, a chat request generally includes a model selection, instructions, user input and optional conversation context. Responses may contain text, structured data or tool-call proposals. Your app decides how to display or act on them.
What a chat API request needs
- Clear instructions. Describe the assistant's task, limits and output format.
- Relevant context. Supply the conversation turns or retrieved information needed to answer.
- A selected model. Choose based on quality, latency, cost and required capabilities.
- An output contract. Decide whether free-form text, a schema or tool calls are appropriate.
- Failure handling. Set timeouts, retries, logging and safe fallbacks before launch.
A simple example can be described without committing to any particular provider:
{
"model": "your-selected-model",
"messages": [
{"role": "system", "content": "Give concise, grounded answers."},
{"role": "user", "content": "Summarize this document."}
],
"response_mode": "text"
}
Illustrative provider-neutral format, not an endpoint or runnable ChatsAPI request. Real providers use different field names and authentication schemes.
Chat completion versus agent execution
A standard chat integration asks a model to generate a reply. A chat agent can also plan a step, request a tool call, read a result and continue. That expands the workflow, but the application remains responsible for authorization, validation and executing actions.
See the chat agent architecture guide and the tool-calling documentation for a design checklist.
How to evaluate a provider
Start with 30–100 representative user messages. Evaluate correctness, output format, response time and cost per successful outcome. Test multilingual behavior, context limitations and failure modes if they matter to your audience. The best API for a support assistant may differ from the best API for an analytical agent.
Continue with our LLM provider comparison and model selection guide.
Browse more guides ↗