JDogo
Open playground

HTTP API

The server behind the playground is also a small JSON API. Use it from any language that has no SDK, or to check results from a script.

Start it as in Running the playground. Every endpoint takes and returns JSON unless noted, accepts bodies up to 10 MB, and shares the per-client limit: a burst of 40 calls, then 10 a second. Over the limit you get 429 with Retry-After.

Encode and decode

curl -s localhost:8090/api/encode -d '{"data":[{"id":1,"city":"Paris"},{"id":2,"city":"Oslo"}],"mode":"compact"}'
{"mode": "compact", "text": "@id,city\n1,Paris\n2,Oslo",
 "tokensCl100k": 13, "tokensO200k": 13, "bytes": 23, "gzipBytes": 43,
 "jsonTokensCl100k": 20, "jsonTokensO200k": 20, "jsonBytes": 48, "jsonGzipBytes": 56}

On payloads this small, gzip adds more than it saves; the gzip figures matter from a few kilobytes up.

EndpointBodyReturns
POST /api/encode{"data": …, "mode": "compact" | "readable" | "typed"}The text, its tokens in cl100k and o200k, bytes and gzip bytes, and the same figures for JSON
POST /api/compactRaw JSON; add ?mode=typed for a typed documentThe JDogo text and its size
POST /api/decodeRaw JDogo textThe JSON value
POST /api/columnarRaw JSON tablerowCount, columnCount, columns (one list per column), types and the JDogo text

Compare formats

EndpointBodyReturns
POST /api/compare{"data": …, "title": "…"}, or {"caseId": "…"} for a benchmark caseTokens, bytes, gzip size, round-trip check and timings for JSON, YAML, TOON and each JDogo form
GET /api/compare/casesThe benchmark cases you can pass as caseId
POST /api/profileRaw JSONToken and cost figures for the payload

At most seven comparisons run or wait at once; beyond that you get 503 with Retry-After. Timings on a public server are short runs; full timing runs need dev mode.

Count tokens

EndpointBodyReturns
POST /api/tokensRaw textTokens in cl100k and o200k
POST /api/tokens/batch{"texts": ["…", …], "encoding": "cl100k" | "o200k"}, up to 2,000 texts{"tokens": [n, …]} in the same order
POST /api/tokens/spans{"text": "…", "encoding": "cl100k"}The text split into its tokens, for highlighting

Prompts, compute and grammars

EndpointBodyReturns
POST /api/studio/prompt{"question": "…", "data": …}The prompt JDogo would send to a model, and its tokens
POST /api/compute/schemacard{"data": …}The schema card, its tokens and the routing instruction
POST /api/compute/eval{"expression": "count where status = late", "data": …}{"ok": true, "result": …}
POST /api/compute/ask{"question", "data", "mockResponse", "allowGroupBy"}What ask() does with a model reply you supply: the route, the expression and the answer. No model is called
POST /api/gbnfRaw JSON sampleA GBNF grammar (kind is table or generic), the sample as JDogo, and its tokens
POST /api/diff{"base": {…}, "target": {…}}{"delta": "…"}, the change as a context delta

Compute errors come back as 200 with {"ok": false, "error": "…"}, so a bad expression is data, not a failed call. The expression language is in Compute expressions.

Health and evidence

EndpointReturns
GET /api/health{"status":"UP"}; not rate limited, for load balancers and probes
GET /api/studio/liveThe recorded evidence behind the site's figures
POST /api/test/suiteRuns the conformance suite on the server and reports the results

Dev mode only

With -Djdogo.dev=true, on a trusted machine: POST /api/llm/compare (calls a model provider with a key you pass), /api/stress/million (a million-row timing run) and POST /api/studio/live (refreshes the evidence). A public server answers these with 403.

Errors

StatusMeans
400Invalid JSON or JDogo, or a missing field; {"error": "…"} says which
405Wrong method
413Body over 10 MB
429, 503Too many calls, or the server is busy; retry after Retry-After seconds