补全
创建补全
让提示词经过完整的编排流水线 — 意图分类、技能加载、模型路由、代理循环与响应生成。
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>"
}