For developers
JSON Guarantee API
Cheap models advertise JSON mode — then ship empty bodies, truncated strings, and markdown fences. SureJSON is the drop-in layer that only returns parseable JSON (or an honest failure).
Real pain
Why production parsers keep breaking
-
Empty JSON mode responses
Providers (including DeepSeek) document that
response_format: json_objectcan still return empty content — especially with thinking modes and tight token budgets. -
Truncation = invalid JSON
Hit
max_tokensmid-object andJSON.parsedies.finish_reason: lengthshows up after the damage. - Valid JSON ≠ usable schema JSON mode only means “parseable,” not “has your keys.” Pipelines fail silently on missing fields and wrong enums.
- Markdown and chatter leak through Models wrap JSON in fences or add “sure, here you go” — your catch blocks become the product.
Solution
Two ways to ship sure JSON
-
Drop-in OpenAI client
Point
base_urlat SureJSON. Keep/v1/chat/completions. Model:surejson-fast. Same SDK, guaranteed parseable content path. -
Sure Envelope —
POST /v1/sureSkipJSON.parse. Get{ ok, guarantee, data }. If anything is empty or unparseable, you get a structured failure — not a broken string.
Quickstart
Swap the base URL. Keep your code.
Claim a free key from the operator workspace, then call the API.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_SUREJSON_KEY",
base_url="https://surejson.com/v1",
)
res = client.chat.completions.create(
model="surejson-fast",
messages=[
{"role": "system", "content": "Return ONLY valid JSON."},
{"role": "user", "content": "Extract name and company from: Sam Ortiz at RiverCo"},
],
response_format={"type": "json_object"},
)
print(res.choices[0].message.content) # always parseable when ok
Or use the Sure Envelope — no parse dance:
curl -s https://surejson.com/v1/sure \
-H "Authorization: Bearer YOUR_SUREJSON_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "Extract name and company from: Sam Ortiz at RiverCo",
"schema_hint": "{\"name\": string, \"company\": string}"
}'
# → { "ok": true, "guarantee": "parseable_json", "data": { ... } }
Live JSON lab
Prove the guarantee in your browser.
Free. Uses the same key as the everyday workspace.
Endpoints
What you call
POST /v1/sure- Sure Envelope. Returns
{ ok, guarantee, data }or structured failure. Best DX when you never want to catch parse errors. POST /v1/chat/completions- OpenAI-compatible drop-in. Use any OpenAI SDK with
base_url=https://surejson.com/v1. POST /v1/credits/claim- Free start key (also created from the operator workspace).
GET /v1/credits·GET /v1/models- Balance + model list.