from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://api.subconscious.dev/v1",
)
response = client.chat.completions.create(
model="subconscious/glm-5.3-marathon",
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://api.subconscious.dev/v1",
});
const response = await client.chat.completions.create({
model: "subconscious/glm-5.3-marathon",
messages: [{ role: "user", content: "What is the capital of France?" }],
});
console.log(response.choices[0].message.content);curl https://api.subconscious.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "subconscious/glm-5.3-marathon",
"messages": [{"role": "user", "content": "What is the capital of France?"}]
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.subconscious.dev/v1/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' => 'subconscious/glm-5.3-marathon',
'messages' => [
[
'role' => 'user',
'content' => 'What is the capital of France?'
]
],
'stream' => false,
'max_tokens' => 123,
'max_completion_tokens' => 123,
'temperature' => 1,
'top_p' => 0.5,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'stop' => '<string>',
'response_format' => [
'json_schema' => [
'name' => '<string>',
'schema' => [
]
]
],
'stream_options' => [
'include_usage' => true
],
'chat_template_kwargs' => [
'enable_thinking' => true
],
'prompt_cache_key' => '<string>',
'session_id' => '<string>',
'providerOptions' => [
]
]),
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://api.subconscious.dev/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"subconscious/glm-5.3-marathon\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"json_schema\": {\n \"name\": \"<string>\",\n \"schema\": {}\n }\n },\n \"stream_options\": {\n \"include_usage\": true\n },\n \"chat_template_kwargs\": {\n \"enable_thinking\": true\n },\n \"prompt_cache_key\": \"<string>\",\n \"session_id\": \"<string>\",\n \"providerOptions\": {}\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://api.subconscious.dev/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"subconscious/glm-5.3-marathon\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"json_schema\": {\n \"name\": \"<string>\",\n \"schema\": {}\n }\n },\n \"stream_options\": {\n \"include_usage\": true\n },\n \"chat_template_kwargs\": {\n \"enable_thinking\": true\n },\n \"prompt_cache_key\": \"<string>\",\n \"session_id\": \"<string>\",\n \"providerOptions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.subconscious.dev/v1/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\": \"subconscious/glm-5.3-marathon\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"json_schema\": {\n \"name\": \"<string>\",\n \"schema\": {}\n }\n },\n \"stream_options\": {\n \"include_usage\": true\n },\n \"chat_template_kwargs\": {\n \"enable_thinking\": true\n },\n \"prompt_cache_key\": \"<string>\",\n \"session_id\": \"<string>\",\n \"providerOptions\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1716000000,
"model": "subconscious/glm-5.3-marathon",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Create Chat Completion
Generates a model response for the given conversation. This endpoint is fully compatible with the OpenAI Chat Completions API.
from openai import OpenAI
client = OpenAI(
api_key="your-api-key",
base_url="https://api.subconscious.dev/v1",
)
response = client.chat.completions.create(
model="subconscious/glm-5.3-marathon",
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(response.choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: "your-api-key",
baseURL: "https://api.subconscious.dev/v1",
});
const response = await client.chat.completions.create({
model: "subconscious/glm-5.3-marathon",
messages: [{ role: "user", content: "What is the capital of France?" }],
});
console.log(response.choices[0].message.content);curl https://api.subconscious.dev/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "subconscious/glm-5.3-marathon",
"messages": [{"role": "user", "content": "What is the capital of France?"}]
}'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.subconscious.dev/v1/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' => 'subconscious/glm-5.3-marathon',
'messages' => [
[
'role' => 'user',
'content' => 'What is the capital of France?'
]
],
'stream' => false,
'max_tokens' => 123,
'max_completion_tokens' => 123,
'temperature' => 1,
'top_p' => 0.5,
'frequency_penalty' => 0,
'presence_penalty' => 0,
'stop' => '<string>',
'response_format' => [
'json_schema' => [
'name' => '<string>',
'schema' => [
]
]
],
'stream_options' => [
'include_usage' => true
],
'chat_template_kwargs' => [
'enable_thinking' => true
],
'prompt_cache_key' => '<string>',
'session_id' => '<string>',
'providerOptions' => [
]
]),
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://api.subconscious.dev/v1/chat/completions"
payload := strings.NewReader("{\n \"model\": \"subconscious/glm-5.3-marathon\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"json_schema\": {\n \"name\": \"<string>\",\n \"schema\": {}\n }\n },\n \"stream_options\": {\n \"include_usage\": true\n },\n \"chat_template_kwargs\": {\n \"enable_thinking\": true\n },\n \"prompt_cache_key\": \"<string>\",\n \"session_id\": \"<string>\",\n \"providerOptions\": {}\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://api.subconscious.dev/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"subconscious/glm-5.3-marathon\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"json_schema\": {\n \"name\": \"<string>\",\n \"schema\": {}\n }\n },\n \"stream_options\": {\n \"include_usage\": true\n },\n \"chat_template_kwargs\": {\n \"enable_thinking\": true\n },\n \"prompt_cache_key\": \"<string>\",\n \"session_id\": \"<string>\",\n \"providerOptions\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.subconscious.dev/v1/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\": \"subconscious/glm-5.3-marathon\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n ],\n \"stream\": false,\n \"max_tokens\": 123,\n \"max_completion_tokens\": 123,\n \"temperature\": 1,\n \"top_p\": 0.5,\n \"frequency_penalty\": 0,\n \"presence_penalty\": 0,\n \"stop\": \"<string>\",\n \"response_format\": {\n \"json_schema\": {\n \"name\": \"<string>\",\n \"schema\": {}\n }\n },\n \"stream_options\": {\n \"include_usage\": true\n },\n \"chat_template_kwargs\": {\n \"enable_thinking\": true\n },\n \"prompt_cache_key\": \"<string>\",\n \"session_id\": \"<string>\",\n \"providerOptions\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1716000000,
"model": "subconscious/glm-5.3-marathon",
"choices": [
{
"index": 123,
"message": {
"role": "assistant",
"content": "<string>"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 123,
"completion_tokens": 123,
"total_tokens": 123
}
}Headers
Labels your traffic in usage views. See Request correlation.
Groups requests into one conversation (replace yourapp with your app name). See Session affinity.
Nests a subagent under the conversation that spawned it. See Subagent correlation.
Body
Routing hint that groups requests into one conversation only when no session header or body session id is present. See Session affinity.
256Body session id, also spelled sessionId and providerOptions.gateway.sessionId. Between 8 and 256 characters. See Session affinity.
8 - 256Vercel AI SDK provider options. Only gateway.sessionId is read, as a body session id. See Session affinity.
Response
Successful completion
Was this page helpful?