Chat completions
curl --request POST \
--url https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"search": {
"domain_filter": [
"<string>"
]
},
"stream": true,
"user_context": {}
}
'import requests
url = "https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"search": { "domain_filter": ["<string>"] },
"stream": True,
"user_context": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{content: '<string>'}],
search: {domain_filter: ['<string>']},
stream: true,
user_context: {}
})
};
fetch('https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions', 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://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions",
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' => [
[
'content' => '<string>'
]
],
'search' => [
'domain_filter' => [
'<string>'
]
],
'stream' => true,
'user_context' => [
]
]),
CURLOPT_HTTPHEADER => [
"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://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"search\": {\n \"domain_filter\": [\n \"<string>\"\n ]\n },\n \"stream\": true,\n \"user_context\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"search\": {\n \"domain_filter\": [\n \"<string>\"\n ]\n },\n \"stream\": true,\n \"user_context\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"search\": {\n \"domain_filter\": [\n \"<string>\"\n ]\n },\n \"stream\": true,\n \"user_context\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"choices": [
{
"index": 123,
"message": {
"content": "<string>"
}
}
]
},
"request_id": "<string>",
"meta": {
"api_version": "<string>",
"processing_ms": 123,
"tokens_used": 123,
"cost": {
"total": 1,
"breakdown": {}
}
}
}{
"error": "<string>"
}API Reference
Chat Completions
POST
/
chat
/
completions
Chat completions
curl --request POST \
--url https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{
"content": "<string>"
}
],
"search": {
"domain_filter": [
"<string>"
]
},
"stream": true,
"user_context": {}
}
'import requests
url = "https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions"
payload = {
"model": "<string>",
"messages": [{ "content": "<string>" }],
"search": { "domain_filter": ["<string>"] },
"stream": True,
"user_context": {}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{content: '<string>'}],
search: {domain_filter: ['<string>']},
stream: true,
user_context: {}
})
};
fetch('https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions', 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://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions",
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' => [
[
'content' => '<string>'
]
],
'search' => [
'domain_filter' => [
'<string>'
]
],
'stream' => true,
'user_context' => [
]
]),
CURLOPT_HTTPHEADER => [
"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://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"search\": {\n \"domain_filter\": [\n \"<string>\"\n ]\n },\n \"stream\": true,\n \"user_context\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"search\": {\n \"domain_filter\": [\n \"<string>\"\n ]\n },\n \"stream\": true,\n \"user_context\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://906e-2001-5a8-6cc-e000-55c0-f0b-9da7-10b0.ngrok-free.app/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {\n \"content\": \"<string>\"\n }\n ],\n \"search\": {\n \"domain_filter\": [\n \"<string>\"\n ]\n },\n \"stream\": true,\n \"user_context\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"choices": [
{
"index": 123,
"message": {
"content": "<string>"
}
}
]
},
"request_id": "<string>",
"meta": {
"api_version": "<string>",
"processing_ms": 123,
"tokens_used": 123,
"cost": {
"total": 1,
"breakdown": {}
}
}
}{
"error": "<string>"
}Generate chat completions with optional search augmentation.
Example Request
curl -X POST https://api.agentserp.com/chat/completions \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "Hello, who are you?"}]}'
Body
application/json
Input for POST /chat/completions
LLM engine to use
Minimum array length:
1Show child attributes
Show child attributes
Optional search-control block for chat
Show child attributes
Show child attributes
If true, SSE stream; else aggregate JSON
Opaque dict preserved across turns
Show child attributes
Show child attributes
⌘I