Skip to the main content

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:

Engine Origin

https://gridforge-engine.fly.dev

Serves all /v1/*, /health, and /mcp routes. Engine-only spec: /openapi.json?scope=engine

Website & Registry Origin

https://timetopower.ai

Serves signed-in organisation, site, and hall registry routes under /api/*. Site-only spec: /openapi.json?scope=site

Combined Contract

/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.

GridForge HTTP error status codes, meanings, and retry discipline
HTTP StatusEngine MeaningCaller Discipline
400the body is not valid JSON or not a JSON object, or the Idempotency-Key is longer than the limitFix request before resending
401a metered route was called without a key, or with one the engine does not acceptFix request before resending
402the key's monthly allowance or cap is spent; the call was refused and not charged. Buy more, do not retryDo not retry — top up or raise cap at /console/usage
409the 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
413the body is larger than 512 KiBFix request before resending
415the body was declared as anything other than application/jsonFix request before resending
422the input is too thin or invalid, or an Idempotency-Key was reused with a different body; nothing was solvedFix request before resending
429the 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
500the engine failed on a valid request; the charge is refundedRetry with backoff & same Idempotency-Key
503paid endpoints are not configured on that deployment, or a charge could not be recorded durablyRetry with backoff & same Idempotency-Key

4. Idempotency (`Idempotency-Key` & Body-Mismatch Protection)

  • Attach Idempotency-Key (at most 150 characters; RFC 9562 UUIDv7 recommended) on metered POST calls and /mcp tools/call invocations.
  • Keys are scoped to (account, endpoint, key) for 24 hours. A matching retry returns the original answer with X-GridForge-Idempotent-Replay: true and X-GridForge-Units: 0 (zero second charge).
  • Body-mismatch protection: Reusing an existing Idempotency-Key with different payload bytes on REST (or different canonical arguments over MCP) is refused immediately (HTTP 422 on REST; JSON-RPC -32602 with data.status: 422 on MCP; state conflicts on readiness gates return 409) 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 Deprecation and Sunset HTTP headers plus "deprecated": true in /openapi.json.
  • Minimum 90-Day Sunset Window: Customer-callable /v1/* routes and gridforge_* 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).

TypeScript SDK (@timetopower/gridforge-sdk)
ts
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);
Python stdlib CLI (gridforge)
bash
# 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 --remote

9. Endpoint Directory (24 Routes)

Select any route for its full JSON schema, cURL/SDK/CLI snippets, error contract, and synthetic reference hall worked example.

Open full endpoint matrix (/docs/api) →
POST /v1/qualify0u free

Free.

SDK: client.qualify() →

POST /v1/estimate0u free

Free, no API key, never metered.

SDK: client.estimate() →

POST /v1/screen1u

Density Screen.

SDK: client.screen() →

POST /v1/compare1u

Time-to-Power scenario comparison.

SDK: client.compare() →

POST /v1/study5u

Capacity & Density Envelope Study.

SDK: client.study() →

POST /v1/portfolio1u/hall

Rank halls.

SDK: client.portfolio() →

POST /v1/proposal2u

A priced proposal for a named engagement, built from what the engine already found.

SDK: client.proposal() →

POST /v1/deck3u

Walkthrough deck for a hall.

SDK: client.deck() →

POST /v1/diff2u

What moved, and which input moved it.

SDK: client.diff() →

POST /v1/spec3u

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() →

POST /v1/bids2u

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() →

POST /v1/power/assess5u

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() →

POST /v1/power/deploy/assess5u

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() →

POST /v1/power/deploy/spec3u

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() →

POST /v1/power/deploy/bids2u

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() →

GET /v1/version0u free

What this engine serves, how it meters, and its provenance.

SDK: client.version() →

GET /v1/platforms0u free

The rack library (the engine's platform library), short form.

SDK: client.platforms() →

GET /v1/intake/template0u free

The blank intake document with every field.

SDK: client.intakeTemplate() →

GET /v1/calibration0u free

How far the model has been reconciled against instrumented sites.

SDK: client.calibration() →

GET /v1/calibration/residuals0u free

Aggregate residual statistics over approved observation records only.

SDK: client.calibrationResiduals() →

GET /v1/tools0u free

The tool catalogue: OpenAI function-calling shape and MCP shape, the rate card and the auth rule.

SDK: client.tools() →

GET /v1/usage0u free

This key's metered usage for the current UTC month.

SDK: client.usage() →

GET /health0u free

Liveness check.

SDK: client.health() →

POST /mcp0u free

Model Context Protocol over JSON-RPC 2.0.

SDK: client.mcpCall() →