Capability · Math agent
Math and data analysis, computed, not guessed.
A chat endpoint that writes and runs Python or R in a region-pinned, network-isolated sandbox to compute and verify — then returns charts as inspectable SVG and diagrams as Mermaid, never opaque raster images.
POST /v1/math/chat/completions
What you get
Built for regulated workloads
Point any OpenAI SDK at /v1/math/chat/completions and ask in plain language. It is the chat endpoint with two differences: a system prompt tuned for careful, step-by-step math and data analysis, and a code sandbox switched on by default — so the model writes and runs Python or R to compute and verify instead of guessing, then hands back the answer with charts as inspectable SVG and diagrams as Mermaid. Set X-Region per request; the sandbox runs in your jurisdiction.
Compute, don’t hallucinate
Figures as inspectable SVG
Diagrams as Mermaid
Region-pinned & ephemeral
General traffic only
Availability & pricing
Where it runs, what it costs
Every route is region-resident and the PHI gate is enforced per call. Prices include the flat +10% gateway margin and mirror the live /v1/pricing rate card.
| Region | Provider | Model | Tier | Price |
|---|---|---|---|---|
| CH | Infomaniak | qwen3.5 (397B) | General | $0.97 / $4.36 |
| EU | Scaleway | qwen3.5 (397B) | General | $0.71 / $4.28 |
| UK | gemini-2-5-flash | General | $0.33 / $2.75 | |
| US | Together | qwen3.5 · glm-5.2 | General | $0.77 / $3.85 |
| Other | — | reasoning only (no sandbox) | No route | — |
Billed as ordinary chat tokens (per 1M in / out, gateway margin included) — you pay for the model that answers; the sandbox is included. Code execution is general-traffic only (X-PHI:true → phi_blocked) and runs only where a compliant in-region sandbox exists — Switzerland, the EU, the UK and the US. Pin any code-capable model, or let the region default decide. Full rate card at /pricing.
Try it
A real call, end to end
Ask in plain language; the agent writes and runs the code in your region, then hands back the result with an inspectable figure.
curl https://phi-cloud.com/api/v1/math/chat/completions \
-H "Authorization: Bearer $PHI_API_KEY" \
-H "X-Region: EU" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen3.5",
"messages": [
{"role": "user", "content": "Fit a linear model to this data and plot it with ggplot2."}
]
}'x-phi-routed: scaleway-qwen3-5-397b/EU/non_phi
x-phi-tier: non_phi
x-phi-sandbox-figures: 1
# the answer embeds a ```svg figure (Figure 1)Sandbox & residency
- Code runs in an ephemeral, network-isolated container pinned to your region — one sandbox per request, torn down when the answer is returned.
- CH, EU and UK execute in the EU compliance boundary; US executes in the US (FedRAMP) boundary. The sandbox never runs out-of-region.
- Regions with no compliant sandbox (everywhere outside CH/EU/UK/US) degrade to plain step-by-step reasoning — the call still answers, it just does not run code.
- General traffic only: X-PHI:true returns phi_blocked until the sandbox BAA lands. No code, input or output is persisted by the proxy.
- · Same OpenAI chat shape as /v1/chat/completions — only the math-tuned default system prompt and on-by-default code execution differ. Disable per request with code_execution:false.
- · Streaming is disabled on this route (the loop must inspect tool calls), so the response is buffered.
- · Python keeps variables across tool calls within a request; each R call is a fresh process, so keep R snippets self-contained.
FAQ
Common questions
Ready when you are
Put math agent in production — without giving up your data.
Spin up a key in minutes. The residency and PHI posture above arrives unchanged.
Free to test · Prepaid credits, no subscription · No data retained