Ollama-Compatible API
Chat
Multi-turn chat with message history (Ollama-compatible)
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>"
}
'import requests
url = "https://api.ajstudioz.co.in/api/chat"
payload = {
"model": "<string>",
"messages": [{}],
"stream": True,
"options": {},
"tools": [{}],
"format": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
stream: true,
options: {},
tools: [{}],
format: '<string>'
})
};
fetch('https://api.ajstudioz.co.in/api/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ajstudioz.co.in/api/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'messages' => [
[
]
],
'stream' => true,
'options' => [
],
'tools' => [
[
]
],
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ajstudioz.co.in/api/chat"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"options\": {},\n \"tools\": [\n {}\n ],\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ajstudioz.co.in/api/chat")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"options\": {},\n \"tools\": [\n {}\n ],\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ajstudioz.co.in/api/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"options\": {},\n \"tools\": [\n {}\n ],\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"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
}
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_KEYBody
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 textimages(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 tokensstop(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 texttool_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
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
}'
from ollama import Client
client = Client(
host="https://api.ajstudioz.co.in",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
response = client.chat(
model="deepseek-v3.2",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is a REST API?"}
]
)
print(response.message.content)
from ollama import Client
client = Client(
host="https://api.ajstudioz.co.in",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
history = [{"role": "system", "content": "You are a friendly AI assistant."}]
# First turn
history.append({"role": "user", "content": "My name is Alex."})
response = client.chat(model="kimi-k2:1t", messages=history)
history.append({"role": "assistant", "content": response.message.content})
# Second turn (model remembers context)
history.append({"role": "user", "content": "What is my name?"})
response = client.chat(model="kimi-k2:1t", messages=history)
print(response.message.content) # Should say "Alex"
from ollama import Client
import base64
client = Client(
host="https://api.ajstudioz.co.in",
headers={"Authorization": "Bearer YOUR_API_KEY"}
)
with open("image.jpg", "rb") as f:
img_b64 = base64.b64encode(f.read()).decode("utf-8")
response = client.chat(
model="qwen3-vl:235b-instruct",
messages=[
{
"role": "user",
"content": "What is in this image?",
"images": [img_b64]
}
]
)
print(response.message.content)
{
"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
}
⌘I
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>"
}
'import requests
url = "https://api.ajstudioz.co.in/api/chat"
payload = {
"model": "<string>",
"messages": [{}],
"stream": True,
"options": {},
"tools": [{}],
"format": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
stream: true,
options: {},
tools: [{}],
format: '<string>'
})
};
fetch('https://api.ajstudioz.co.in/api/chat', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.ajstudioz.co.in/api/chat",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'messages' => [
[
]
],
'stream' => true,
'options' => [
],
'tools' => [
[
]
],
'format' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.ajstudioz.co.in/api/chat"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"options\": {},\n \"tools\": [\n {}\n ],\n \"format\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.ajstudioz.co.in/api/chat")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"options\": {},\n \"tools\": [\n {}\n ],\n \"format\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ajstudioz.co.in/api/chat")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"stream\": true,\n \"options\": {},\n \"tools\": [\n {}\n ],\n \"format\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"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
}
