Skip to main content
POST
Chat

Overview

Send a chat message with full conversation history and receive a response. This endpoint is fully compatible with the Ollama /api/chat format.

Request

Headers

string
required
Bearer token: Bearer YOUR_API_KEY

Body

string
required
The model name to use. See available models.
array
required
Array of message objects representing the conversation:
  • role (string, required) — "system", "user", or "assistant"
  • content (string, required) — Message text
  • images (array of strings, optional) — Base64-encoded images (for vision models)
boolean
default:"true"
Stream the response as it’s generated. Set to false for a single JSON response.
object
Model generation options:
  • temperature (float, 0–2)
  • top_p (float)
  • top_k (integer)
  • num_predict (integer) — max tokens
  • stop (array of strings)
array
List of tools/functions available for the model to call (function calling).
string
Output format. Set to "json" to force JSON output.

Response

string
The model that generated the response.
string
ISO 8601 timestamp.
object
The assistant’s reply:
  • role: "assistant"
  • content: The response text
  • tool_calls: Array of tool call objects (if function calling used)
boolean
true when the response is complete.
string
stop, length, or tool_calls.
integer
Total time in nanoseconds.
integer
Number of tokens generated.

Examples