API versioning and schema contract
OpenGen's Public Developer API is URL-versioned under **/v1 and documented by an authoritative OpenAPI 3.1.0 specification at GET /openapi.json** (current contract version 0.1.3, Apache-2.0 license).
- Public surface size: 24 public endpoints grouped across 6 tags (
models,pricing,generations,assets,webhooks,account). Browse them interactively at API Reference. - Gateway liveness: **
GET /health** is unauthenticated, CORS-enabled, and served withCache-Control: no-store, returning{ "status": "ok", "database": <boolean>, "version": "0.1.3" }.
# Check liveness and current contract version
curl --fail-with-body -i "$OPENGEN_API_URL/health"
# Inspect the live OpenAPI 3.1.0 document (CDN-cached when unauthenticated)
curl --fail-with-body -I "$OPENGEN_API_URL/openapi.json"Backwards compatibility policy
Additive (non-breaking) changes
Clients and AI agents should tolerate the following additive updates within /v1:
- New exact model variants, new model series, new curated collections, and new regional deployments/routes in
@media-router/catalog. - Optional response properties, new optional request parameters, new
structuredError.codevalues, and new MCP tools or resources. - New dated pricing evidence entries or route status promotions from
documentedtolive-verified.
Fixed execution identities and aliases
- Exact variant IDs (
provider/model) and canonical route IDs (deployment/model-slug) are stable execution contracts. Distinct derivatives are never merged under a shared ID. - Where a legacy split or provider-prefixed route ID is unified, OpenGen preserves resolution through the catalog
routeAliasestable (binding operation constraints when needed so an alias cannot silently execute a conflicting operation).
Deprecation and Sunset headers (RFC 8594)
Active /v1 endpoints omit Deprecation and Sunset headers. When an endpoint, parameter, or API version is scheduled for retirement, OpenGen follows RFC 8594 / RFC 9745 signaling and preserves these headers through the web edge proxy and CORS Access-Control-Expose-Headers:
- **
Deprecation**: RFC 9745 structured date (@<unix-timestamp>) ortrueonce deprecation begins. - **
Sunset**: RFC 8594 HTTP-date announcing the scheduled removal date (minimum 30 days advance notice for non-security breaking removals). - **
Link**:Link: <https://opengen.dev/...>; rel="successor-version"pointing to the replacement endpoint or migration guide.
Recent /v1 surface consolidations
OpenGen recently consolidated its public surface around clean, minimal primitives:
- **Compact
GET /v1/models**: omits bulkygenerationProfilesby default (~25 KB); pass?expand=schemaswhen needed or callGET /v1/models/{provider}/{model}/GET /v1/models/schemafor single-model schemas. - Unified 4-route private assets:
POST /v1/assets(multipart, base64, URL import, owned output reuse, presigned PUT),POST /v1/assets/complete,GET /v1/assets(list or?key=), andDELETE /v1/assets(?key=or JSON{ "key": "..." }), replacing legacy split asset action paths. - Per-request Ed25519 webhooks: ad-hoc
webhookUrl+webhookEventsonPOST /v1/generationsverified viaGET /.well-known/webhook-jwks.json, replacing legacy workspace webhook subscription tables. - Stateless cost estimation: dry-run
POST /v1/pricing/estimatereplacing legacy stateful quote flows. - Unified documentation URLs: all guides, client setup pages, and API references live under
/docs/**(including/docs/guides/*and/docs/clients/*).
CDN caching, CORS, and rate-limit contracts
OpenGen enforces strict HTTP caching, CORS, and throttling invariants at the API edge:
| Surface | Cache-Control | Vary | CORS (Access-Control-Allow-Origin) |
|---|---|---|---|
Unauthenticated 200 OK GET/HEAD on /openapi.json, /v1/models*, /v1/collections*, /v1/routes, /v1/pricing | public, max-age=60, s-maxage=300 | Authorization, Cookie | * (never with Access-Control-Allow-Credentials: true; 204 OPTIONS preflight max-age=600) |
GET /.well-known/webhook-jwks.json | public, max-age=3600 | — | * (GET, HEAD, OPTIONS) |
GET /health | no-store | — | * (GET, HEAD, OPTIONS) |
Cookie-free POST /v1/pricing/estimate | public, max-age=0, s-maxage=60 (unauth) / private, no-store (auth) | — | * (POST, OPTIONS) |
/mcp and /mcp/readonly | no-store (JSON) / private, no-store, no-transform (SSE) | Authorization | * (POST, OPTIONS, never with credentials) |
Any request with Authorization header or og_session cookie, all private /v1/generations*, /v1/assets*, /v1/balance, /v1/analytics, and all error responses | no-store (or private, no-store on /media/* & status streams) | Authorization, Cookie where applicable | No wildcard CORS on private /v1/* or /auth/* routes |
- Rate-limit headers:
/v1/*REST responses include standard RFCRateLimitandRateLimit-Policyheaders, plusRetry-Afteron429responses (see Errors & Recovery). - Allowed & exposed CORS headers on public CORS routes:
Access-Control-Allow-Headers:Authorization, Content-Type, Accept, Idempotency-Key, Prefer, Mcp-Session-Id, Mcp-Protocol-Version, Last-Event-IDAccess-Control-Expose-Headers:Mcp-Session-Id, Mcp-Protocol-Version, X-Next-Cursor, Preference-Applied, WWW-Authenticate, Retry-After, RateLimit, RateLimit-Policy, Deprecation, Sunset, Link
Agentic Markdown discovery & llms.txt
Every public documentation, guide, client, provider, pricing, and model page on https://opengen.dev is natively machine-readable for AI coding agents and crawlers:
- **Explicit
.mdtwins &Accept: text/markdown**: Append.mdto any/docs/**,/docs/clients/**,/docs/guides/**,/providers,/pricing,/[provider],/[provider]/[series],/about, or/contactURL — or sendAccept: text/markdown(200 OK,Vary: Accept,Content-Type: text/markdown; charset=utf-8). Explicit.mdtwins emitLink: <canonical>; rel="canonical"andX-Robots-Tag: noindex, followso search engines consolidate ranking signals on canonical HTML pages while AI agents fetch Markdown freely. Unknown paths return404Markdown linking key entry points. - Discovery indices:
/llms.txt— concise gateway summary and top links./docs/llms.txt— complete index of all/docs/**.mdURLs./llms-full.txt— concatenated full Markdown documentation corpus./skill.md— installable agent skill instructions./sitemap.xml— unified XML sitemap withlastmodreview dates.
SDK & CLI policy
Standalone third-party SDK distribution and language-specific framework adapters are intentionally deferred. OpenGen prioritizes:
- Crisp, self-contained raw HTTP examples (
curl, standardfetch, Pythonhttpx) backed by OpenAPI3.1.0. - Streamable HTTP MCP (
/mcpand zero-auth/mcp/readonly). - The published, zero-dependency portable CLI
@opengen-dev/clion npm (Node.js 22.12+).