← Math Solver / API
Get a token

Drive Math Solver from your own code

Everything the web app does goes through one public surface. Base URL:

https://api.skillsafe.ai/v1/app-api

Every request carries Authorization: Bearer <token> and Content-Type: application/json. Every response is a JSON envelope: {"ok":true,"data":{…}} on success and {"ok":false,"error":{"code":"…","message":"…"}} on failure. Read error.code, not only the HTTP status.

Errors

CodeMeaningWhat to do
UNAUTHORIZEDMissing, expired or wrong-app token.Mint a guest token or sign in again.
INSUFFICIENT_CREDITSBalance below min_credits.Top up. /estimate is free and tells you the hold.
VALIDATION_ERRORThe input object failed validation.Check error.details. The body is the input object itself — never wrap it in {"input": …}.
RATE_LIMITEDToo many requests.Back off and retry.
JOB_FAILEDThe run started and did not complete.Retry with the same Idempotency-Key.

The task field: two lanes

Every input carries task. "solve" solves a problem; "explain" explains one step of an earlier solution. Fields are scalars; the two object-valued ones (facts, steps) travel as JSON strings.

FieldTypeLaneMeaning
taskstringboth, required"solve" or "explain".
problemstringboth, requiredThe problem text. The web app sends at most 4,000 characters, cut on line boundaries with a marker.
levelstringboth"auto", "school" or "university".
factsstring (JSON)solveThe free in-browser prescan: kind_guess, word_problem, variables, and numeric (real roots, a value, a definite integral or a limit estimate). The answer is held to agree with it.
stepsstring (JSON)explainThe earlier solution's steps, [{n, title, explanation, math}].
stepnumberexplain1-based number of the step to explain.
questionstringexplainWhat is unclear, or the person's own working to find the slip in.
retry_notestringbothSent only on the one automatic reformat retry.

The output contract

The output (output.output) is one JSON object. For solve: task, status (ok · not_math · ambiguous · unsolvable), message, title, topic, restated, given[], approach, steps[] (title, explanation with inline math in \( \), math as display LaTeX), final_answer (latex, text), check, common_mistakes[], notes.

check restates the final answer in plain calculator syntax so it can be verified by substituting numbers. Its type is one of solve · evaluate · derivative · antiderivative · definite_integral · limit · equivalent · inequality · none. Example: {"type":"solve","equations":["x^2-5*x+6=0"],"variables":["x"],"solutions":[{"x":"2"},{"x":"3"}]}. The web app runs this check in the browser; if you call the API directly, run your own.

For explain: task, step, headline, explanation, sub_steps[] (explanation, math), key_idea, watch_out, answer_to_question, correction.

1. Get a token

A guest token is enough for /me and /estimate. Running is metered and needs a personal token from signing in. The tokens page shows yours and copies it. Replace YOUR_TOKEN below with it.

2. Check the session and the balance

/me returns subject_type, subject_id and credits. Signed in means subject_type === "user".

3. Price it before you run it

/estimate is free and starts no job. hold_credits is a reservation priced against the longest possible answer, not the price. Estimate each lane you use. Solve:

Explain (worked example for the second lane):

4. Run and poll

/run returns a job. Always send an Idempotency-Key — the same key is the same run, so a retry cannot bill twice. The web app derives it from the lane and a hash of the input.

5. Stream it

/run-stream answers with server-sent events and ends with a done frame carrying the whole output, charged_credits and truncated. If truncated is true the balance ran low mid-answer: parse what arrived and top up for the rest.