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: 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.
Base URL
All API endpoints are under:
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": "Description of what went wrong"
}
| Status | When it occurs |
|---|---|
| 401 | Missing or invalid API key |
| 402 | Monthly quota exceeded — upgrade or wait for reset |
| 422 | Invalid input — empty text, text too long, malformed JSON |
| 429 | Rate limit exceeded (60 req/min or 1000 req/hr) |
| 503 | Model loading failed or service temporarily unavailable |
Rate Limits
Limits apply per API key regardless of plan tier.
| Window | Limit | Notes |
|---|---|---|
| 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
Generate a completion for a conversation. Supports streaming via server-sent events (SSE).
| Field | Type | Description |
|---|---|---|
| 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 |
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
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 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)
{
"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
Returns the list of available models. Currently one model is available.
curl https://api.rocktalk.ai/v1/models \
-H "Authorization: Bearer sk_rt_YOUR_KEY"
{
"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
Encode one or more texts into 22-dimensional semantic coordinates. Accepts a single string or an array of strings.
| Field | Type | Description |
|---|---|---|
| text required | string | string[] | Text to encode. Single string or array of strings. Max 4096 characters per item. Max 64 items per batch. |
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
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 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
{
"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
Compute the semantic distance between two texts in the 22D coordinate space.
| Field | Type | Description |
|---|---|---|
| text_a required | string | First text. Max 4096 characters. |
| text_b required | string | Second text. Max 4096 characters. |
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 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
{
"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
Returns the definitions for all 22 semantic dimensions. No request body needed.
curl https://api.rocktalk.ai/v1/lens/dimensions \
-H "Authorization: Bearer sk_rt_YOUR_KEY"
{
"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.
| Resource | Free Tier | Paid |
|---|---|---|
| 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.
22 Dimensions Reference
The full table of dimension indices and their semantic meanings as returned by GET /v1/lens/dimensions.
| Index | Meaning |
|---|---|
| d0 | strength / primacy |
| d1 | house / dwelling / family |
| d2 | movement / lifting |
| d3 | pathway / entry / decision |
| d4 | revelation / breath |
| d5 | connection / securing |
| d6 | cutting / nourishment |
| d7 | enclosure / protection |
| d8 | surrounding / goodness |
| d9 | work / deed / making |
| d10 | covering / blessing |
| d11 | teaching / authority |
| d12 | flow / chaos / massive |
| d13 | seed / continuity |
| d14 | support / cycle |
| d15 | seeing / knowing |
| d16 | speech / expression |
| d17 | desire / righteousness |
| d18 | time / condensing |
| d19 | head / beginning |
| d20 | fire / transformation |
| d21 | covenant / completion |
model field in the response.