Use the Spinda API
Send your app's state and questions, and get back typed answers with a probability for every option.
OpenAPI · Markdown docs · Agent index · API endpoints
Make your first request
- Request access. Once approved, sign in and create an organization.
- Create an API key. Copy it when it is shown and store it as a server-side environment variable named
SPINDA_API_KEY. - Send a JSON request to
https://api.spinda.ai/v1/systemone.
Keep your key on your server. Browser applications should call your own backend, which can authenticate users before calling Spinda.
This example uses decision-model-large at $0.039 per million input tokens. Check its current availability in the playground before sending.
Use cURL 7.76+ with uuidgen, Python 3 with requests, or Node.js 20+. Save the printed request key. Retry the same body with that key.
Check a proposed tool call against a user request and a policy. Open in playground
# Requires curl 7.76+ and uuidgen.
# To retry, set SPINDA_IDEMPOTENCY_KEY to the printed key and keep the same body.
spinda_request_key="${SPINDA_IDEMPOTENCY_KEY:-}"
if [ -z "$spinda_request_key" ]; then
spinda_request_key="$(uuidgen)" || exit 1
fi
[ -n "$spinda_request_key" ] || { printf '%s\n' "Could not generate a request key." >&2; exit 1; }
printf 'Idempotency-Key: %s\n' "$spinda_request_key" >&2 || exit 1
curl --disable --fail-with-body --show-error --silent --connect-timeout 10 --max-time 180 \
https://api.spinda.ai/v1/systemone \
-H "Authorization: Bearer $SPINDA_API_KEY" \
-H "Idempotency-Key: $spinda_request_key" \
-H "Content-Type: application/json" \
--data-binary @- <<'SPINDA_REQUEST_JSON'
{
"model": "decision-model-large",
"state": "The user asked to list project files. The proposed tool call is: ls -la ./src. The tool policy allows read-only commands within the project directory.",
"questions": {
"action": {
"type": "choice",
"instructions": "What should happen to the proposed tool call?",
"criteria": {
"allow": "The call follows the request and policy.",
"review": "More information is needed before running the call.",
"reject": "The call conflicts with the request or policy."
}
}
}
}
SPINDA_REQUEST_JSONimport json
import os
import sys
import uuid
import requests
payload = {'model': 'decision-model-large',
'state': 'The user asked to list project files. The proposed tool call is: ls -la '
'./src. The tool policy allows read-only commands within the project '
'directory.',
'questions': {'action': {'type': 'choice',
'instructions': 'What should happen to the proposed tool '
'call?',
'criteria': {'allow': 'The call follows the request and '
'policy.',
'review': 'More information is needed before '
'running the call.',
'reject': 'The call conflicts with the request '
'or policy.'}}}}
# To retry, set SPINDA_IDEMPOTENCY_KEY to the printed key and keep the same body.
idempotency_key = os.environ.get("SPINDA_IDEMPOTENCY_KEY") or str(uuid.uuid4())
print(f"Idempotency-Key: {idempotency_key}", file=sys.stderr, flush=True)
api_key = os.environ["SPINDA_API_KEY"]
response = requests.post(
'https://api.spinda.ai/v1/systemone',
headers={"Authorization": f"Bearer {api_key}",
"Idempotency-Key": idempotency_key},
json=payload,
timeout=(10, 150),
allow_redirects=False,
)
if response.status_code >= 400:
print(response.text.replace(api_key, "[redacted]"), file=sys.stderr)
response.raise_for_status()
if 300 <= response.status_code < 400:
raise RuntimeError("Unexpected redirect; no retry was sent.")
print(response.json()["answers"])// Node.js 20+. Save as decision.mjs and run: node decision.mjs
import { randomUUID } from 'node:crypto';
const payload = JSON.parse(String.raw`{
"model": "decision-model-large",
"state": "The user asked to list project files. The proposed tool call is: ls -la ./src. The tool policy allows read-only commands within the project directory.",
"questions": {
"action": {
"type": "choice",
"instructions": "What should happen to the proposed tool call?",
"criteria": {
"allow": "The call follows the request and policy.",
"review": "More information is needed before running the call.",
"reject": "The call conflicts with the request or policy."
}
}
}
}`);
const apiKey = process.env.SPINDA_API_KEY;
if (!apiKey) throw new Error('Set SPINDA_API_KEY in your server environment.');
// To retry, set SPINDA_IDEMPOTENCY_KEY to this key and keep the same body.
const requestKey = process.env.SPINDA_IDEMPOTENCY_KEY || randomUUID();
console.error('Idempotency-Key:', requestKey);
const response = await fetch("https://api.spinda.ai/v1/systemone", {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Idempotency-Key': requestKey,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
redirect: 'error',
signal: AbortSignal.timeout(180_000),
});
if (!response.ok) {
console.error((await response.text()).replaceAll(apiKey, '[redacted]'));
const retryAfter = response.headers.get('retry-after');
if (retryAfter) console.error('Retry-After:', retryAfter);
throw new Error(`Spinda HTTP ${response.status}; no retry was sent.`);
}
const result = await response.json();
if (result.model !== payload.model || result.preview || !result.answers ||
typeof result.answers !== 'object' || Array.isArray(result.answers) ||
Object.keys(result.answers).length !== Object.keys(payload.questions).length ||
Object.entries(payload.questions).some(([name, question]) =>
result.answers[name]?.type !== question.type)) {
throw new Error('Unexpected decision response; no retry was sent.');
}
console.log(JSON.stringify(result.answers, null, 2));
Response shape · illustrative example
{
"answers": {
"action": {
"type": "choice",
"choice": "allow",
"probabilities": {
"allow": 0.8,
"review": 0.15,
"reject": 0.05
},
"confidence": 0.7
}
}
}Choose the caption that fits the brand. Open in playground
# Requires curl 7.76+ and uuidgen.
# To retry, set SPINDA_IDEMPOTENCY_KEY to the printed key and keep the same body.
spinda_request_key="${SPINDA_IDEMPOTENCY_KEY:-}"
if [ -z "$spinda_request_key" ]; then
spinda_request_key="$(uuidgen)" || exit 1
fi
[ -n "$spinda_request_key" ] || { printf '%s\n' "Could not generate a request key." >&2; exit 1; }
printf 'Idempotency-Key: %s\n' "$spinda_request_key" >&2 || exit 1
curl --disable --fail-with-body --show-error --silent --connect-timeout 10 --max-time 180 \
https://api.spinda.ai/v1/systemone \
-H "Authorization: Bearer $SPINDA_API_KEY" \
-H "Idempotency-Key: $spinda_request_key" \
-H "Content-Type: application/json" \
--data-binary @- <<'SPINDA_REQUEST_JSON'
{
"model": "decision-model-large",
"state": "Brand voice: warm, plain and a little dry. Short sentences. No exclamation marks, no hype words like \"game-changer\". Post: our new single-origin coffee from Huila. Notes of red apple and panela.",
"questions": {
"caption": {
"type": "choice",
"instructions": "Which caption fits our brand voice best?",
"criteria": {
"a": "New in: Huila. Red apple, panela, and a reason to slow down.",
"b": "GAME-CHANGER ALERT!!! Our new Huila coffee is HERE!!!",
"c": "Introducing our exciting new Huila single-origin, bursting with flavor!"
}
}
}
}
SPINDA_REQUEST_JSONimport json
import os
import sys
import uuid
import requests
payload = {'model': 'decision-model-large',
'state': 'Brand voice: warm, plain and a little dry. Short sentences. No exclamation '
'marks, no hype words like "game-changer". Post: our new single-origin '
'coffee from Huila. Notes of red apple and panela.',
'questions': {'caption': {'type': 'choice',
'instructions': 'Which caption fits our brand voice best?',
'criteria': {'a': 'New in: Huila. Red apple, panela, and a '
'reason to slow down.',
'b': 'GAME-CHANGER ALERT!!! Our new Huila '
'coffee is HERE!!!',
'c': 'Introducing our exciting new Huila '
'single-origin, bursting with flavor!'}}}}
# To retry, set SPINDA_IDEMPOTENCY_KEY to the printed key and keep the same body.
idempotency_key = os.environ.get("SPINDA_IDEMPOTENCY_KEY") or str(uuid.uuid4())
print(f"Idempotency-Key: {idempotency_key}", file=sys.stderr, flush=True)
api_key = os.environ["SPINDA_API_KEY"]
response = requests.post(
'https://api.spinda.ai/v1/systemone',
headers={"Authorization": f"Bearer {api_key}",
"Idempotency-Key": idempotency_key},
json=payload,
timeout=(10, 150),
allow_redirects=False,
)
if response.status_code >= 400:
print(response.text.replace(api_key, "[redacted]"), file=sys.stderr)
response.raise_for_status()
if 300 <= response.status_code < 400:
raise RuntimeError("Unexpected redirect; no retry was sent.")
print(response.json()["answers"])// Node.js 20+. Save as decision.mjs and run: node decision.mjs
import { randomUUID } from 'node:crypto';
const payload = JSON.parse(String.raw`{
"model": "decision-model-large",
"state": "Brand voice: warm, plain and a little dry. Short sentences. No exclamation marks, no hype words like \"game-changer\". Post: our new single-origin coffee from Huila. Notes of red apple and panela.",
"questions": {
"caption": {
"type": "choice",
"instructions": "Which caption fits our brand voice best?",
"criteria": {
"a": "New in: Huila. Red apple, panela, and a reason to slow down.",
"b": "GAME-CHANGER ALERT!!! Our new Huila coffee is HERE!!!",
"c": "Introducing our exciting new Huila single-origin, bursting with flavor!"
}
}
}
}`);
const apiKey = process.env.SPINDA_API_KEY;
if (!apiKey) throw new Error('Set SPINDA_API_KEY in your server environment.');
// To retry, set SPINDA_IDEMPOTENCY_KEY to this key and keep the same body.
const requestKey = process.env.SPINDA_IDEMPOTENCY_KEY || randomUUID();
console.error('Idempotency-Key:', requestKey);
const response = await fetch("https://api.spinda.ai/v1/systemone", {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Idempotency-Key': requestKey,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
redirect: 'error',
signal: AbortSignal.timeout(180_000),
});
if (!response.ok) {
console.error((await response.text()).replaceAll(apiKey, '[redacted]'));
const retryAfter = response.headers.get('retry-after');
if (retryAfter) console.error('Retry-After:', retryAfter);
throw new Error(`Spinda HTTP ${response.status}; no retry was sent.`);
}
const result = await response.json();
if (result.model !== payload.model || result.preview || !result.answers ||
typeof result.answers !== 'object' || Array.isArray(result.answers) ||
Object.keys(result.answers).length !== Object.keys(payload.questions).length ||
Object.entries(payload.questions).some(([name, question]) =>
result.answers[name]?.type !== question.type)) {
throw new Error('Unexpected decision response; no retry was sent.');
}
console.log(JSON.stringify(result.answers, null, 2));
Response shape · illustrative example
{
"answers": {
"caption": {
"type": "choice",
"choice": "a",
"probabilities": {
"a": 0.8,
"b": 0.1,
"c": 0.1
},
"confidence": 0.7
}
}
}Route a ticket to the team that should handle it. Open in playground
# Requires curl 7.76+ and uuidgen.
# To retry, set SPINDA_IDEMPOTENCY_KEY to the printed key and keep the same body.
spinda_request_key="${SPINDA_IDEMPOTENCY_KEY:-}"
if [ -z "$spinda_request_key" ]; then
spinda_request_key="$(uuidgen)" || exit 1
fi
[ -n "$spinda_request_key" ] || { printf '%s\n' "Could not generate a request key." >&2; exit 1; }
printf 'Idempotency-Key: %s\n' "$spinda_request_key" >&2 || exit 1
curl --disable --fail-with-body --show-error --silent --connect-timeout 10 --max-time 180 \
https://api.spinda.ai/v1/systemone \
-H "Authorization: Bearer $SPINDA_API_KEY" \
-H "Idempotency-Key: $spinda_request_key" \
-H "Content-Type: application/json" \
--data-binary @- <<'SPINDA_REQUEST_JSON'
{
"model": "decision-model-large",
"state": "Sample ticket: There is a duplicate charge on our invoice, but I also found a new administrator login that nobody on our team recognizes. Please check the account before processing a refund.",
"questions": {
"team": {
"type": "choice",
"instructions": "Choose the team that should own this ticket. Prefer security for suspected unauthorized access, even if billing is also mentioned.",
"criteria": {
"billing": "Payments, invoices, refunds, duplicate charges, and subscription billing.",
"engineering": "Bugs, failed requests, integrations, performance, and service outages.",
"security": "Account compromise, unauthorized access, exposed credentials, and vulnerabilities.",
"sales": "Plans, upgrades, pricing, procurement, and enterprise purchases.",
"support": "How-to questions, account setup, and requests that do not fit another team."
}
}
}
}
SPINDA_REQUEST_JSONimport json
import os
import sys
import uuid
import requests
payload = {'model': 'decision-model-large',
'state': 'Sample ticket: There is a duplicate charge on our invoice, but I also found '
'a new administrator login that nobody on our team recognizes. Please check '
'the account before processing a refund.',
'questions': {'team': {'type': 'choice',
'instructions': 'Choose the team that should own this ticket. '
'Prefer security for suspected unauthorized '
'access, even if billing is also mentioned.',
'criteria': {'billing': 'Payments, invoices, refunds, '
'duplicate charges, and subscription '
'billing.',
'engineering': 'Bugs, failed requests, '
'integrations, performance, and '
'service outages.',
'security': 'Account compromise, unauthorized '
'access, exposed credentials, and '
'vulnerabilities.',
'sales': 'Plans, upgrades, pricing, procurement, '
'and enterprise purchases.',
'support': 'How-to questions, account setup, and '
'requests that do not fit another '
'team.'}}}}
# To retry, set SPINDA_IDEMPOTENCY_KEY to the printed key and keep the same body.
idempotency_key = os.environ.get("SPINDA_IDEMPOTENCY_KEY") or str(uuid.uuid4())
print(f"Idempotency-Key: {idempotency_key}", file=sys.stderr, flush=True)
api_key = os.environ["SPINDA_API_KEY"]
response = requests.post(
'https://api.spinda.ai/v1/systemone',
headers={"Authorization": f"Bearer {api_key}",
"Idempotency-Key": idempotency_key},
json=payload,
timeout=(10, 150),
allow_redirects=False,
)
if response.status_code >= 400:
print(response.text.replace(api_key, "[redacted]"), file=sys.stderr)
response.raise_for_status()
if 300 <= response.status_code < 400:
raise RuntimeError("Unexpected redirect; no retry was sent.")
print(response.json()["answers"])// Node.js 20+. Save as decision.mjs and run: node decision.mjs
import { randomUUID } from 'node:crypto';
const payload = JSON.parse(String.raw`{
"model": "decision-model-large",
"state": "Sample ticket: There is a duplicate charge on our invoice, but I also found a new administrator login that nobody on our team recognizes. Please check the account before processing a refund.",
"questions": {
"team": {
"type": "choice",
"instructions": "Choose the team that should own this ticket. Prefer security for suspected unauthorized access, even if billing is also mentioned.",
"criteria": {
"billing": "Payments, invoices, refunds, duplicate charges, and subscription billing.",
"engineering": "Bugs, failed requests, integrations, performance, and service outages.",
"security": "Account compromise, unauthorized access, exposed credentials, and vulnerabilities.",
"sales": "Plans, upgrades, pricing, procurement, and enterprise purchases.",
"support": "How-to questions, account setup, and requests that do not fit another team."
}
}
}
}`);
const apiKey = process.env.SPINDA_API_KEY;
if (!apiKey) throw new Error('Set SPINDA_API_KEY in your server environment.');
// To retry, set SPINDA_IDEMPOTENCY_KEY to this key and keep the same body.
const requestKey = process.env.SPINDA_IDEMPOTENCY_KEY || randomUUID();
console.error('Idempotency-Key:', requestKey);
const response = await fetch("https://api.spinda.ai/v1/systemone", {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Idempotency-Key': requestKey,
'Content-Type': 'application/json',
},
body: JSON.stringify(payload),
redirect: 'error',
signal: AbortSignal.timeout(180_000),
});
if (!response.ok) {
console.error((await response.text()).replaceAll(apiKey, '[redacted]'));
const retryAfter = response.headers.get('retry-after');
if (retryAfter) console.error('Retry-After:', retryAfter);
throw new Error(`Spinda HTTP ${response.status}; no retry was sent.`);
}
const result = await response.json();
if (result.model !== payload.model || result.preview || !result.answers ||
typeof result.answers !== 'object' || Array.isArray(result.answers) ||
Object.keys(result.answers).length !== Object.keys(payload.questions).length ||
Object.entries(payload.questions).some(([name, question]) =>
result.answers[name]?.type !== question.type)) {
throw new Error('Unexpected decision response; no retry was sent.');
}
console.log(JSON.stringify(result.answers, null, 2));
Response shape · illustrative example
{
"answers": {
"team": {
"type": "choice",
"choice": "security",
"probabilities": {
"billing": 0.05,
"engineering": 0.05,
"security": 0.8,
"sales": 0.05,
"support": 0.05
},
"confidence": 0.75
}
}
}Request keys, timeouts, and safe retries
The cURL example needs curl 7.76 or later and uuidgen. The Python example needs Python 3 and the requests package. The Node.js example needs Node.js 20+ with no packages to install. Save it as decision.mjs and run node decision.mjs. All three print the request key before sending. Save it with the exact request body. To recover an uncertain attempt, set SPINDA_IDEMPOTENCY_KEY to that printed key and run the same body again. Otherwise, each run creates a new request that can be charged separately.
These examples send once. cURL allows 10 seconds to connect and 180 seconds for the whole transfer. Node.js uses a 180-second deadline. Python allows 10 seconds to connect and 150 seconds of read inactivity; this is not a whole-request deadline. A client timeout does not prove that server work stopped or establish its outcome. See errors and retries before sending again.
Read each named answer from response.answers. Expand the response shape above to see the matching option names. Actual probabilities vary.
For a choice answer, read the selected option’s probability from answer.probabilities[answer.choice]: 0.8 in this example.
How confidence is calculated
For choice and score, confidence measures how far the largest probability is above a uniform distribution: (p_max - 1/K) / (1 - 1/K), where K is the number of options or score levels. It is 0 for a uniform distribution and 1 when one option has all the probability. With three options and a largest probability of 0.8, confidence is 0.7. Changing the number of options changes this scale. The API computes confidence from unrounded probabilities, bounds it to 0–1, and rounds it to four decimal places. Returned probabilities are rounded separately.
Probability estimates are not guarantees, and confidence does not measure the observed accuracy of your application. Evaluate on representative labeled examples that were not used to choose your thresholds, and measure both automatic decisions and errors among them.
Choose a model
Both models are available through the hosted API.
- Qwen3.8-Flash-Next-Decision. Choose between supplied options, check a condition, or score against a rubric. Open weights, non-steerable, and available through the hosted API.
- Spinda Mint. Inspect and steer a decision. Natures are Mint's steerable features: inspect which are active, adjust one, and compare the new choice with the original. See inspection and steering.
Open the playground to choose a model. Use GET https://api.spinda.ai/v1/models for exact request identifiers and pricing. The request above covers decision scoring.
Names and API IDs
Each public name maps to one API ID. Send the API ID as model, or as base for customization work.
| Public name | API ID | Base | Feature dictionary | Layers with features |
|---|---|---|---|---|
| Qwen3.8-Flash-Next-Decision | decision-model-large | Qwen derivative by Spinda Research: 176B total, 6B active | None (non-steerable) | None |
| Spinda Mint | decision-model-27b | decision-27b-t48: Qwen3.5-27B read at layer 48 | Qwen-Scope SAE residual features, 81,920 per layer | Layers 24 and 32 |
Qwen3.8-Flash-Next-Decision has open weights. Spinda Mint has closed weights and is steerable in Natures Lab.
Compare your own requests
In the playground, choose Import JSON and paste a request body with its exact model, state and questions. Loading fills the editor without running the model. The editor accepts text state, instructions and outcome descriptions, plus one inline image. An optional temperature appears under Request settings. Unsupported fields are rejected, never dropped.
Run the request, choose Keep as baseline, then edit and rerun. Compare the probabilities for each outcome and open Input changes to see what changed. Model or outcome-definition changes show separate distributions. Export saves both submitted requests and results. The baseline stays only in this tab; export it before refreshing. To reopen it, choose Import JSON, then Choose JSON file. Both requests and results return with an imported-file label. This makes no model call and does not change your usage balance. Edit and Run when you want a new response. Each new run uses your workspace allowance.
Inspect and steer with Mint
A decision response scores the supplied options. A computation graph shows the internal features and connections behind one decision. Natures are the steerable features of Spinda Mint.
Mint is Qwen3.5-27B with SAE features at layers 24 and 32. Its weights stay on the platform. Open Natures Lab to inspect a decision, adjust a feature, and compare the result on the same records.
Build and deploy your own model
Change how a base model decides, measure the change, and call the result by its own model ID. Your change is applied inside the hosted model on every request, so there is no server to run.
Spinda Mint (decision-model-27b) is the customizable model and the default for new work. Calls that name an existing edit, job or model find it on its own base. GET /v1/models lists the two offerings and your deployed Mint models. Each offering includes current available status. When Mint is resident, its artifact identifies the exact base, renderer, readout/weight hashes and verified SAE layers. Use artifact.id as base_artifact for a head upload; an offline worker returns no resident artifact.
Every example below sends your key in Authorization: Bearer $SPINDA_API_KEY and a JSON body. The reference lists every field, error and limit.
Explain a decision
POST /v1/analyze with a record returns the decision, the features that drove it, the effect of every input token, and a check of the explanation by intervention. Send {"sample": {"seed": 1}} instead of a record to explain a held-out decision from our development split.
curl https://api.spinda.ai/v1/analyze \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"record": {"state": "Ticket: I was charged twice for my October invoice.",
"questions": {"team": {"type": "choice", "instructions": "Which team should handle this ticket?",
"criteria": {"billing": "Payments, invoices and refunds.", "support": "Everything else."}}}}}'
Read decision.choice, then top_by_feature for the strongest features. tokens_detail gives the effect of every input token, and coverage is the share of the total effect that the listed features carry. faithfulness.verdict says whether the explanation held when its top features were turned off individually and together. Each row of faithfulness.features says whether it agrees, and faithfulness.together reports all of them off at once.
Compare two records
POST /v1/discover with pairs of records that differ in one cue lists the features that respond to that cue. Both records in a pair must offer the same options.
curl https://api.spinda.ai/v1/discover \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"pairs": [[RECORD_WITH_CUE, RECORD_WITHOUT_CUE]], "top_k": 20}'
Add "goal": "ignore hints from colleagues" to rank the features by how closely their labels match the goal.
Edit and evaluate
POST /v1/edits saves operations. A scale of 0 turns a feature off and a scale of 2 doubles it. Add "when": {"layer": 8, "feature": 512, "above": 1} to apply an operation only to decisions where that feature fires. Once the condition is met anywhere in the input, the operation applies at every position. Then POST /v1/evaluate runs 200 held-out decisions by default, up to 500, through the original and the edited model. POST /v1/evaluate/dataset does the same with your own answered records.
curl https://api.spinda.ai/v1/edits \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "quiet feature", "ops": [{"layer": 12, "feature": 3305, "scale": 0}]}'
curl https://api.spinda.ai/v1/evaluate \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"edit_id": "edit_…"}'
Read summary, then base.accuracy, edited.accuracy and edit_effect.choice_flip_rate. Every metric has a 95% interval in ci, and changed decisions get an exact McNemar test in significance. When the edit should not change unrelated decisions, a flip rate near 0 is the goal. gate.eligible says whether this evaluation lets the edit be published.
Check an edit before publishing
POST /v1/edits/{id}/health runs five checks on 200 held-out decisions: accuracy, decisions changed, calibration, faithfulness of the edited model's explanations and label coverage. Each returns pass, warn or fail with its rule. POST /v1/diff runs two models on the same decisions and lists the flips, the decisions nearest to flipping and the features whose effect changed most. POST /v1/datasets/inspect reports duplicates, label balance, overlap with held-out data and single-feature shortcuts before you train or evaluate on your records. POST /v1/edits/auto drafts an edit from a goal and at least 4 matched pairs, tests it, and never publishes it.
curl https://api.spinda.ai/v1/edits/edit_…/health \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" -d '{}'
curl https://api.spinda.ai/v1/diff \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"a": "base", "b": "edit_…", "sample": {"n": 200}}'
Train on your answers
POST /v1/train trains a small head on your answered records while the base model stays frozen. Each record carries its answers beside the questions, as "answers": {"team": {"choice": "billing"}}. The answers never reach the model input.
curl https://api.spinda.ai/v1/train \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "refund routing", "records": [ANSWERED_RECORD, …]}'
curl https://api.spinda.ai/v1/train/train_… -H "Authorization: Bearer $SPINDA_API_KEY"
The run returns 202 with the job and its id. GET /v1/train/{id} returns status, stage and progress at the top level. When status is completed, checkpoint names the trained head and edit_id names an edit that uses it. report holds the base and trained results on 800 held-out general decisions and on the 15% of your answers held back from training.
POST /v1/train/estimate with the same body returns model_tokens, minutes and price before a run starts, and is free. The token count comes from rendering the records the run reads. The minutes come from recent runs on the same base and were off by up to 53% on our test runs.
Probe and monitor
POST /v1/probes with 20 or more records labelled true or false trains a probe on the model's internal state. It reports held-out AUROC and recall at 1% and 10% false positives, with the measured false-positive rate, next to a text baseline on the same split. An edit with {"kind": "probe", "probe": "probe_…", "above": 0.5} returns that probe's score with every answer.
curl https://api.spinda.ai/v1/probes \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"name": "legal threat", "layer": 20, "records": [{"state": "…", "questions": {…}, "label": true}, …]}'
Publish and call
POST /v1/deploy with {"edit_id": "edit_…", "model_id": "refund-policy"} gives an edit its own model ID. Then send "model": "refund-policy" to https://api.spinda.ai/v1/systemone. The request and response match every other model.
Deploy needs one evaluation of the edit that passes the publish gate: at least 200 labelled decisions, purpose evaluation, and none of the records you used to explore or build edits. POST /v1/evaluate with its default 200 decisions passes the gate, because it leaves out every record you used. A completed training run passes it too. Otherwise deploy returns 409 with error_type evaluation_required and the reasons. The gate checks the evidence; read the health check for the outcome.
curl https://api.spinda.ai/v1/deploy \
-H "Authorization: Bearer $SPINDA_API_KEY" -H "Content-Type: application/json" \
-d '{"edit_id": "edit_…", "model_id": "refund-policy"}'
OpenAPI, Python client and notebooks
The OpenAPI 3.1 document at https://api.spinda.ai/v1/openapi.json describes every route, field and error, with the scope each route needs.
The Python client needs Python 3.9 or later and no other packages. Install it from this site:
pip install https://spinda.ai/docs/python/spinda-python-0.5.0.zip
export SPINDA_API_KEY=…
from spinda import Spinda, Edit
client = Spinda() # reads SPINDA_API_KEY; base="decision-model-27b" picks the 27B
a = client.analyze(sample={"seed": 1})
print(a.summary())
edit = client.edits.create("quiet feature", Edit().off(12, 3305))
print(client.evaluate(edit.id).summary) # 200 held-out decisions, 95% intervals, McNemar
print(client.health(edit.id).status) # pass, warn or fail
client.deploy(edit.id, "refund-policy") # needs an evaluation that passes the gate
Errors raise SpindaError subclasses with error_type, param and request_id. Every POST carries an Idempotency-Key, and the client retries 429, 503 and dropped connections with the same key.
Four Mint notebooks contain runnable examples. Supply your API key and run the cells to get results:
- Explain a decision and check the explanation
- Find what moves a decision and turn it off
- Train on your answers and compare
- Publish a model ID with a monitor and call it
Edits, measurements, training runs, checkpoints and model IDs belong to a project in your organization. A key acts in the project it was created for: it lists, calls and changes only that project’s models. Other projects and organizations cannot list, call or reuse them. GET /v1/models lists the models that key can call. Download an owned head from GET /v1/checkpoints/heads/{id}/weights?format=safetensors; the response includes its file SHA-256. The Python SDK and Natures Lab also support head upload, download and optimizer continuation. Changes are recorded in your organization’s audit log. Natures Lab needs a signed-in, approved account.
In Python, client.lab can upload datasets, create investigations and save comparison, regression-suite or optimization drafts. Use a project key with inspect and customize scopes. The drafts appear in that project's Natures Lab for review and launch. These keys cannot call Lab chat, approval or execution routes. Metadata writes are not automatically retried after a lost response; check client.lab.workspace() before resubmitting.
Customization reference
These routes are on https://api.spinda.ai. Each needs an API key. Records use the decision request format, with these limits on the Spinda Mint: 1 to 16 choice questions per record, 2 to 64 options per question, and up to 2,048 rendered tokens per question. Bodies are limited to 1 MiB. Errors use the error envelope. A number outside its range is clamped and reported in warnings. Prices are in the customization price table.
A key carries one or more scopes. inference covers /v1/systemone and /v1/models. inspect covers every GET and the POST routes that read or measure: analyze, discover, feature search, evaluate, diff, dataset inspection, health checks, probe scoring and training estimates. customize covers every route that creates, trains, publishes or deletes. admin covers all of them. A missing scope returns 403 with error_type permission_denied and param scope.
Lists take limit, 1 to 1,000, and after, the next_after value of the previous page. Each page returns has_more and next_after. Edits and deployments list oldest first; every other list is newest first. A list covers both bases unless ?base= names one, and unavailable names a base that did not answer.
POST /v1/analyze
- Request
record(state and questions) orsample{"seed", "area"};question, the question ID to explain (default: the first);options, the two options whose margin is explained (default: the choice and the runner-up);top_k, 1 to 200 (default 30);check(defaulttrue);check_n, the number of features the check turns off, 1 to 30 (default 10);edit_id,modeloropsto explain an edited model;base.- Response
decision;margin_between, the two options;margin;top_features, one entry per feature and position (layer,feature,position,token,activation,effect,share,label);top_by_feature, the same summed over positions (layer,feature,effect_sum,positions,tokens,label);tokens_detail, one entry per input token (i,token,effect, up to 3features);coverage, the share of the total absolute effect thattop_by_featurecarries;per_layer;faithfulness(verdict,rule,check_n,sign_agreement,relative_error,featureswithpredicted_change,measured_changeandagrees, andtogetherwith the predicted and measured change for all of them off at once);record;expectedandsamplefor a sample;engine_version;labels_version;ms.- Errors
- 402 no allowance · 404 unknown edit or model · 422 invalid record · 429 too many waiting · 503 base loading
- Cost
- Tokens read. The check reads the record about 15 times.
POST /v1/features/search · GET /v1/features/{layer}/{feature}
- Request
query, text or a pattern of up to 200 characters;limit, 1 to 2,000 (default 100).- Response
countandfeatures(layer, feature, label). The feature route returns its label and up to 5 examples.- Errors
- 404 no such feature · 422 empty or invalid query
- Cost
- Free.
POST /v1/discover
- Request
pairs, 1 to 24[record_a, record_b]pairs with the same options;goal, text that reranks the candidates by label similarity;options;top_k, 1 to 1,000 (default 40);terms, label words to keep;min_consistency(default 0.5);edit_id,modelorops;base.- Response
candidates(features with consistency and cue effect);group_fire_rate;group_effect_share;group_swap_share;decisions;run_id.- Errors
- 402 · 404 · 422 pairs or options invalid · 429 · 503
- Cost
- Tokens read, both sides of every pair. A repeated request returns from a cache with
cached: trueand costs nothing. The request and result are saved as a run.
POST /v1/edits · GET /v1/edits · GET and DELETE /v1/edits/{id}
- Request
name;description;ops, up to 4,096 operations. A feature operation is{"layer", "feature", "scale"}with a scale from −8 to 8 and an optionalwhen{"layer", "feature", "above"}. Other kinds:{"kind": "head", "checkpoint"}and{"kind": "probe", "probe", "above"}.- Response
201with the edit'sid,nameand a summary of its operations. Lists includeevaluation_runandpublishable.DELETEreturns{"deleted": true}and also removes the edit's model IDs.- Errors
- 404 unknown edit · 409 at the limit of 500 edits · 422 invalid operations
- Cost
- Free.
POST /v1/edits/auto
- Request
goal, 1 to 500 characters;pairs, 4 to 48[record_a, record_b]pairs;options;name;max_features, 1 to 32 (default 16);scales, 1 to 4 scales to try (default[0, 0.5]);seed;suite{"n", "seed", "area"}.- Response
201withedit, the saved draft;split, the discovery, selection and confirmation pairs;candidates;searchwith every setting tried;confirmation, the gap between the two sides of each pair before and after;evaluationon the general suite;evaluation_run;run_id. When no setting helps,200withedit: nullandno_edit_reason. It never deploys.- Errors
- 402 · 409 at the limit of 500 edits · 422 fewer than 4 pairs or an invalid goal · 429 · 503
- Cost
- Tokens read by discovery, the search and the evaluation.
POST /v1/edits/{id}/health
- Request
n, 1 to 500 held-out decisions (default 200);seed.- Response
status, the worst of the checks;checks, each withname,status(pass,warnorfail), a one-line measurement, its reason and its rule:general_suite,flip_rate,calibration,faithfulnesson 8 held-out decisions andlabel_coverage;publishable;evaluation_run;run_id.- Errors
- 402 · 404 unknown edit · 429 · 503
- Cost
- Tokens read. The suite is saved as an evaluation run, so a passing gate makes the edit publishable whatever the check status.
POST /v1/evaluate · POST /v1/evaluate/dataset
- Request
edit_id,modelorops. For/v1/evaluate:suite{"kind": "general", "n", "seed", "area"}, n from 1 to 500 (default 200) labelled held-out decisions this organization never used. For/v1/evaluate/dataset:recordsordataset_id, 1 to 500 records withanswers, up to 512 questions in total;pairs, up to 500 index pairs;baseline_edit_id;purpose,evaluation(default) ordevelopment.- Response
baseandedited(accuracy,nll,ece, paired metrics);edit_effect(choice_flip_rate,mean_total_variation);ci, 95% intervals from a paired bootstrap;significance, an exact McNemar test;summary, one sentence;gate(eligible,labelled,purpose,overlap_used_records,reasons);decisions, each with the expected answer and both choices;dataset_sha256;run_id.- Errors
- 402 · 404 · 409 with
error_typeoverlapwhenpurposeisevaluationand records were already used, withoverlap_indexes· 422 · 429 · 503 - Cost
- Tokens read by the original and the edited model. The request and result are saved as a run.
POST /v1/diff
- Request
aandb, each"base", an edit ID, a model ID or{"ops": […]};recordsordataset_id, up to 500 records, orsample{"n", "seed", "area"}with n up to 500 (default 200); up to 512 questions in total;amplify, 0 to 64;top, 1 to 100 (default 20);explain, 0 to 24 (default 6).- Response
flips, the count and rate with an interval;top_flips, ranked by the change in margin;nearest_flips, the unflipped decisions with the smallest amplification that flips them;amplified, what flips atamplify;feature_deltas, the features whose effect changed most on theexplainmost-changed decisions;accuracyof both sides,ciandsignificance;a;b;engine_version;labels_version;run_id.- Errors
- 402 · 404 unknown side · 422 · 429 · 503
- Cost
- Tokens read by both sides. The request and result are saved as a run.
POST /v1/datasets/inspect · POST /v1/datasets · GET /v1/datasets · GET and DELETE /v1/datasets/{id}
- Request
records, up to 2,000, ordataset_id;scan(defaulttrue) for the shortcut scan;layers, 1 to 8 layers to scan. Uploads addname, up to 80 characters.GET /v1/datasets/{id}?records=1returns the records. Adataset_idworks whereverrecordsdoes.- Response
- Counts per area and question shape; label balance and majority share; exact, conflicting and near duplicates; overlap with the general held-out samples and with records you used; single-feature and single-word shortcuts chosen on one half and scored on the other. Uploads return
201with the datasetidand this report. - Errors
- 402 · 404 unknown dataset · 409 at the limit of 200 datasets · 422 · 429 · 503
- Cost
- Tokens read by the scan, on inspection and on upload. Listing, reading and deleting are free.
POST /v1/deploy · DELETE /v1/deploy/{model_id} · GET /v1/deployments
- Request
edit_id, an evaluated edit;model_id, up to 64 lowercase letters, digits, dots, dashes or underscores.- Response
201withmodel_id,edit_id,base,evaluation_runand the call to make.- Errors
- 404 unknown edit · 409 not evaluated, ID in use, or at the limit of 50 model IDs · 422 invalid or reserved ID
- Cost
- Free. Decisions with the model ID cost the base's input rate.
POST /v1/train · POST /v1/train/estimate · GET /v1/train · GET /v1/train/{id} · POST /v1/train/{id}/stop · GET /v1/checkpoints/heads
- Request
name, up to 80 characters;recordsordataset_id, up to 2,000 withanswersand at least 10 answered questions;pairs, groups of 2 to 16 record indexes that should get the same decision, at least 4 groups when there are no answers;start_edit_id;spec:steps1 to 5,000 (800),rank1 to 128 (16),lr(0.003),anchor_records0 to 6,000 (2,000),max_kl(0.003),min_agreement(0.97),seed(31). The estimate takes the same body.- Response
202with the job. Itsstatusmoves fromqueuedtorunning, thencompleted,stoppedorfailed;stageandprogress(step,steps,eta_seconds) report where it is. A finished job names thecheckpoint, theedit_id, the held-outreport, thesplitand itstiming. Stop keeps the best validated step. The estimate returnsmodel_tokens,tokens_by_part,minutes,queue_aheadandprice.- Errors
- 402 · 404 unknown start edit · 409 two runs already queued or running · 422 · 503 training unavailable
- Cost
- Tokens read, charged when the run ends, including a stopped or failed run. Runs from different organizations take turns. The estimate is free.
POST /v1/probes · GET /v1/probes · POST /v1/probes/{id}/score · GET and DELETE /v1/probes/{id}
- Request
name;layer;recordsordataset_id, 20 to 2,000 withlabeltrueorfalseand at least 5 of each;seed;edit_id. Scoring takes 1 to 500 records.- Response
201with the probe ID andheld_out_report: AUROC and recall at 1% and 10% false positives on the held-out quarter, with the measured false-positive rate;text_baseline, the same measurements for a word-bigram model on the same split;beats_text_baseline. Scores carryscoreand whether each passes the 1% and 10% thresholds.DELETEreturns{"deleted": true}.- Errors
- 402 · 404 unknown probe · 422 · 429 at the limit of 50 probes
- Cost
- Tokens read.
GET /v1/runs · GET and DELETE /v1/runs/{id} · GET /v1/samples
- Request
kindfilters runs:discover,evaluate,development,diff,healthorauto. Samples takenup to 50,seedandarea.- Response
- Saved runs with their exact request and result. A run read back adds
version_drift, the engine and label versions that changed since it ran.DELETEreturns{"deleted": true}. Samples are held-out decisions, with the expected answer kept beside each record. - Cost
- Free.
Choices, conditions, and scores
Each question has a type, instructions, and criteria. Mix question types in a single request under distinct names.
Questions are independent. Each sees the shared state and its own instructions and criteria. A question cannot read another question or use its answer. Put common context in state.
For a decision that depends on an earlier answer, include that answer in the state of a later request. Use a new request key for the new body.
For choices, describe what belongs in each option. If an option is a fallback, say what it includes and what it excludes.
| Type | Criteria | Answer |
|---|---|---|
choice | An object mapping option names to descriptions. | The chosen name, probabilities for every option, and confidence. |
Yes/no probabilitynoul | Optional descriptions for true and false. | noul, the probability of true, from 0 to 1. |
score | An ordered list of rubric descriptions, from lowest to highest. | An expected score, probabilities for each level, confidence, and a legend. Levels are indexed from 0. |
The yes/no type is spelled noul in requests and answers. bool is rejected.
For example, a score rubric ["Unrelated", "Tangential", "Partially useful", "Directly useful"] produces an expected score between 0 and 3. It can be fractional.
| Limit | Built-in models | Customizable bases and your model IDs |
|---|---|---|
| Questions per request or record | 1 to 64 | 1 to 16 |
| Question types | choice, noul, score | choice |
| Options per question | Up to 255 | 2 to 64 |
| Length | 49,152 rendered state characters, and a 24,000-token row budget | 2,048 rendered tokens per question |
| Request body | 1 MiB | 1 MiB |
The row budget on built-in models is the longest rendered question row multiplied by the number of questions. Shorten the state or split questions when a request exceeds it.
Pricing
Call GET https://api.spinda.ai/v1/models for the model ID and pricing. A catalog entry does not mean the model is currently available. GET https://api.spinda.ai/health reports separate models and images readiness maps; these are snapshots, not guarantees that a later request will succeed.
| Model ID | USD / 1M input tokens |
|---|---|
decision-model-large | $0.039 |
Input tokens include the formatted state, instructions, criteria, and decision delimiters. The shared state is counted once per request. Output is free. Failed requests are not charged.
Your initial organization receives a $50 usage allowance. Successful requests draw from that allowance. Manage organization members, keys, and usage in the console.
Requests pause when the available allowance cannot cover the next request. Contact support to arrange additional usage. Using your allowance does not trigger an automatic payment.
Customization prices
Inspection, measurement and training are charged for the tokens the model reads, at the base's input rate, after the work finishes. Starting that work requires an available allowance. Each organization can keep 500 edits, 50 deployed model IDs and 50 probes, and can have 2 training runs queued or running.
| Spinda Mint | Price |
|---|---|
| Decisions, inspection and evaluation | $0.039 per 1M input tokens |
| Output | Free |
Usage is charged for the tokens the model reads. Get a training estimate before starting a run.
Rate limits
Each organization can send up to 128 requests per second, with short bursts up to 256, across all routes. Beyond that, the API returns 429 with Retry-After.
Model work on a customizable base runs one operation at a time per base. That covers analyze, discover, evaluate, probes and every other POST or DELETE except decisions. Waiting requests take turns between organizations. An organization can have 4 requests waiting per base; a fifth, or one that would wait longer than 180 seconds, returns 429 with Retry-After: 10. Decisions with /v1/systemone queue separately and are not refused for waiting.
The API waits up to 120 seconds for a customization response, then returns 503. The work can still finish and be charged; list your runs to check. Training runs return at once and run in the background, one at a time per base.
Every authenticated /v1 response carries RateLimit-Limit, the burst size; RateLimit-Remaining, the requests left in it; RateLimit-Reset, the seconds until it is full again; and RateLimit-Policy. These describe the organization's request bucket. The per-base queue of 4 is separate and has no header.
Errors and retries
Every /v1 error has the same JSON shape. error is the message, error_type is a stable type such as invalid_request, not_found, evaluation_required, overlap or rate_limited, param names the field at fault when known, and request_id matches the x-request-id header. A body that is not JSON returns 400 with invalid_json.
{"error": "unknown edit 'edit_123'", "error_type": "not_found", "param": "edit_id", "request_id": "req_…"}
In the playground, Recover original request resends the saved inputs and request key. Editor changes are kept for your next request. Keep the tab open: recovery is held in memory, not browser storage. Starting a separate request requires confirmation and can be charged separately.
Generate and save a unique Idempotency-Key before each logical request. To recover an uncertain attempt, reuse its original key and identical body. Completed responses can be replayed for 24 hours after completion, including saved failures. Replaying a response does not run inference again. The key belongs to the organization, so changing API keys within the same organization does not create a separate request identity.
| Status or outcome | What to do |
|---|---|
| 401 / 403 | Check the API key and organization access. |
| 402 | The organization’s available allowance cannot cover this request. |
| 409 · Still in progress | Wait, then retry the original key and body. |
| 409 · Different request body | Restore the original body to recover that attempt. Use a new unique key for a different request. |
| 409 · Previous attempt interrupted and not charged | The attempt cannot be resumed. Use a new unique key if you choose to submit a new attempt. |
| 409 · Replay window expired | The saved response is no longer available and the old key is not reusable. Check your own records before making a new request with a new key; an earlier success may already have been charged, and the new request can be charged separately. |
| 413 / 422 | Reduce the request size or correct the request format. |
| 429 | Reduce concurrency. Retry the original key and body with backoff, honoring Retry-After when present. |
| 503 · “The model could not complete the request. Your allowance was not charged.” or “Request interrupted.” | This is a saved failure. The same key replays it. Use a new unique key only if you choose to make a new attempt. |
| Other 503 / 504, client timeout or lost response | The outcome may be unknown. Retry with backoff using the original key and identical body to recover it. A temporary availability error can hide an earlier outcome. Keep the original key even when a status code or timeout suggests a failure. |
Bound retries by attempt count and elapsed time, with increasing delays and jitter. Stop when a saved terminal response is returned; if uncertainty remains after retries, keep the original key and investigate before starting another request. Save the x-request-id response header for troubleshooting; it does not replace your Idempotency-Key. x-typesafe-request-id repeats the same value for one more version.
Customization POST routes accept Idempotency-Key too. A retry with the same key and body within 24 hours returns the first response with Idempotent-Replayed: true and runs no new work. The same key with a different body returns 409 with idempotency_conflict. A call refused before it ran, with 402, 429 or 503, is not kept, so a retry with the same key runs it. While the first call is still running, the key returns 409 with idempotency_in_progress and Retry-After. When the connection to the model dropped during a call, the key returns 409 with idempotency_unknown so the work cannot run twice; list your edits, runs, jobs or probes to see what finished before you send it again with a new key.
Data handling
The inference cluster is in Texas, United States. Content is processed to provide and operate the service, prevent abuse, and meet legal obligations. We do not train models on your content without prior consent. Derived operational telemetry may be used to improve the service.
The gateway provides a 24-hour replay window for encrypted responses, followed by background cleanup of active records. Cleanup timing and storage remnants are described in the Privacy Policy. Usage records contain metadata, never your state or questions. Model caches are isolated per request and evicted as capacity is reused.
WorkOS handles sign-in and account identity. Cloudflare provides public HTTPS ingress. These services process the data needed to provide their functions.
What is kept, and for how long
| Object | What is stored | How long | How to delete |
|---|---|---|---|
| Decision requests | Metadata and an encrypted response for replay | The response for 24 hours; metadata with account history | Ask us |
| Customization requests with an Idempotency-Key | An encrypted response for replay | 24 hours | Expires automatically |
| Edits | Name, description and operations | Until you delete them | DELETE /v1/edits/{id} |
| Model IDs | The model ID and its edit | Until you remove them | DELETE /v1/deploy/{model_id} |
| Probes | Probe weights and the held-out report | Until you delete them | DELETE /v1/probes/{id} |
| Saved runs | The full request of each discover, evaluate, diff, health and automatic-edit call, including records, with its result | Until you delete them | DELETE /v1/runs/{id} |
| Uploaded datasets | The records and their inspection report | Until you delete them | DELETE /v1/datasets/{id} |
| Record-use hashes | A hash of each record used to explore or build edits, without its content | With account history, so the publish gate can find reused records | Ask us |
| Training runs | Settings, status and report; uploaded records stay in memory until the run ends | Until you ask us to delete them | Ask us |
| Trained checkpoints | Head weights and metadata | Until you ask us to delete them | Ask us |
| Natures Lab | Investigations with their chat messages, uploaded datasets and experiments | Until you delete them | Delete investigations and datasets in Natures Lab; ask us for the rest |
| Audit log | Who changed what in the organization, and when | With account history | Ask us |
Explanations from /v1/analyze are not saved. A hash of each record used in analyze, discover, training, probes, automatic edits and development evaluations is kept without its content, so the publish gate can find reused records. To delete anything marked “Ask us”, email [email protected]. Security lists where requests run and every provider involved.
Read the Privacy Policy for retention details and privacy requests, and the Terms of Service for account and API use.