API Reference

Rocktalk Labs provides two APIs under a single key: Qwen3.5 LLM inference (OpenAI-compatible) and Rocktalk Lens (22-dimensional semantic coordinates). All endpoints live at https://api.rocktalk.ai.

Authentication

All requests require a Authorization header with your API key as a Bearer token.

Authorization header
Authorization: Bearer sk_rt_YOUR_KEY_HERE

API keys are prefixed sk_rt_. Get a key by signing up — your key arrives by email. Keep it secret; it carries your quota.

Key security: Do not expose your API key in client-side code or public repositories. Use environment variables or a secrets manager.

Base URL

All API endpoints are under:

base url
https://api.rocktalk.ai

The LLM inference endpoints follow the OpenAI API path convention (/v1/chat/completions, /v1/models). Lens endpoints are at /v1/lens/*.

Error Responses

All errors return JSON with an error field and a standard HTTP status code.

error response format
{
  "error": "Description of what went wrong"
}
StatusWhen it occurs
401Missing or invalid API key
402Monthly quota exceeded — upgrade or wait for reset
422Invalid input — empty text, text too long, malformed JSON
429Rate limit exceeded (60 req/min or 1000 req/hr)
503Model loading failed or service temporarily unavailable

Rate Limits

Limits apply per API key regardless of plan tier.

WindowLimitNotes
Per minute 60 requests Rolling 60-second window
Per hour 1,000 requests Rolling 60-minute window

When rate limited you receive a 429 response. The Retry-After header indicates seconds to wait. For higher limits, contact api@rocktalk.ai.

LLM Inference

Qwen3.5-397B-A17B via an OpenAI-compatible API. If you already use the OpenAI Python SDK, change base_url and api_key — nothing else.

Chat Completions

POST /v1/chat/completions

Generate a completion for a conversation. Supports streaming via server-sent events (SSE).

FieldTypeDescription
model required string Must be "qwen3.5"
messages required array Array of message objects with role ("user", "assistant", "system") and content (string)
stream optional boolean Default false. If true, response is SSE with data: chunks ending in data: [DONE]
max_tokens optional integer Maximum tokens in the response. Default: 2048
temperature optional float Sampling temperature 0–2. Default: 0.7
top_p optional float Nucleus sampling probability. Default: 0.9
python — openai sdk (non-streaming)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.rocktalk.ai/v1",
    api_key="sk_rt_YOUR_KEY"
)

response = client.chat.completions.create(
    model="qwen3.5",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain entropy in one paragraph."}
    ],
    max_tokens=512,
    temperature=0.7
)

print(response.choices[0].message.content)
print(response.usage)  # prompt_tokens, completion_tokens, total_tokens
python — streaming response
stream = client.chat.completions.create(
    model="qwen3.5",
    messages=[{"role": "user", "content": "Tell me about black holes."}],
    stream=True
)

for chunk in stream:
    delta = chunk.choices[0].delta
    if delta.content:
        print(delta.content, end="", flush=True)
curl — streaming
curl https://api.rocktalk.ai/v1/chat/completions \
  -H "Authorization: Bearer sk_rt_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3.5",
    "stream": true,
    "messages": [
      {"role": "user", "content": "Hello, what can you do?"}
    ]
  }'

Response Format (non-streaming)

json response
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "qwen3.5",
  "choices": [{
    "index": 0,
    "message": {
      "role": "assistant",
      "content": "Entropy is a measure of..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 143,
    "total_tokens": 167
  }
}

List Models

GET /v1/models

Returns the list of available models. Currently one model is available.

curl
curl https://api.rocktalk.ai/v1/models \
  -H "Authorization: Bearer sk_rt_YOUR_KEY"
json response
{
  "object": "list",
  "data": [{
    "id": "qwen3.5",
    "object": "model",
    "owned_by": "rocktalk-labs"
  }]
}

Rocktalk Lens

Rocktalk Lens maps text into a 22-dimensional semantic coordinate space. Each dimension captures a distinct primitive category of meaning. Coordinates are deterministic — the same input always produces the same output. Lens is always free; cite as Rocktalk Labs Lens in publications.

Encode Text

POST /v1/lens/encode

Encode one or more texts into 22-dimensional semantic coordinates. Accepts a single string or an array of strings.

FieldTypeDescription
text required string | string[] Text to encode. Single string or array of strings. Max 4096 characters per item. Max 64 items per batch.
python — single text
import requests

res = requests.post(
    "https://api.rocktalk.ai/v1/lens/encode",
    headers={"Authorization": "Bearer sk_rt_YOUR_KEY"},
    json={"text": "love is patient"}
)
data = res.json()
result = data["results"][0]

print(result["coordinates"])     # [0.82, 0.34, ..., 0.91] — 22 floats
print(result["top_dimensions"])  # top activated dimensions
python — batch encode
res = requests.post(
    "https://api.rocktalk.ai/v1/lens/encode",
    headers={"Authorization": "Bearer sk_rt_YOUR_KEY"},
    json={"text": [
        "the speed of light",
        "maximum constraint on information transfer",
        "photon velocity in vacuum"
    ]}
)

for r in res.json()["results"]:
    print(r["text"], r["coordinates"][:4], "...")
curl
curl https://api.rocktalk.ai/v1/lens/encode \
  -H "Authorization: Bearer sk_rt_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "love is patient"}'

Response Format

json response
{
  "results": [
    {
      "text": "love is patient",
      "coordinates": [
        0.8234, 0.7102, 0.3045, 0.5567,
        0.6891, 0.7234, 0.2109, 0.8012,
        0.9101, 0.4523, 0.6677, 0.3345,
        0.2234, 0.7890, 0.5012, 0.4101,
        0.3567, 0.8234, 0.2678, 0.1234,
        0.4512, 0.9023
      ],
      "top_dimensions": [
        {"index": 8,  "meaning": "surrounding/goodness", "value": 0.9101},
        {"index": 21, "meaning": "covenant/completion",  "value": 0.9023},
        {"index": 0,  "meaning": "strength/primacy",     "value": 0.8234}
      ]
    }
  ],
  "model": "rocktalk-lens-v1",
  "dimensions": 22
}

Compare Two Texts

POST /v1/lens/compare

Compute the semantic distance between two texts in the 22D coordinate space.

FieldTypeDescription
text_a required string First text. Max 4096 characters.
text_b required string Second text. Max 4096 characters.
python
res = requests.post(
    "https://api.rocktalk.ai/v1/lens/compare",
    headers={"Authorization": "Bearer sk_rt_YOUR_KEY"},
    json={
        "text_a": "the speed of light",
        "text_b": "maximum constraint on information transfer"
    }
)
data = res.json()
print(data["cosine_similarity"])  # 0.94 — very similar
print(data["l2_distance"])        # Euclidean distance in 22D space
curl
curl https://api.rocktalk.ai/v1/lens/compare \
  -H "Authorization: Bearer sk_rt_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text_a": "democracy",
    "text_b": "shared decision structure"
  }'

Response Format

json response
{
  "cosine_similarity": 0.9412,
  "l2_distance": 0.2341,
  "coordinates_a": [0.82, 0.71, /* ...22 floats */],
  "coordinates_b": [0.79, 0.68, /* ...22 floats */]
}

