Skip to main content
POST
/
api
/
chat
Chat
curl --request POST \
  --url https://api.ajstudioz.co.in/api/chat \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "messages": [
    {}
  ],
  "stream": true,
  "options": {},
  "tools": [
    {}
  ],
  "format": "<string>"
}
'
{
  "model": "gemma3:27b",
  "created_at": "2026-03-07T12:00:00Z",
  "message": {
    "role": "assistant",
    "content": "To reverse a string in Python, you can use slicing:\n\n```python\nmy_string = \"Hello, World!\"\nreversed_string = my_string[::-1]\nprint(reversed_string)  # !dlroW ,olleH\n```\n\nYou can also use the `reversed()` function combined with `join()`:\n\n```python\nreversed_string = \"\".join(reversed(my_string))\n```"
  },
  "done_reason": "stop",
  "done": true,
  "total_duration": 3456789012,
  "prompt_eval_count": 34,
  "eval_count": 89,
  "eval_duration": 3200000000
}

Documentation Index

Fetch the complete documentation index at: https://student-213fb9fc.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

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

Authorization
string
required
Bearer token: Bearer YOUR_API_KEY

Body

model
string
required
The model name to use. See available models.
messages
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)
stream
boolean
default:"true"
Stream the response as it’s generated. Set to false for a single JSON response.
options
object
Model generation options:
  • temperature (float, 0–2)
  • top_p (float)
  • top_k (integer)
  • num_predict (integer) — max tokens
  • stop (array of strings)
tools
array
List of tools/functions available for the model to call (function calling).
format
string
Output format. Set to "json" to force JSON output.

Response

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

Examples

curl https://api.ajstudioz.co.in/api/chat \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma3:27b",
    "messages": [
      {"role": "system", "content": "You are a helpful coding assistant."},
      {"role": "user", "content": "How do I reverse a string in Python?"}
    ],
    "stream": false
  }'
{
  "model": "gemma3:27b",
  "created_at": "2026-03-07T12:00:00Z",
  "message": {
    "role": "assistant",
    "content": "To reverse a string in Python, you can use slicing:\n\n```python\nmy_string = \"Hello, World!\"\nreversed_string = my_string[::-1]\nprint(reversed_string)  # !dlroW ,olleH\n```\n\nYou can also use the `reversed()` function combined with `join()`:\n\n```python\nreversed_string = \"\".join(reversed(my_string))\n```"
  },
  "done_reason": "stop",
  "done": true,
  "total_duration": 3456789012,
  "prompt_eval_count": 34,
  "eval_count": 89,
  "eval_duration": 3200000000
}