補全
創建補全
讓提示詞經過完整的編排流水線 — 意圖分類、技能加載、模型路由、代理循環與響應生成。
POST
/
api
/
v1
/
completions
創建補全
curl --request POST \
--url https://api.example.com/api/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"mode": "<string>",
"stream": true,
"conversation_id": "<string>",
"skills": [
"<string>"
],
"tools": [
{
"name": "<string>",
"description": "<string>",
"input_schema": {}
}
],
"persona": {},
"temperature": 123,
"max_iterations": 123,
"model_overrides": {},
"format": "<string>",
"metadata": {},
"component_library": "<string>",
"memory": true,
"conversation": {},
"response_style": {},
"personality_config": {},
"theo_branding": true,
"brand_soul": true,
"attachments": [
{}
],
"image_model": "<string>",
"image_quality": "<string>",
"stealth_model": "<string>",
"stealth_aspect": "<string>",
"stealth_duration": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/completions"
payload = {
"prompt": "<string>",
"mode": "<string>",
"stream": True,
"conversation_id": "<string>",
"skills": ["<string>"],
"tools": [
{
"name": "<string>",
"description": "<string>",
"input_schema": {}
}
],
"persona": {},
"temperature": 123,
"max_iterations": 123,
"model_overrides": {},
"format": "<string>",
"metadata": {},
"component_library": "<string>",
"memory": True,
"conversation": {},
"response_style": {},
"personality_config": {},
"theo_branding": True,
"brand_soul": True,
"attachments": [{}],
"image_model": "<string>",
"image_quality": "<string>",
"stealth_model": "<string>",
"stealth_aspect": "<string>",
"stealth_duration": "<string>"
}
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({
prompt: '<string>',
mode: '<string>',
stream: true,
conversation_id: '<string>',
skills: ['<string>'],
tools: [{name: '<string>', description: '<string>', input_schema: {}}],
persona: {},
temperature: 123,
max_iterations: 123,
model_overrides: {},
format: '<string>',
metadata: {},
component_library: '<string>',
memory: true,
conversation: {},
response_style: {},
personality_config: {},
theo_branding: true,
brand_soul: true,
attachments: [{}],
image_model: '<string>',
image_quality: '<string>',
stealth_model: '<string>',
stealth_aspect: '<string>',
stealth_duration: '<string>'
})
};
fetch('https://api.example.com/api/v1/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://api.example.com/api/v1/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([
'prompt' => '<string>',
'mode' => '<string>',
'stream' => true,
'conversation_id' => '<string>',
'skills' => [
'<string>'
],
'tools' => [
[
'name' => '<string>',
'description' => '<string>',
'input_schema' => [
]
]
],
'persona' => [
],
'temperature' => 123,
'max_iterations' => 123,
'model_overrides' => [
],
'format' => '<string>',
'metadata' => [
],
'component_library' => '<string>',
'memory' => true,
'conversation' => [
],
'response_style' => [
],
'personality_config' => [
],
'theo_branding' => true,
'brand_soul' => true,
'attachments' => [
[
]
],
'image_model' => '<string>',
'image_quality' => '<string>',
'stealth_model' => '<string>',
'stealth_aspect' => '<string>',
'stealth_duration' => '<string>'
]),
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://api.example.com/api/v1/completions"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"mode\": \"<string>\",\n \"stream\": true,\n \"conversation_id\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"persona\": {},\n \"temperature\": 123,\n \"max_iterations\": 123,\n \"model_overrides\": {},\n \"format\": \"<string>\",\n \"metadata\": {},\n \"component_library\": \"<string>\",\n \"memory\": true,\n \"conversation\": {},\n \"response_style\": {},\n \"personality_config\": {},\n \"theo_branding\": true,\n \"brand_soul\": true,\n \"attachments\": [\n {}\n ],\n \"image_model\": \"<string>\",\n \"image_quality\": \"<string>\",\n \"stealth_model\": \"<string>\",\n \"stealth_aspect\": \"<string>\",\n \"stealth_duration\": \"<string>\"\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://api.example.com/api/v1/completions")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"mode\": \"<string>\",\n \"stream\": true,\n \"conversation_id\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"persona\": {},\n \"temperature\": 123,\n \"max_iterations\": 123,\n \"model_overrides\": {},\n \"format\": \"<string>\",\n \"metadata\": {},\n \"component_library\": \"<string>\",\n \"memory\": true,\n \"conversation\": {},\n \"response_style\": {},\n \"personality_config\": {},\n \"theo_branding\": true,\n \"brand_soul\": true,\n \"attachments\": [\n {}\n ],\n \"image_model\": \"<string>\",\n \"image_quality\": \"<string>\",\n \"stealth_model\": \"<string>\",\n \"stealth_aspect\": \"<string>\",\n \"stealth_duration\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/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 \"prompt\": \"<string>\",\n \"mode\": \"<string>\",\n \"stream\": true,\n \"conversation_id\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"persona\": {},\n \"temperature\": 123,\n \"max_iterations\": 123,\n \"model_overrides\": {},\n \"format\": \"<string>\",\n \"metadata\": {},\n \"component_library\": \"<string>\",\n \"memory\": true,\n \"conversation\": {},\n \"response_style\": {},\n \"personality_config\": {},\n \"theo_branding\": true,\n \"brand_soul\": true,\n \"attachments\": [\n {}\n ],\n \"image_model\": \"<string>\",\n \"image_quality\": \"<string>\",\n \"stealth_model\": \"<string>\",\n \"stealth_aspect\": \"<string>\",\n \"stealth_duration\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": "<string>",
"content": "<string>",
"mode": "<string>",
"resolved_mode": "<string>",
"model": {
"id": "<string>",
"label": "<string>",
"engine": "<string>"
},
"tools_used": [
{
"name": "<string>",
"status": "<string>",
"description": "<string>"
}
],
"artifacts": [
{}
],
"follow_ups": [
{
"label": "<string>",
"prompt": "<string>"
}
],
"usage": {
"cost_cents": 123,
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"cached": true
},
"metadata": {},
"conversation_id": {},
"request_id": "<string>"
}Theo API 的核心端點。讓提示詞經過完整的編排流水線,並返回完整的響應。
該響應遵循 OpenAI 的
如需實時令牌傳輸,請設置
stream: true,或參閱 流式補全。認證
需要 Bearer 令牌。參閱 認證。Authorization: Bearer theo_sk_...
請求體
string
必填
提示詞文本。必須為非空字符串。
string
預設值:"auto"
執行模式。設置為
auto 時,Theo 會對提示詞進行分類並自動選擇最優引擎。可用模式:auto— 對提示詞分類並路由到最佳引擎(默認)fast— 面向簡單查詢的低延遲響應think— 面向複雜分析的深度推理code— 代碼生成(Theo Code 引擎,擴展輸出預算)image— 圖像生成(Theo Create)video— 異步。 請使用POST /api/v1/video並輪詢任務狀態,而不是本端點。research— 異步。 請使用POST /api/v1/research並輪詢任務狀態,而不是本端點。roast— 幽默、不拘一格的語氣genui— 生成交互式 UI 組件(OpenUI Lang)
research 和 video 是異步的,不得發送給 /completions(或 stream())。它們以後台任務形式運行;在此處調用會導致工作被內聯執行,請求會在完成前觸發超時。請通過 POST /api/v1/research / POST /api/v1/video 將其加入隊列,並使用 獲取任務狀態 進行輪詢。@hitheo/sdk 在你把這些模式傳給 complete() / stream() 時會立即拋出 TheoUsageError。參閱 異步任務指南。string
延續一段已有的對話。傳入對話 ID 以保持多輪上下文。
string[]
本次請求要激活的技能 slug。這些技能會與用戶已安裝的技能合併。每個 slug 會為本次補全激活相應技能的提示擴展、工具和模型偏好。你可以在控制台(每張技能卡片上的複製圖標)、
GET /api/v1/skills,或技能構建器的 Input 節點中找到 slug。完整指南參閱 通過 API 激活技能。object[]
string | object
預設值:"theo"
為本次請求覆蓋 Theo 的人格設定。
"theo"— 默認的 Theo 角色"none"— 不使用角色(原始模型輸出){ "system_prompt": "You are..." }— 自定義系統提示詞
number
採樣温度(0–2)。數值越高,輸出越具創造性。
integer
預設值:"8"
代理循環的最大迭代次數(1–20)。每次迭代為一個「思考 → 行動 → 觀察」循環。
object
為特定模式覆蓋所用引擎。鍵為模式名稱(例如
"code"、"think"),值為 Theo 引擎 ID(例如 "theo-1-reason"、"theo-1-flash")。有效引擎 ID 參閱 列出模型。string
預設值:"theo"
響應格式。
"theo" 為默認格式,"openai" 為兼容 OpenAI 的格式。object
附加在此次補全上的任意鍵值元數據。會在響應中原樣返回,並記錄在審計日誌中。
string
GenUI 模式下的組件庫標識符。供 E.V.I. 調用方用於自定義 UI 渲染。
boolean
預設值:"true"
設為
false 可跳過本次請求的長期記憶檢索與注入。適用於無狀態 / 對隱私敏感的調用場景,即不希望歷史記憶影響本次回答。object
面向無狀態調用方的內聯對話信封 — 當未提供
conversation_id 時,服務器會使用其中最近的 messages(最多 20 條),使「再寫長一點」這類追問能夠正確解析上下文。object
按請求覆蓋的響應風格配置(格式、精確度、意圖),疊加在該密鑰的默認設置之上。
object
按請求覆蓋的人格 / 特質配置疊加層。
boolean
預設值:"true"
品牌總開關。設為
false 會從系統提示詞中剝離 Theo 的角色 / 品牌信息(對 persona 的超集控制)。boolean
設為
true 時,會將響應限定在該密鑰的品牌目錄(Brand Soul)範圍內 — 只推薦你自己的產品/內容,並將偏離主題的請求引導回來。object[]
用於視覺輪次的圖片附件。每項為
{ type: "image_url", url } 或 { type: "image_base64", data, mime_type }(PNG / JPEG / WebP / GIF,base64 編碼後 ≤ 15MB)。string
為
image 模式固定圖像子引擎(否則自動選擇)。string
為
image 模式固定圖像質量檔位。string
隱身媒體模型固定(
stealth_image / stealth_video)。string
隱身媒體的寬高比。
string
隱身視頻片段的時長。
請求示例
curl -X POST https://www.hitheo.ai/api/v1/completions \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Explain microservices architecture",
"mode": "auto",
"temperature": 0.7
}'
import { Theo } from "@hitheo/sdk";
const theo = new Theo({ apiKey: process.env.THEO_API_KEY! });
const res = await theo.complete({
prompt: "Explain microservices architecture",
mode: "auto",
temperature: 0.7,
});
console.log(res.content);
console.log(res.model.label); // e.g. "Theo Flash"
console.log(res.usage.cost_cents); // e.g. 0.02
結合技能與工具
curl -X POST https://www.hitheo.ai/api/v1/completions \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Check current inventory levels for SKU-1234",
"mode": "auto",
"skills": ["inventory-check"],
"tools": [
{
"name": "check_stock",
"description": "Look up current stock levels by SKU",
"input_schema": {
"type": "object",
"properties": {
"sku": { "type": "string" },
"warehouse": { "type": "string" }
},
"required": ["sku"]
}
}
],
"persona": { "system_prompt": "You are Atlas, an operations assistant." },
"max_iterations": 5
}'
const res = await theo.complete({
prompt: "Check current inventory levels for SKU-1234",
skills: ["inventory-check"],
tools: [
{
name: "check_stock",
description: "Look up current stock levels by SKU",
input_schema: {
type: "object",
properties: {
sku: { type: "string" },
warehouse: { type: "string" },
},
required: ["sku"],
},
},
],
persona: { system_prompt: "You are Atlas, an operations assistant." },
max_iterations: 5,
});
響應
string
唯一的補全 ID(前綴為
cmpl_)。string
固定為
"completion"。string
ISO 8601 時間戳。
string
生成的文本內容。
string
你請求時指定的模式(例如
"auto")。string
Theo 在意圖分類後實際使用的模式(例如
"fast"、"think"、"code")。object
object[]
在本次補全過程中生成的文件(圖片、代碼、文檔)。
object
對於非文本模式(
image、video、tts、stt),prompt_tokens 和 completion_tokens 始終為 0 — 令牌在這些場景下不是有意義的計費單位。請以 usage.cost_cents 作為這些模式下唯一的用量指標。object | null
你在請求中傳入的元數據,原樣回傳。
string | null
本輪對話最終解析所依據的服務端會話 ID。若未創建或關聯任何會話,則為
null。若請求中傳入了 conversation_id,則原樣回傳。string
服務器分配的請求標識符(同時以
X-Request-Id 響應頭返回)。在提交支持工單時附上此值,便於我們在日誌中查詢該請求。響應示例
{
"id": "cmpl_abc123",
"object": "completion",
"created": "2026-04-10T12:00:00Z",
"content": "Microservices architecture is a design pattern where an application is composed of small, independent services...",
"mode": "auto",
"resolved_mode": "fast",
"model": {
"id": "theo-1-flash",
"label": "Theo Flash",
"engine": "theo-core"
},
"tools_used": [],
"artifacts": [],
"follow_ups": [
{ "label": "Compare with monoliths", "prompt": "Compare microservices vs monolithic architecture" },
{ "label": "Service mesh", "prompt": "Explain service mesh in microservices" }
],
"usage": {
"cost_cents": 0.02,
"prompt_tokens": 12,
"completion_tokens": 156,
"total_tokens": 168
},
"metadata": null,
"conversation_id": null,
"request_id": "req_9f2e1a"
}
兼容 OpenAI 的格式
傳入format: "openai" 即可獲得符合 OpenAI chat.completions 格式的響應。這使其可以直接替換現有基於 OpenAI 的應用。
curl -X POST https://www.hitheo.ai/api/v1/completions \
-H "Authorization: Bearer $THEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Hello",
"format": "openai"
}'
chat.completion 結構,包含 choices、usage 和 model 字段。
語義緩存
非會話類補全(未提供conversation_id)會被自動緩存。相同的請求會零成本即時返回緩存結果。參閱 語義緩存。
緩存命中的響應體中會包含 "_cached": true。
錯誤
| 狀態碼 | 錯誤碼 | 說明 |
|---|---|---|
| 400 | validation_error | 請求體無效(缺少 prompt、mode 非法等) |
| 400 | context_length_exceeded | 請求超出該密鑰上最大的上下文窗口 — 請添加支持更大上下文的模型或縮短請求內容 |
| 401 | invalid_api_key | API 密鑰缺失或無效 |
| 402 | insufficient_credits | 賬戶餘額不足 |
| 403 | model_not_allowed | 請求解析到的模型不在該密鑰的模型允許列表中 |
| 404 | not_found | 未找到該對話 ID |
| 422 | guardrail_violation | 該密鑰上的某條 Gateway Guardrails 策略拒絕了該請求 |
| 422 | orchestrator_no_path | 該密鑰的編排器圖未能為此請求解析出可用路徑 |
| 429 | rate_limit_exceeded | 請求過於頻繁 — 請查看 Retry-After 響應頭 |
| 500 | server_error | 服務器內部錯誤 |
這個頁面有幫助嗎?
創建補全
curl --request POST \
--url https://api.example.com/api/v1/completions \
--header 'Content-Type: application/json' \
--data '
{
"prompt": "<string>",
"mode": "<string>",
"stream": true,
"conversation_id": "<string>",
"skills": [
"<string>"
],
"tools": [
{
"name": "<string>",
"description": "<string>",
"input_schema": {}
}
],
"persona": {},
"temperature": 123,
"max_iterations": 123,
"model_overrides": {},
"format": "<string>",
"metadata": {},
"component_library": "<string>",
"memory": true,
"conversation": {},
"response_style": {},
"personality_config": {},
"theo_branding": true,
"brand_soul": true,
"attachments": [
{}
],
"image_model": "<string>",
"image_quality": "<string>",
"stealth_model": "<string>",
"stealth_aspect": "<string>",
"stealth_duration": "<string>"
}
'import requests
url = "https://api.example.com/api/v1/completions"
payload = {
"prompt": "<string>",
"mode": "<string>",
"stream": True,
"conversation_id": "<string>",
"skills": ["<string>"],
"tools": [
{
"name": "<string>",
"description": "<string>",
"input_schema": {}
}
],
"persona": {},
"temperature": 123,
"max_iterations": 123,
"model_overrides": {},
"format": "<string>",
"metadata": {},
"component_library": "<string>",
"memory": True,
"conversation": {},
"response_style": {},
"personality_config": {},
"theo_branding": True,
"brand_soul": True,
"attachments": [{}],
"image_model": "<string>",
"image_quality": "<string>",
"stealth_model": "<string>",
"stealth_aspect": "<string>",
"stealth_duration": "<string>"
}
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({
prompt: '<string>',
mode: '<string>',
stream: true,
conversation_id: '<string>',
skills: ['<string>'],
tools: [{name: '<string>', description: '<string>', input_schema: {}}],
persona: {},
temperature: 123,
max_iterations: 123,
model_overrides: {},
format: '<string>',
metadata: {},
component_library: '<string>',
memory: true,
conversation: {},
response_style: {},
personality_config: {},
theo_branding: true,
brand_soul: true,
attachments: [{}],
image_model: '<string>',
image_quality: '<string>',
stealth_model: '<string>',
stealth_aspect: '<string>',
stealth_duration: '<string>'
})
};
fetch('https://api.example.com/api/v1/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://api.example.com/api/v1/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([
'prompt' => '<string>',
'mode' => '<string>',
'stream' => true,
'conversation_id' => '<string>',
'skills' => [
'<string>'
],
'tools' => [
[
'name' => '<string>',
'description' => '<string>',
'input_schema' => [
]
]
],
'persona' => [
],
'temperature' => 123,
'max_iterations' => 123,
'model_overrides' => [
],
'format' => '<string>',
'metadata' => [
],
'component_library' => '<string>',
'memory' => true,
'conversation' => [
],
'response_style' => [
],
'personality_config' => [
],
'theo_branding' => true,
'brand_soul' => true,
'attachments' => [
[
]
],
'image_model' => '<string>',
'image_quality' => '<string>',
'stealth_model' => '<string>',
'stealth_aspect' => '<string>',
'stealth_duration' => '<string>'
]),
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://api.example.com/api/v1/completions"
payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"mode\": \"<string>\",\n \"stream\": true,\n \"conversation_id\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"persona\": {},\n \"temperature\": 123,\n \"max_iterations\": 123,\n \"model_overrides\": {},\n \"format\": \"<string>\",\n \"metadata\": {},\n \"component_library\": \"<string>\",\n \"memory\": true,\n \"conversation\": {},\n \"response_style\": {},\n \"personality_config\": {},\n \"theo_branding\": true,\n \"brand_soul\": true,\n \"attachments\": [\n {}\n ],\n \"image_model\": \"<string>\",\n \"image_quality\": \"<string>\",\n \"stealth_model\": \"<string>\",\n \"stealth_aspect\": \"<string>\",\n \"stealth_duration\": \"<string>\"\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://api.example.com/api/v1/completions")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"<string>\",\n \"mode\": \"<string>\",\n \"stream\": true,\n \"conversation_id\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"persona\": {},\n \"temperature\": 123,\n \"max_iterations\": 123,\n \"model_overrides\": {},\n \"format\": \"<string>\",\n \"metadata\": {},\n \"component_library\": \"<string>\",\n \"memory\": true,\n \"conversation\": {},\n \"response_style\": {},\n \"personality_config\": {},\n \"theo_branding\": true,\n \"brand_soul\": true,\n \"attachments\": [\n {}\n ],\n \"image_model\": \"<string>\",\n \"image_quality\": \"<string>\",\n \"stealth_model\": \"<string>\",\n \"stealth_aspect\": \"<string>\",\n \"stealth_duration\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/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 \"prompt\": \"<string>\",\n \"mode\": \"<string>\",\n \"stream\": true,\n \"conversation_id\": \"<string>\",\n \"skills\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"input_schema\": {}\n }\n ],\n \"persona\": {},\n \"temperature\": 123,\n \"max_iterations\": 123,\n \"model_overrides\": {},\n \"format\": \"<string>\",\n \"metadata\": {},\n \"component_library\": \"<string>\",\n \"memory\": true,\n \"conversation\": {},\n \"response_style\": {},\n \"personality_config\": {},\n \"theo_branding\": true,\n \"brand_soul\": true,\n \"attachments\": [\n {}\n ],\n \"image_model\": \"<string>\",\n \"image_quality\": \"<string>\",\n \"stealth_model\": \"<string>\",\n \"stealth_aspect\": \"<string>\",\n \"stealth_duration\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"object": "<string>",
"created": "<string>",
"content": "<string>",
"mode": "<string>",
"resolved_mode": "<string>",
"model": {
"id": "<string>",
"label": "<string>",
"engine": "<string>"
},
"tools_used": [
{
"name": "<string>",
"status": "<string>",
"description": "<string>"
}
],
"artifacts": [
{}
],
"follow_ups": [
{
"label": "<string>",
"prompt": "<string>"
}
],
"usage": {
"cost_cents": 123,
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123,
"cached": true
},
"metadata": {},
"conversation_id": {},
"request_id": "<string>"
}