OpenGen (opengen.dev)

Шлюз API для генерации изображений, видео и аудио с поддержкой нескольких провайдеров по лицензии Apache-2.0 и MCP-сервер с поддержкой Streamable HTTP, охватывающий 33 серии моделей, 54 точных варианта и 184 региональных маршрута у 12 провайдеров.

Размещённый MCP-сервер

npx add-mcp 'https://opengen.dev/mcp'

Устанавливается в Claude Code, Codex, Cursor и другие

Документация

OpenGen

An independent, Apache-2.0 image and video API router. Compare exact model variants across regional deployments, inspect source-linked prices and use configured routes through HTTP, MCP, the CLI or the private browser workspace.

Open-source 0.1.3 source release. User prompts, media, receipts and labels remain workspace-private; there is no public generation gallery or share toggle. The core implements immutable inputs, original-job delivery recovery, trusted admission/budgets/capacity and private Activity/settings with fixture coverage. Source publication, live provider route verification and managed service activation are separate gates; dated provider/runtime observations do not establish full model/region/client coverage. See current status, release gates and hosted activation.

Start with the HTTP/MCP feature reference, owned input lifecycle and image-to-video guide. No new SDK is needed. SDK distribution/new language bindings/framework adapters are deferred; the existing source-workspace client receives compatibility maintenance only.

Run the catalog and public API

Requires Node.js 22.12+ and npm. No provider key, database, payment service or external authentication is needed to browse the catalog and inspect model schemas.

npm ci
npm run dev:api

In a second terminal:

npm run dev

