Chat completions
curl --request POST \
--url https://osis.co/api/v1/comms/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"temperature": 123,
"max_tokens": 123,
"stream": true
}
'import requests
url = "https://osis.co/api/v1/comms/chat/completions"
payload = {
"model": "<string>",
"messages": [{}],
"temperature": 123,
"max_tokens": 123,
"stream": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
temperature: 123,
max_tokens: 123,
stream: true
})
};
fetch('https://osis.co/api/v1/comms/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://osis.co/api/v1/comms/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' => [
[
]
],
'temperature' => 123,
'max_tokens' => 123,
'stream' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://osis.co/api/v1/comms/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"stream\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://osis.co/api/v1/comms/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://osis.co/api/v1/comms/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"stream\": true\n}"
response = http.request(request)
puts response.read_bodyAI
Chat completions
POST /api/v1/comms/chat/completions — OpenAI-shaped pass-through AI on your Comms workspace.
POST
https://osis.co
/
api
/
v1
/
comms
/
chat
/
completions
Chat completions
curl --request POST \
--url https://osis.co/api/v1/comms/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"messages": [
{}
],
"temperature": 123,
"max_tokens": 123,
"stream": true
}
'import requests
url = "https://osis.co/api/v1/comms/chat/completions"
payload = {
"model": "<string>",
"messages": [{}],
"temperature": 123,
"max_tokens": 123,
"stream": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
messages: [{}],
temperature: 123,
max_tokens: 123,
stream: true
})
};
fetch('https://osis.co/api/v1/comms/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://osis.co/api/v1/comms/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' => [
[
]
],
'temperature' => 123,
'max_tokens' => 123,
'stream' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://osis.co/api/v1/comms/chat/completions"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"stream\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://osis.co/api/v1/comms/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"stream\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://osis.co/api/v1/comms/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"messages\": [\n {}\n ],\n \"temperature\": 123,\n \"max_tokens\": 123,\n \"stream\": true\n}"
response = http.request(request)
puts response.read_bodyCall the workspace model from your backend. The request and response match OpenAI chat completions. Tokens are metered on your Comms plan.
Scope:
Quota response:
comms_ai
This is pass-through AI. You do not bring your own model key. Usage from this endpoint and from hosted agent replies share one meter.
Request
curl -X POST "https://osis.co/api/v1/comms/chat/completions" \
-H "Authorization: Bearer $COMMS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [
{ "role": "system", "content": "You write short SMS replies." },
{ "role": "user", "content": "Confirm Tuesday at 3pm in one sentence." }
]
}'
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <COMMS_API_KEY> |
Content-Type | Yes | application/json |
Body parameters
string
Workspace model id. Use
claude-sonnet-5 or default.array
required
Chat messages. Each item has
role (system, user, assistant, or tool) and string content.number
Optional.
0–2. Defaults to 0.7.integer
Optional.
16–8192. Defaults to 1024.boolean
Must be omitted or
false. Streaming is not supported yet.Response
{
"id": "chatcmpl_01HZX…",
"object": "chat.completion",
"created": 1771459200,
"model": "claude-sonnet-5",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "You're confirmed for Tuesday at 3pm."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 24,
"completion_tokens": 12,
"total_tokens": 36
}
}
Errors
| Status | Meaning |
|---|---|
| 400 | Invalid body, model, or stream: true |
| 401 | Missing or invalid key |
| 402 | AI token quota reached for this plan |
| 403 | Key is missing comms_ai |
| 503 | Workspace AI is not configured |
{
"error": "Free plan AI token quota reached (100,000 of 100,000 this month). Upgrade the Comms plan to continue.",
"code": "ai_quota_exceeded",
"used": 100000,
"included": 100000,
"remaining": 0
}
Related
⌘I