> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subconscious.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Make your first API call

## 1. Create an Account

[Sign up on the platform](https://subconscious.dev/platform) and generate an API key from your dashboard.

## 2. Try the Playground

Before writing code, try the [Playground](https://www.subconscious.dev/playground) to test prompts interactively.

## 3. Install an SDK

Subconscious is compatible with both the OpenAI and Anthropic SDKs — use whichever you
prefer. Install it for your language:

<CodeGroup>
  ```bash Python (OpenAI) theme={null}
  pip install openai
  ```

  ```bash Node.js (OpenAI) theme={null}
  npm install openai
  ```

  ```bash Python (Anthropic) theme={null}
  pip install anthropic
  ```

  ```bash Node.js (Anthropic) theme={null}
  npm install @anthropic-ai/sdk
  ```
</CodeGroup>

## 4. Make Your First Request

Set your API key and base URL, then create a chat completion:

<CodeGroup>
  ```python Python (OpenAI) theme={null}
  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": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Explain quantum computing in three sentences."},
      ],
  )

  print(response.choices[0].message.content)
  ```

  ```typescript Node.js (OpenAI) theme={null}
  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: "system", content: "You are a helpful assistant." },
      { role: "user", content: "Explain quantum computing in three sentences." },
    ],
  });

  console.log(response.choices[0].message.content);
  ```

  ```python Python (Anthropic) theme={null}
  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,
      system="You are a helpful assistant.",
      messages=[
          {"role": "user", "content": "Explain quantum computing in three sentences."},
      ],
  )

  print(message.content[0].text)
  ```

  ```typescript Node.js (Anthropic) theme={null}
  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,
    system: "You are a helpful assistant.",
    messages: [
      { role: "user", content: "Explain quantum computing in three sentences." },
    ],
  });

  console.log(message.content[0].text);
  ```

  ```bash cURL (Chat Completions) theme={null}
  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": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in three sentences."}
      ]
    }'
  ```

  ```bash cURL (Messages) theme={null}
  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,
      "system": "You are a helpful assistant.",
      "messages": [
        {"role": "user", "content": "Explain quantum computing in three sentences."}
      ]
    }'
  ```
</CodeGroup>

### Using an agents SDK

Want to use an SDK build for handling agents? Try one of these:

<CodeGroup>
  ```python OpenAI Agents theme={null}
  from openai import AsyncOpenAI
  from agents import (
      Agent,
      Runner,
      OpenAIChatCompletionsModel,
      set_tracing_disabled,
  )

  API_KEY = "your-api-key"
  MODEL = "subconscious/glm-5.3-marathon"


  def run_openai_agent():
      client = AsyncOpenAI(
          api_key=API_KEY,
          base_url="https://api.subconscious.dev/v1",
      )
      # Tracing would otherwise try to reach OpenAI's backend.
      set_tracing_disabled(True)

      # Pass an explicit Chat Completions model bound to our client. A bare
      # model string would route through the MultiProvider, which treats the
      # "subconscious/" segment as a provider prefix and fails.
      agent = Agent(
          name="Assistant",
          instructions="You are a helpful assistant.",
          model=OpenAIChatCompletionsModel(model=MODEL, openai_client=client),
      )
      result = Runner.run_sync(agent, "What is the capital of France?")
      print("OpenAI Agents SDK response:")
      print(result.final_output)


  run_openai_agent()
  ```

  ```python Claude Agent SDK theme={null}
  # The SDK reads its endpoint/credentials from env vars and drives the Claude
  # Code CLI under the hood (so Node.js + the CLI must be installed). Set these
  # before importing/using the SDK so the spawned CLI inherits them.

  import asyncio
  import os
  from claude_agent_sdk import query, ClaudeAgentOptions

  API_KEY = "your-api-key"

  os.environ["ANTHROPIC_BASE_URL"] = "https://api.subconscious.dev"
  os.environ["ANTHROPIC_AUTH_TOKEN"] = API_KEY
  MODEL = "subconscious/glm-5.3-marathon"


  async def run_claude_agent():
      print("Claude Agent SDK response:")
      options = ClaudeAgentOptions(model=MODEL)
      async for message in query(
          prompt="What is the capital of France?",
          options=options,
      ):
          print(message)


  asyncio.run(run_claude_agent())
  ```

  ```python LangChain theme={null}
  # Dependencies: langchain, langchain-openai, langchain-anthropic

  from langchain.agents import create_agent
  from langchain_openai import ChatOpenAI
  from langchain_anthropic import ChatAnthropic

  API_KEY = "your-api-key"
  MODEL = "subconscious/glm-5.3-marathon"
  PROMPT = {"messages": [{"role": "user", "content": "What is the capital of France?"}]}

  # ---------------------------------------------------------------------------
  # OpenAI chat completions format
  # ---------------------------------------------------------------------------
  openai_model = ChatOpenAI(
      model=MODEL,
      api_key=API_KEY,
      base_url="https://api.subconscious.dev/v1",
  )
  openai_agent = create_agent(openai_model, tools=[])
  print("OpenAI format:")
  print(openai_agent.invoke(PROMPT)["messages"][-1].content)

  # ---------------------------------------------------------------------------
  # Anthropic messages format
  # ---------------------------------------------------------------------------
  anthropic_model = ChatAnthropic(
      model=MODEL,
      base_url="https://api.subconscious.dev",
      api_key="unused",  # auth goes through the Bearer header below
      default_headers={"Authorization": f"Bearer {API_KEY}"},
  )
  anthropic_agent = create_agent(anthropic_model, tools=[])
  print("\nAnthropic format:")
  print(anthropic_agent.invoke(PROMPT)["messages"][-1].content)
  ```

  ```typescript Vercel AI SDK theme={null}
  // Dependencies: ai, @ai-sdk/openai-compatible

  import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
  import { generateText } from "ai";

  const API_KEY = "your-api-key";
  const MODEL = "subconscious/glm-5.3-marathon";

  const subconscious = createOpenAICompatible({
    name: "subconscious",
    apiKey: API_KEY,
    baseURL: "https://api.subconscious.dev/v1",
  });

  const { text } = await generateText({
    model: subconscious.chatModel(MODEL),
    system: "You are a helpful assistant.",
    prompt: "What is the capital of France?",
  });

  console.log(text);
  ```
</CodeGroup>

## 5. Try Streaming

You can stream responses token by token for real-time output:

<CodeGroup>
  ```python Python (OpenAI) theme={null}
  stream = client.chat.completions.create(
      model="subconscious/glm-5.3-marathon",
      messages=[{"role": "user", "content": "Write a haiku about programming."}],
      stream=True,
  )

  for chunk in stream:
      content = chunk.choices[0].delta.content
      if content:
          print(content, end="", flush=True)
  ```

  ```typescript Node.js (OpenAI) theme={null}
  const stream = await client.chat.completions.create({
    model: "subconscious/glm-5.3-marathon",
    messages: [{ role: "user", content: "Write a haiku about programming." }],
    stream: true,
  });

  for await (const chunk of stream) {
    const content = chunk.choices[0]?.delta?.content;
    if (content) process.stdout.write(content);
  }
  ```

  ```python Python (Anthropic) theme={null}
  with client.messages.stream(
      model="subconscious/glm-5.3-marathon",
      max_tokens=1024,
      messages=[{"role": "user", "content": "Write a haiku about programming."}],
  ) as stream:
      for text in stream.text_stream:
          print(text, end="", flush=True)
  ```

  ```typescript Node.js (Anthropic) theme={null}
  const stream = client.messages.stream({
    model: "subconscious/glm-5.3-marathon",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Write a haiku about programming." }],
  });

  for await (const event of stream) {
    if (
      event.type === "content_block_delta" &&
      event.delta.type === "text_delta"
    ) {
      process.stdout.write(event.delta.text);
    }
  }
  ```
</CodeGroup>

See [Streaming](/features/streaming) for more details.

## Next Steps

<CardGroup cols={2}>
  <Card title="Streaming" icon="wave-pulse" href="/features/streaming">
    Real-time token-by-token output
  </Card>

  <Card title="Thinking Mode" icon="brain" href="/features/thinking">
    Enable step-by-step reasoning
  </Card>

  <Card title="API Reference" icon="book" href="/api-reference/chat-completions">
    Full endpoint documentation
  </Card>
</CardGroup>