Open the catalog or the docs hub (every public page — /, /docs/**, /[provider], /[provider]/[series], /about, and /contact — serves an explicit .md twin such as /docs/quickstart.md or /openai/gpt-image-2.md and honors Accept: text/markdown with Vary: Accept; every /docs/** page and every /[provider]/[series] model page includes an actionable ## Agent Prompt, and every /[provider]/[series] model page also includes single-source connect instructions linking back to /docs/**). The API is at http://127.0.0.1:4310; Streamable HTTP MCP is at /mcp and zero-auth /mcp/readonly. Install the published portable CLI from npm (@opengen-dev/cli) or run npm run cli -- <command> from a checkout.

Browse companies, ByteDance, Seedance 2.5, or MiniMax H3 (each series page also serves /{provider}/{series}.md, includes an above-the-fold Pricing at a Glance starting-rate comparison table sourced from @media-router/catalog, and links directly to its matching /docs/guides/<operation> guides; treat starting rates as catalog list rates and run POST /v1/pricing/estimate for exact request quotes). Series pages list every exact variant and its regional serving routes. H3 derivatives retain fal/Pika authorship while belonging to the MiniMax series. Try actions preserve the selected exact model and regional route.

npm run cli -- catalog search 'wan 3.0'
npm run cli -- catalog get alibaba/wan-3.0
npm run cli -- routes --model alibaba/wan-3.0
npm run cli -- pricing --model alibaba/wan-3.0

Generation requests put common and typed model-specific arguments in one input object. Model identity, operation, routing, billing and budgets stay on the outer request. Owned media use {"assetKey": "OWNED_INPUT_KEY"} in an explicit role such as input.firstFrame; external media use {"url": "https://media.example.com/source.png"}. Inspect the exact model/operation schema through GET /v1/models/schema or MCP get_model before submitting.

The API supports public model/collection/route discovery, published rate inspection, stateless cost estimation (POST /v1/pricing/estimate), and observed provider-attempt metrics with separate end-to-end job timing. Metrics remain unknown without installation observations. Unknown prices remain null. Regions and scope labels are provider documentation, not proof of residency or live account access.

GET /v1/models (filterable by q, modality, providerId, region, familyId, operation, inputRole, and collection) returns compact model summaries without embedded generationProfiles by default—pass ?expand=schemas to include full generationProfiles, or call GET /v1/models/{provider}/{model} / GET /v1/models/schema for single-model schemas, regional routes, privacy disclosures, and published pricing. Together with GET /v1/collections, GET /v1/collections/{slug}, GET /v1/routes, GET /v1/pricing, POST /v1/pricing/estimate, DELETE /v1/assets (?key=<assetKey> or JSON { key }), and GET /v1/analytics, these form the public 24-endpoint REST contract (legacy /v1/companies API routes are removed). Unauthenticated 200 OK GET/HEAD responses on public catalog routes and /openapi.json carry public CDN caching (Cache-Control: public, max-age=60, s-maxage=300) and CORS (Access-Control-Allow-Origin: *), while authenticated requests and private routes (GET /v1/analytics, /v1/balance, /v1/assets*, /v1/generations*, /health, /mcp*) remain no-store. /v1/* REST responses emit standard RFC RateLimit and RateLimit-Policy headers (forwarded through the web proxy, alongside Retry-After on 429). MCP find_models, get_model, estimate_cost, search_docs (backed directly by single-source @media-router/docs), and analytics (plus CLI catalog search / catalog get) share the same catalog, docs, and analytics contract.

Enable durable jobs

  1. Run npm run setup:local to create a private .env with random local database/gateway/vault/session secrets. It refuses to overwrite existing configuration and prints no values.
  2. Configure PostgreSQL and review the local settings; see the self-hosting runbook.
  3. Set MR_INITIAL_BALANCE_MICROS deliberately (1,000,000 micro-USD = $1); it only applies when a workspace is first created. It is operator-granted credit, not a payment integration.
  4. Configure credentials for the exact provider region you intend to use. Alibaba requires a matching region, workspace endpoint URL and API key. BytePlus uses its Singapore key.
  5. Start npm run dev:api and npm run worker. Schema initialization is idempotent.

The installation token is an operator bootstrap credential. The account layer adds workspace-scoped API keys, saved policies, encrypted provider connections, revocable browser sessions and optional OIDC sign-in. Configure the session/vault secrets privately. Team membership and operator reconciliation are implemented; production identity/authorization verification remains a release gate; keep the managed backend private until its deployment gates pass.

Generation is an explicit authenticated action. Send Authorization: Bearer <workspace-key> and Idempotency-Key: <stable-key> to POST /v1/generations. Use generate scope for admission and read scope for later retrieval. Store the returned job ID and poll GET /v1/generations/{id}. Reusing a key with a changed request returns a conflict. A submission of unknown acceptance keeps its reservation and requires reconciliation rather than a blind paid retry. See authentication and funding for operator bootstrap, scoped keys, browser/OAuth configuration and replay-safe operator credit.

The browser supports HttpOnly sessions; a self-hosted operator can bootstrap a session privately, while a configured OIDC provider supplies normal sign-in. The frontend proxy forwards the caller identity and never injects an operator token for anonymous visitors. Operator-funded provider secrets stay server-side. BYOK values are submitted privately to the API, encrypted at rest and never returned by connection-list APIs.

MCP

Connect a Streamable HTTP client to http://127.0.0.1:4310/mcp (full read+write, OAuth/Bearer gated) or http://127.0.0.1:4310/mcp/readonly (read-only; public discovery tools work with zero authentication, RFC 9728 metadata is served at /.well-known/oauth-protected-resource/mcp/readonly, and private workspace reads require a Bearer token or OAuth grant). Both endpoints support CORS (Access-Control-Allow-Origin: *) and default curl/fetch Accept headers (*/*, application/json, or omitted) without 406 Not Acceptable.

