Developer Hub · OpenAPI 3.1 · REST + MCP + SDK + CLI
Developer & API documentation
Integrate the deterministic GridForge physics solver into portfolio underwriting, site screening pipelines, and autonomous coding agents. Every endpoint publishes its JSON schema, metered unit weight, E0–E7 evidence classes, and SHA-256 provenance digests.
1. Hosts & OpenAPI 3.1 Scopes
Engine compute endpoints and website registry endpoints live on distinct origins. Every path in /openapi.json declares explicit per-path servers so code generators route requests to the right host automatically, and scoped specs are available for single-host clients:
https://gridforge-engine.fly.dev
Serves all /v1/*, /health, and /mcp routes. Engine-only spec: /openapi.json?scope=engine
https://timetopower.ai
Serves signed-in organisation, site, and hall registry routes under /api/*. Site-only spec: /openapi.json?scope=site
/openapi.json
Unified OpenAPI 3.1 document with per-path and per-operation servers plus worked examples from the synthetic reference hall.
2. Authentication (`gfk1.` Keys & RFC 8628 Device Flow)
Signed `gfk1.` API Keys
Metered /v1/* endpoints and GET /v1/usage authenticate with signed gfk1.<payload>.<sig> tokens passed either as Authorization: Bearer <key> or X-API-Key: <key>. Public discovery reads (/health, /v1/version, /v1/tools, /v1/platforms, /v1/intake/template, /v1/calibration, /v1/calibration/residuals) and zero-unit POSTs (/v1/qualify, /v1/estimate) require no key.
RFC 8628 CLI Device Authorization
Terminal users run gridforge login, which opens a short-lived browser verification code (15-minute expiry, slow_down polling backoff) and stores a scoped credential locally under ~/.config/gridforge/ with 0600 permissions. Revoke at any time with gridforge logout or at /console/api-keys.
3. Error Semantics (`401` / `402` / `409` / `422` / `429`)
Every error response is UTF-8 JSON carrying "schema_version": "gridforge/api/1" and an actionable error message (plus reason, fix, and request_id where applicable). Rejected or failed calls are refunded immediately and never accrue billable units.
| HTTP Status | Engine Meaning | Caller Discipline |
|---|---|---|
| 400 | the body is not valid JSON or not a JSON object, or the Idempotency-Key is longer than the limit | Fix request before resending |
| 401 | a metered route was called without a key, or with one the engine does not accept | Fix request before resending |
| 402 | the key's monthly allowance or cap is spent; the call was refused and not charged. Buy more, do not retry | Do not retry — top up or raise cap at /console/usage |
| 409 | the requested action conflicts with current readiness or state (for example require_rfq_ready on an architecture that is not yet RFQ-ready) | Fix request before resending |
| 413 | the body is larger than 512 KiB | Fix request before resending |
| 415 | the body was declared as anything other than application/json | Fix request before resending |
| 422 | the input is too thin or invalid, or an Idempotency-Key was reused with a different body; nothing was solved | Fix request before resending |
| 429 | the per-client request rate limit was exceeded; wait and retry (the limit is rate_limit_per_minute at /v1/version) | Retry with backoff & same Idempotency-Key |
| 500 | the engine failed on a valid request; the charge is refunded | Retry with backoff & same Idempotency-Key |
| 503 | paid endpoints are not configured on that deployment, or a charge could not be recorded durably | Retry with backoff & same Idempotency-Key |
4. Idempotency (`Idempotency-Key` & Body-Mismatch Protection)
- Attach
Idempotency-Key(at most 150 characters; RFC 9562 UUIDv7 recommended) on meteredPOSTcalls and/mcptools/callinvocations. - Keys are scoped to
(account, endpoint, key)for 24 hours. A matching retry returns the original answer withX-GridForge-Idempotent-Replay: trueandX-GridForge-Units: 0(zero second charge). - Body-mismatch protection: Reusing an existing
Idempotency-Keywith different payload bytes on REST (or different canonical arguments over MCP) is refused immediately (HTTP422on REST; JSON-RPC-32602withdata.status: 422on MCP; state conflicts on readiness gates return409) without solving or charging. - Maximum request body size is 512 KiB; oversized bodies fail fast with HTTP
413.
5. Rate Limits, IPv6 Prefix Buckets & Concurrency Slots
Window Limits & Headers
Each deployment publishes its per-minute limit at GET /v1/version (rate_limit_per_minute, default 30 req/min on compute routes and at least 600 req/min on discovery reads). Clients should inspect RateLimit-Limit, RateLimit-Remaining, RateLimit-Reset, and Retry-After. IPv6 callers are metered across both their /64 subnet and their enclosing /48 allocation (32x multiple) so prefix rotation cannot bypass throttling.
Concurrent Solve Slots
Heavy physics solves run inside a deterministic concurrency gate (default 16 global concurrent solves; keyless callers are bounded to at most half the global pool and 2 concurrent solves per caller identity so authenticated workloads retain dedicated headroom). Shed requests receive HTTP 503 with Retry-After and zero unit charge.
6. Metering, Unit Weights & Hard Spend Caps
One unit corresponds to one hall solve. New developer accounts include 25 free units in an isolated trial scope. Pay-as-you-go usage beyond the free allowance bills in arrears at €2 per unit with a customer-controlled monthly spend cap from €20 to €2,000 (default €100). Monthly balances below €5 carry forward without an invoice; hitting a cap stops immediately with HTTP 402.
Committed Monthly Plan
API — Triage
€900 per month
600 units / month
Metered access to the engine for one team screening a portfolio it already owns. 600 units a month: 600 screen calls, or 120 full solves, or any mix. The free qualifier stays free and never touches the allowance.
Committed Monthly Plan
API — Scale
€2,900 per month
2,500 units / month
For a platform or fund pricing halls continuously rather than in batches. 2,500 units a month and the portfolio endpoint billed per hall. Change notes (/v1/diff) are available on every plan.
Committed Monthly Plan
API — Platform
€7,500 per month
10,000 units / month
For embedding the engine in a product your own customers use. 10,000 units a month at the lowest per-unit rate we sell. Showing output to your own customers is not licensed by default: ask us before you do, and any terms are agreed by email, not by the plan.
7. Versioning & 90-Day Deprecation / Sunset Policy
- Major URI Prefix & Schema Version: All stable endpoints live under
/v1/*and return"schema_version": "gridforge/api/1". Breaking input/output changes require a new major URI prefix (/v2/*). - RFC 9745 `Deprecation` & RFC 8594 `Sunset` Headers: Any deprecated endpoint or field emits standard
DeprecationandSunsetHTTP headers plus"deprecated": truein/openapi.json. - Minimum 90-Day Sunset Window: Customer-callable
/v1/*routes andgridforge_*MCP tools provide at least 90 calendar days between deprecation notice and retirement.
8. TypeScript SDK, Python CLI & MCP Server
Use the zero-dependency @timetopower/gridforge-sdk client in Node.js/TypeScript, the zero-dependency Python gridforge CLI (/developers/cli or in-browser /console/shell), or JSON-RPC 2.0 MCP at https://gridforge-engine.fly.dev/mcp (protocol 2025-06-18, batch cap 10).
import { GridForgeApiError, GridForgeClient } from "@timetopower/gridforge-sdk";
const client = new GridForgeClient({
apiKey: process.env.GRIDFORGE_API_KEY, // signed gfk1.* token
});
// 0-unit qualification against synthetic reference hall inputs
const qual = await client.qualify({
contracted_MW: 12,
firm_capacity_MVA: 14,
current_site_peak_MW: 7.4,
current_it_load_MW: 4.9,
busway_ampacity_A: 400,
tapoff_max_A: 63,
plant_supply_C: 6,
positions_available: 180,
platform: "gb300_nvl72",
});
console.log(qual.binding_constraint.name, qual.as_found.racks);# Authenticate via RFC 8628 browser device flow
python3 -m gridforge login
# Price a call before spending units (0 units)
python3 -m gridforge estimate /v1/study
# Run a remote Density Screen (1 unit)
python3 -m gridforge screen examples/intake/reference_hall.json --remote9. Endpoint Directory (24 Routes)
Select any route for its full JSON schema, cURL/SDK/CLI snippets, error contract, and synthetic reference hall worked example.
Free.
SDK: client.qualify() →
Free, no API key, never metered.
SDK: client.estimate() →
Density Screen.
SDK: client.screen() →
Time-to-Power scenario comparison.
SDK: client.compare() →
Capacity & Density Envelope Study.
SDK: client.study() →
Rank halls.
SDK: client.portfolio() →
A priced proposal for a named engagement, built from what the engine already found.
SDK: client.proposal() →
Walkthrough deck for a hall.
SDK: client.deck() →
What moved, and which input moved it.
SDK: client.diff() →
Turn a binding constraint into a tender-ready technical specification: every numeric requirement derived from the capacity model and naming the constraint it came from, quoted at the site's own conditions rather than a manufacturer's reference condition, plus a machine-readable response schedule.
SDK: client.spec() →
Compare supplier responses against the capacity model: what each bid does to the energisation date and to deployable rack count, not only what it costs.
SDK: client.bids() →
The Power Readiness Case: what is stopping this site reaching the target capacity, what fixes it, what that costs, what it does to the schedule, and what to do next.
SDK: client.powerAssess() →
The BTM Power Deployment Assessment: given a real load profile and the generation/BESS units actually on the table, compares GRID ONLY, GRID + GENERATION, GRID + BESS and GRID + BESS + GENERATION under one deterministic N/N+1/N+2/2N contingency test each, with CAPEX and lead time read from whatever the request declared (never priced at zero when a unit is uncosted — that architecture is marked not-yet-comparable instead).
SDK: client.powerDeployAssess() →
A tender-ready technical specification for a BTM architecture's generation and storage units: every numeric requirement (nameplate rating, availability/forced-outage rate, start-up time, ramp rate, fuel, BESS power/energy/SOC window) derived from the declared unit and traceable to it, plus a weighted evaluation matrix and a machine-readable response schedule.
SDK: client.powerDeploySpec() →
Rank supplier responses to a BTM tender package (gridforge_power_deploy_spec) with the same comparison rules as gridforge_bids: mandatory non-compliance is never outranked by price, incomplete responses are disqualified not guessed at, and installation method and evidence quality are left to an engineer.
SDK: client.powerDeployBids() →
What this engine serves, how it meters, and its provenance.
SDK: client.version() →
The rack library (the engine's platform library), short form.
SDK: client.platforms() →
The blank intake document with every field.
SDK: client.intakeTemplate() →
How far the model has been reconciled against instrumented sites.
SDK: client.calibration() →
Aggregate residual statistics over approved observation records only.
SDK: client.calibrationResiduals() →
The tool catalogue: OpenAI function-calling shape and MCP shape, the rate card and the auth rule.
SDK: client.tools() →
This key's metered usage for the current UTC month.
SDK: client.usage() →
Liveness check.
SDK: client.health() →
Model Context Protocol over JSON-RPC 2.0.
SDK: client.mcpCall() →