curl --request POST \
--url https://modelhub.corepillar.ai/api/v1/chat/stream \
--header 'Content-Type: application/json' \
--cookie session= \
--data '
{
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "<string>",
"modelConfigId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"orgSlug": "<string>",
"projectSlug": "<string>",
"history": [],
"attachments": [],
"optimizePrompt": true,
"overridePiiBlock": true,
"restoreMap": {}
}
'import requests
url = "https://modelhub.corepillar.ai/api/v1/chat/stream"
payload = {
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "<string>",
"modelConfigId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"orgSlug": "<string>",
"projectSlug": "<string>",
"history": [],
"attachments": [],
"optimizePrompt": True,
"overridePiiBlock": True,
"restoreMap": {}
}
headers = {
"cookie": "session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
conversationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
message: '<string>',
modelConfigId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
orgSlug: '<string>',
projectSlug: '<string>',
history: [],
attachments: [],
optimizePrompt: true,
overridePiiBlock: true,
restoreMap: {}
})
};
fetch('https://modelhub.corepillar.ai/api/v1/chat/stream', 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://modelhub.corepillar.ai/api/v1/chat/stream",
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([
'conversationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'message' => '<string>',
'modelConfigId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'orgSlug' => '<string>',
'projectSlug' => '<string>',
'history' => [
],
'attachments' => [
],
'optimizePrompt' => true,
'overridePiiBlock' => true,
'restoreMap' => [
]
]),
CURLOPT_COOKIE => "session=",
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://modelhub.corepillar.ai/api/v1/chat/stream"
payload := strings.NewReader("{\n \"conversationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"message\": \"<string>\",\n \"modelConfigId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orgSlug\": \"<string>\",\n \"projectSlug\": \"<string>\",\n \"history\": [],\n \"attachments\": [],\n \"optimizePrompt\": true,\n \"overridePiiBlock\": true,\n \"restoreMap\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "session=")
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://modelhub.corepillar.ai/api/v1/chat/stream")
.header("cookie", "session=")
.header("Content-Type", "application/json")
.body("{\n \"conversationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"message\": \"<string>\",\n \"modelConfigId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orgSlug\": \"<string>\",\n \"projectSlug\": \"<string>\",\n \"history\": [],\n \"attachments\": [],\n \"optimizePrompt\": true,\n \"overridePiiBlock\": true,\n \"restoreMap\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://modelhub.corepillar.ai/api/v1/chat/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"message\": \"<string>\",\n \"modelConfigId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orgSlug\": \"<string>\",\n \"projectSlug\": \"<string>\",\n \"history\": [],\n \"attachments\": [],\n \"optimizePrompt\": true,\n \"overridePiiBlock\": true,\n \"restoreMap\": {}\n}"
response = http.request(request)
puts response.read_bodydata: {"type":"masked","user":"Email [EMAIL_01] the summary","revealMap":{}}
data: {"type":"routing", "...": "..."}
data: {"type":"delta","text":"Here is"}
data: {"type":"done", "...": "..."}
{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Send a chat message
One ModelHub chat turn. The message (and any attachment text) is screened for personal data and masked before any model sees it, routed to a model (or the one you picked), and streamed back as server-sent events with masked values restored for you.
Events, each as data: {json}:
masked: your turn in masked form, plus a display-safe reveal maprouting: which model was chosen and why, and the prompt tidy-up appliedpii: what the privacy scan founddelta: a chunk of the answerdone: final analysis, ids, masked history entries and the restore maperror: what went wrong
A message containing a credential or government identifier is held: you get pii then error, and must resend with overridePiiBlock: true. The server keeps no conversation state; send prior turns in history (masked forms, from done.masked) and the accumulated restoreMap.
Auth: session. Permission: member of the organization and project named in the body.
curl --request POST \
--url https://modelhub.corepillar.ai/api/v1/chat/stream \
--header 'Content-Type: application/json' \
--cookie session= \
--data '
{
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "<string>",
"modelConfigId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"orgSlug": "<string>",
"projectSlug": "<string>",
"history": [],
"attachments": [],
"optimizePrompt": true,
"overridePiiBlock": true,
"restoreMap": {}
}
'import requests
url = "https://modelhub.corepillar.ai/api/v1/chat/stream"
payload = {
"conversationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"message": "<string>",
"modelConfigId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"orgSlug": "<string>",
"projectSlug": "<string>",
"history": [],
"attachments": [],
"optimizePrompt": True,
"overridePiiBlock": True,
"restoreMap": {}
}
headers = {
"cookie": "session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
conversationId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
message: '<string>',
modelConfigId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
orgSlug: '<string>',
projectSlug: '<string>',
history: [],
attachments: [],
optimizePrompt: true,
overridePiiBlock: true,
restoreMap: {}
})
};
fetch('https://modelhub.corepillar.ai/api/v1/chat/stream', 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://modelhub.corepillar.ai/api/v1/chat/stream",
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([
'conversationId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'message' => '<string>',
'modelConfigId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'orgSlug' => '<string>',
'projectSlug' => '<string>',
'history' => [
],
'attachments' => [
],
'optimizePrompt' => true,
'overridePiiBlock' => true,
'restoreMap' => [
]
]),
CURLOPT_COOKIE => "session=",
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://modelhub.corepillar.ai/api/v1/chat/stream"
payload := strings.NewReader("{\n \"conversationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"message\": \"<string>\",\n \"modelConfigId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orgSlug\": \"<string>\",\n \"projectSlug\": \"<string>\",\n \"history\": [],\n \"attachments\": [],\n \"optimizePrompt\": true,\n \"overridePiiBlock\": true,\n \"restoreMap\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "session=")
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://modelhub.corepillar.ai/api/v1/chat/stream")
.header("cookie", "session=")
.header("Content-Type", "application/json")
.body("{\n \"conversationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"message\": \"<string>\",\n \"modelConfigId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orgSlug\": \"<string>\",\n \"projectSlug\": \"<string>\",\n \"history\": [],\n \"attachments\": [],\n \"optimizePrompt\": true,\n \"overridePiiBlock\": true,\n \"restoreMap\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://modelhub.corepillar.ai/api/v1/chat/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"conversationId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"message\": \"<string>\",\n \"modelConfigId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"orgSlug\": \"<string>\",\n \"projectSlug\": \"<string>\",\n \"history\": [],\n \"attachments\": [],\n \"optimizePrompt\": true,\n \"overridePiiBlock\": true,\n \"restoreMap\": {}\n}"
response = http.request(request)
puts response.read_bodydata: {"type":"masked","user":"Email [EMAIL_01] the summary","revealMap":{}}
data: {"type":"routing", "...": "..."}
data: {"type":"delta","text":"Here is"}
data: {"type":"done", "...": "..."}
{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
The session cookie set when you sign in to AgentHub or ModelHub in a browser. The cookie name shown here is illustrative. There are no API tokens for these endpoints.
Body
null starts a new conversation.
1 - 32000A specific model, or null to let routing choose.
11Prior turns, oldest first, in masked form. At most 20 exchanges.
40Show child attributes
Show child attributes
Text from POST /chat/attachments. Up to 50,000 characters each and 100,000 in total.
5Show child attributes
Show child attributes
Tidy the prompt (whitespace, stock politeness) before sending.
Continue after a held turn. The value is still masked.
Placeholder to real value, accumulated from earlier done events. At most 400 entries.
Show child attributes
Show child attributes
Response
Server-sent event stream.
The response is of type string.