Tools on /mcp (15): find_models, get_model, estimate_cost, search_docs, balance, analytics, job_get, jobs_list, assets_list (the 9 tools exposed on /mcp/readonly), plus generate, job_cancel, purge_job_outputs, upload_asset, upload_attachment, and delete_asset. Published route pricing is also exposed via the opengen://pricing MCP resource (and per-model schema/routes/pricing via opengen://models/{provider}/{model}). generate requires a stable idempotencyKey. No generic call escape hatch or arbitrary upstream URL proxy is exposed. Developer docs live single-source in packages/docs/content/ (docs/ + guides/), compiling to /docs/** (hub, concept/reference pages such as /docs/quickstart, /docs/mcp, /docs/webhooks, /docs/api, agent client guides at /docs/clients and /docs/clients/<slug>, and guides for all 10 catalog operations at /docs/guides/<operation> — including /docs/guides/image-to-video — with live @media-router/catalog Supported Models links and top-of-page ## Agent Prompt), site-wide .md twins, Accept: text/markdown (Vary: Accept), /llms.txt, /docs/llms.txt, /llms-full.txt, /skill.md, /about, and /contact. Inspect /openapi.json on the gateway for the public 24-endpoint REST schema, or install the published portable CLI from npmjs.com/@opengen-dev/cli. See webhooks and alerts for per-request Ed25519-signed events (/.well-known/webhook-jwks.json) and output/provenance for private archival and optional C2PA verification boundaries.

SDK and examples

The TypeScript SDK is a private source-workspace package, not an npm publication. It reuses the native generation and job contracts and never automatically retries a paid submission. Executable examples cover REST discovery, MCP discovery and private-receipt generation/recovery. Legacy OpenAI-style compatibility routes have been removed in favor of the canonical POST /v1/generations API (see docs/COMPATIBILITY.md).

Regional catalog

Company, regional deployment and exact model route have separate identities. Wan 3.0 Standard and Prime have six documented Alibaba regions each. Price, capability, credential requirements and observations belong to each route; an endpoint in Frankfurt with Global scope does not imply EU-only inference.

Model metadata includes Seedance 2.5; Seedance 2.0 Standard/Fast/Mini; Kling 4.0; Wan 3.0 Standard/Prime; official and third-party H3 variants; Gemini Omni Flash; Grok Imagine Video; GPT Image 2.5 Sunburst/Flare; GPT Image 2; Nano Banana 2.1; Grok Imagine Image 2; Seedream 5 Pro; and Qwen Image 2.1/3.0 offerings. Exact source and license evidence lives in the catalog. Most non-Alibaba regional audits remain pending.

Verification

npm run typecheck
npm run catalog:check
node scripts/build-docs.mjs --check
node scripts/build-onboarding.mjs --check
npm test
npm run build
node packages/engine/scripts/test-pglite.mjs

SQL integration tests run against TEST_DATABASE_URL when set. The PGlite script runs real PostgreSQL SQL in a local WASM/socket process using injected no-network provider fixtures, then shuts it down. It does not prove native multi-connection PostgreSQL concurrency. CI runs the same invariants against a native PostgreSQL service.

Browser tests live in apps/web/e2e; start the API and web services, then run npx playwright test --config apps/web/playwright.config.ts. They do not trigger paid generation.

Self-hosting and contributions

deploy/compose.yaml provides PostgreSQL, API, worker and web with loopback-only ports and separate secret boundaries. Run npm run setup:local, then docker compose --env-file .env -f deploy/compose.yaml up --build --detach --wait. Follow operations for private backups, restore, upgrades and credential handling. Container and native-PostgreSQL CI must pass on the exact release commit before claiming those procedures are verified.

Keep facts and executable support separate. An added manifest is not a live integration. New adapters need request/response fixtures, regional credential tests and idempotency/unknown-outcome coverage. Publish neither invented metrics nor customer prompts. Read AGENTS.md and CONTRIBUTING.md before contributing. Follow SECURITY.md for private reports and the release checklist before publication.

The visual language is inspired by treg. This repository uses original code, catalog records and branding; it does not include treg source or assets.

License

Apache-2.0. Model weights and provider services retain their own licenses and terms.