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
]
]),
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}")
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}")
.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}"
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
]
]),
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}")
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}")
.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}"
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
}
}Authorizations
API key from your Subconscious dashboard
Body
The model to use for completion.
subconscious/glm-5.3-marathon "subconscious/glm-5.3-marathon"
The conversation history. Each message has a role and content.
Show child attributes
Show child attributes
[
{
"role": "user",
"content": "What is the capital of France?"
}
]
If true, responses are streamed as Server-Sent Events. Each event is a ChatCompletionChunk object. The stream ends with data: [DONE].
Maximum number of tokens to generate in the response.
An alternative to max_tokens. Maximum number of tokens to generate.
Sampling temperature between 0 and 2. Lower values make output more focused and deterministic, while higher values make it more creative.
0 <= x <= 2Nucleus sampling parameter. Only considers tokens whose cumulative probability exceeds this threshold.
0 <= x <= 1Penalizes tokens based on their frequency in the text so far.
-2 <= x <= 2Penalizes tokens based on whether they appear in the text so far.
-2 <= x <= 2Up to 4 sequences where the model will stop generating.
Currently unsupported. The request may accept this field, but it is ignored and does not constrain the model output to JSON or a schema.
Show child attributes
Show child attributes
Options for streaming responses.
Show child attributes
Show child attributes
Subconscious extension. Controls model-specific features like thinking mode.
Show child attributes
Show child attributes
Response
Successful completion
A unique identifier for the completion.
"chatcmpl-abc123"
The object type.
chat.completion Unix timestamp of when the completion was created.
1716000000
The model used for the completion.
"subconscious/glm-5.3-marathon"
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?