Cosine similarity is 0–1, where 1 is identical direction. L2 distance is Euclidean distance in 22D space — smaller means more similar.

Get Dimension Definitions

GET /v1/lens/dimensions

Returns the definitions for all 22 semantic dimensions. No request body needed.

curl
curl https://api.rocktalk.ai/v1/lens/dimensions \
  -H "Authorization: Bearer sk_rt_YOUR_KEY"
json response
{
  "dimensions": [
    {"index": 0,  "meaning": "strength/primacy"},
    {"index": 1,  "meaning": "house/dwelling/family"},
    /* ... */
    {"index": 21, "meaning": "covenant/completion"}
  ],
  "count": 22,
  "model": "rocktalk-lens-v1"
}

Free Tier Limits

All accounts start on the free tier. No credit card required.

ResourceFree TierPaid
LLM tokens 100,000 / month $2.00 / 1M tokens
Lens calls 10,000 / month Always free

Monthly quotas reset on the 1st of each calendar month UTC. When the LLM quota is exceeded, requests return 402. Lens remains available regardless of LLM quota status.

Lens is always free. The 10K/month free tier limit applies to free accounts. There is no charge for Lens calls on any plan. If you need higher Lens throughput, contact us.

22 Dimensions Reference

The full table of dimension indices and their semantic meanings as returned by GET /v1/lens/dimensions.

IndexMeaning
d0strength / primacy
d1house / dwelling / family
d2movement / lifting
d3pathway / entry / decision
d4revelation / breath
d5connection / securing
d6cutting / nourishment
d7enclosure / protection
d8surrounding / goodness
d9work / deed / making
d10covering / blessing
d11teaching / authority
d12flow / chaos / massive
d13seed / continuity
d14support / cycle
d15seeing / knowing
d16speech / expression
d17desire / righteousness
d18time / condensing
d19head / beginning
d20fire / transformation
d21covenant / completion
Research citation: When using Rocktalk Lens output in publications, cite as: Rocktalk Labs Lens (rocktalk.ai). Include the API version from the model field in the response.