from anthropic import Anthropic
client = Anthropic(
auth_token="your-api-key",
base_url="https://api.subconscious.dev",
)
message = client.messages.create(
model="subconscious/glm-5.3-marathon",
max_tokens=1024,
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(message.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
authToken: "your-api-key",
baseURL: "https://api.subconscious.dev",
});
const message = await client.messages.create({
model: "subconscious/glm-5.3-marathon",
max_tokens: 1024,
messages: [{ role: "user", content: "What is the capital of France?" }],
});
console.log(message.content[0].text);curl https://api.subconscious.dev/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "subconscious/glm-5.3-marathon",
"max_tokens": 1024,
"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/messages",
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?'
]
],
'max_tokens' => 1024,
'system' => '<string>',
'stream' => false,
'temperature' => 0.5,
'top_p' => 0.5,
'top_k' => 123,
'stop_sequences' => [
'<string>'
],
'tools' => [
[
'name' => '<string>',
'input_schema' => [
],
'description' => '<string>'
]
],
'tool_choice' => [
'name' => '<string>'
],
'thinking' => [
'type' => 'enabled',
'budget_tokens' => 123
],
'metadata' => [
'user_id' => '<string>'
],
'chat_template_kwargs' => [
'enable_auto_compaction' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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/messages"
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 \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"stream\": false,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"chat_template_kwargs\": {\n \"enable_auto_compaction\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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/messages")
.header("x-api-key", "<api-key>")
.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 \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"stream\": false,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"chat_template_kwargs\": {\n \"enable_auto_compaction\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.subconscious.dev/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
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 \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"stream\": false,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"chat_template_kwargs\": {\n \"enable_auto_compaction\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "<string>",
"thinking": "<string>",
"signature": "<string>",
"id": "<string>",
"name": "<string>",
"input": {}
}
],
"model": "subconscious/glm-5.3-marathon",
"stop_reason": "end_turn",
"stop_sequence": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_read_input_tokens": 123
}
}Create Message
Generates a model response for the given conversation. This endpoint is fully compatible with the Anthropic Messages API, so you can use the Anthropic SDK by pointing its base URL at Subconscious.
from anthropic import Anthropic
client = Anthropic(
auth_token="your-api-key",
base_url="https://api.subconscious.dev",
)
message = client.messages.create(
model="subconscious/glm-5.3-marathon",
max_tokens=1024,
messages=[{"role": "user", "content": "What is the capital of France?"}],
)
print(message.content[0].text)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
authToken: "your-api-key",
baseURL: "https://api.subconscious.dev",
});
const message = await client.messages.create({
model: "subconscious/glm-5.3-marathon",
max_tokens: 1024,
messages: [{ role: "user", content: "What is the capital of France?" }],
});
console.log(message.content[0].text);curl https://api.subconscious.dev/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{
"model": "subconscious/glm-5.3-marathon",
"max_tokens": 1024,
"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/messages",
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?'
]
],
'max_tokens' => 1024,
'system' => '<string>',
'stream' => false,
'temperature' => 0.5,
'top_p' => 0.5,
'top_k' => 123,
'stop_sequences' => [
'<string>'
],
'tools' => [
[
'name' => '<string>',
'input_schema' => [
],
'description' => '<string>'
]
],
'tool_choice' => [
'name' => '<string>'
],
'thinking' => [
'type' => 'enabled',
'budget_tokens' => 123
],
'metadata' => [
'user_id' => '<string>'
],
'chat_template_kwargs' => [
'enable_auto_compaction' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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/messages"
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 \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"stream\": false,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"chat_template_kwargs\": {\n \"enable_auto_compaction\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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/messages")
.header("x-api-key", "<api-key>")
.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 \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"stream\": false,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"chat_template_kwargs\": {\n \"enable_auto_compaction\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.subconscious.dev/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
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 \"max_tokens\": 1024,\n \"system\": \"<string>\",\n \"stream\": false,\n \"temperature\": 0.5,\n \"top_p\": 0.5,\n \"top_k\": 123,\n \"stop_sequences\": [\n \"<string>\"\n ],\n \"tools\": [\n {\n \"name\": \"<string>\",\n \"input_schema\": {},\n \"description\": \"<string>\"\n }\n ],\n \"tool_choice\": {\n \"name\": \"<string>\"\n },\n \"thinking\": {\n \"type\": \"enabled\",\n \"budget_tokens\": 123\n },\n \"metadata\": {\n \"user_id\": \"<string>\"\n },\n \"chat_template_kwargs\": {\n \"enable_auto_compaction\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "<string>",
"thinking": "<string>",
"signature": "<string>",
"id": "<string>",
"name": "<string>",
"input": {}
}
],
"model": "subconscious/glm-5.3-marathon",
"stop_reason": "end_turn",
"stop_sequence": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_read_input_tokens": 123
}
}Authorizations
API key from your Subconscious dashboard. Accepted by the Anthropic Messages endpoints in place of the Authorization header, for use with the Anthropic SDK.
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. Content is either a string or an array of content blocks (text, image, tool_use, tool_result, thinking).
Show child attributes
Show child attributes
[
{
"role": "user",
"content": "What is the capital of France?"
}
]
The maximum number of tokens to generate before stopping. Required.
1024
A system prompt: a string or an array of text content blocks.
If true, responses are streamed as Server-Sent Events using the Anthropic event protocol (message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop).
Amount of randomness injected into the response.
0 <= x <= 1Nucleus sampling parameter.
0 <= x <= 1Only sample from the top K options for each subsequent token.
Custom text sequences that will cause the model to stop generating.
Definitions of tools the model may use.
Show child attributes
Show child attributes
How the model should use the provided tools.
Show child attributes
Show child attributes
Enable extended thinking. When enabled, the response includes thinking content blocks before the final text block.
Show child attributes
Show child attributes
An object describing metadata about the request.
Show child attributes
Show child attributes
Subconscious extension. Controls model-specific features such as auto-compaction (Subconscious Cache).
Show child attributes
Show child attributes
Response
Successful message
A unique identifier for the message.
"msg_abc123"
The object type.
message assistant An array of content blocks. Text blocks ({type:"text", text}), thinking blocks ({type:"thinking", thinking, signature}), and tool_use blocks ({type:"tool_use", id, name, input}).
Show child attributes
Show child attributes
"subconscious/glm-5.3-marathon"
The reason the model stopped generating.
end_turn, max_tokens, tool_use The custom stop sequence that was generated, if any.
Show child attributes
Show child attributes
Was this page helpful?