# OpenGen Documentation > Single-source developer and AI-agent documentation for OpenGen. Every page below is available in raw Markdown (`.md`) and via `Accept: text/markdown` content negotiation with an actionable `## Agent Prompt`. - [Docs Hub](https://opengen.dev/docs.md): Entry point for quickstart, core concepts, operation guides, and API reference. - [Full Documentation Bundle](https://opengen.dev/llms-full.txt): Concatenated Markdown corpus of all documentation and operation guides. - [Interactive API Reference](https://opengen.dev/docs/api.md): 24 public REST endpoints across 6 tags, backed by `https://opengen.dev/openapi.json`. - [Agent & MCP Client Setup](https://opengen.dev/docs/clients.md): Setup guides and live verification boundaries for hosted and local MCP/CLI clients. ## Getting Started - [Quickstart](https://opengen.dev/docs/quickstart.md): OpenGen routes image, video, and audio generations across 12 serving providers through one canonical JSON contract. Check gateway liveness, inspect an exact model variant and its published pricing, run a stateless dry-run cost estimate, verify your workspace balance, and submit once with a persisted Idempotency-Key to receive private signed media delivery. - [Authentication & Scopes](https://opengen.dev/docs/authentication.md): OpenGen authenticates REST and MCP requests using workspace-scoped API keys (og_sk_), OAuth 2.1 Dynamic Client Registration with S256 PKCE tokens (og_mcp_a_), or HttpOnly browser sessions. Provider API keys are never OpenGen client credentials; BYOK supplier keys are stored encrypted separately per deployment. - [MCP Server & Tools](https://opengen.dev/docs/mcp.md): OpenGen serves two stateless Streamable HTTP MCP endpoints. The /mcp endpoint exposes all 15 read and write tools behind OAuth 2.1 or API key auth, while /mcp/readonly exposes 9 read-only tools including 4 zero-auth public discovery tools (find_models, get_model, estimate_cost, search_docs). Both publish RFC 9728 metadata, CORS headers, and standard Accept compatibility. ## Core Concepts - [Models & Catalog](https://opengen.dev/docs/models-and-catalog.md): OpenGen catalogs 54 exact image, video, and audio model variants across 33 series, 12 serving providers, and 184 regional routes. Every variant retains its exact execution identity without merging derivatives by name. Discover models via compact GET /v1/models summaries, curated collections, or single-call GET /v1/models/{provider}/{model} detail responses. - [Regional Routing & Privacy](https://opengen.dev/docs/regional-routing.md): OpenGen keeps endpoint region, inference scope, processing regions, and storage residency strictly distinct. Every catalog route attaches a PublicPrivacyDisclosure where unestablished residency, logs, retention, and Zero Data Retention facts stay null. All user prompts, inputs, and outputs remain workspace-private with no public gallery and on-demand output purging. - [Generations Lifecycle](https://opengen.dev/docs/generations.md): OpenGen processes every media generation as a durable, workspace-private job across eight REST endpoints. Submit once with a persisted Idempotency-Key and optional Prefer wait up to 25 seconds, follow updates via Server-Sent Events or compact status long-polling, recover lost responses via read-only lookup, cancel explicitly, and purge terminal outputs on demand. - [Private Assets](https://opengen.dev/docs/assets.md): OpenGen manages private workspace input media through four REST endpoints (POST /v1/assets, POST /v1/assets/complete, GET /v1/assets, DELETE /v1/assets) and four MCP tools. Choose direct multipart (<= 4 MiB), JSON base64 (<= 3 MiB), MCP inline base64 (<= 64 KiB), or presigned single-PUT and public HTTPS import (<= 100 MiB) to obtain reusable assetKey handles. - [Webhooks & Ed25519 Verification](https://opengen.dev/docs/webhooks.md): OpenGen sends per-request generation lifecycle webhooks to public HTTPS destinations supplied via webhookUrl and webhookEvents on POST /v1/generations or MCP generate. Every delivery is signed with Ed25519 keys published at GET /.well-known/webhook-jwks.json using five X-OpenGen-Webhook-* headers over the raw UTF-8 body, with replay protection and up to eight retry attempts. - [Pricing & Analytics](https://opengen.dev/docs/pricing-and-analytics.md): OpenGen expresses all prices and balances in positive integer micro-USD (1 USD equals 1,000,000 micro-USD) sourced strictly from @media-router/catalog, with unknown prices kept null and never zero. Inspect published rates at GET /v1/pricing, run side-effect-free estimates at POST /v1/pricing/estimate, check credit at GET /v1/balance, and query 31-day spend and latency rollups at GET /v1/analytics. ## Guides - [Generate images from text prompts](https://opengen.dev/docs/guides/text-to-image.md): OpenGen routes text-to-image prompts across 25 exact model variants through one canonical request schema. Discover models with GET /v1/models?operation=text-to-image, inspect exact pricing and resolution tiers via GET /v1/models/{provider}/{model}, verify spend with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key. All generated outputs stay private to your workspace and download through short-lived first-party capability URLs. - [Edit images with private references and masks](https://opengen.dev/docs/guides/image-edit.md): OpenGen image editing pairs workspace-private uploaded assets with one canonical input schema across 25 image models. Upload your source image via POST /v1/assets to receive a ready assetKey, pass it inside input.references (plus optional input.mask on models such as GPT Image 2), check pricing with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key so retries never double-bill. - [Upscale images with megapixel-aware controls](https://opengen.dev/docs/guides/image-upscale.md): OpenGen models image upscaling as a dedicated image-upscale operation with scale-factor controls and megapixel-aware pricing inspection. Upload one workspace-private source image through POST /v1/assets, inspect exact schema limits for clarity/clarity-upscaler via GET /v1/models/clarity/clarity-upscaler?operation=image-upscale, check route readiness and pricing with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key when an executable route is configured. - [Remove image backgrounds into transparent cutouts](https://opengen.dev/docs/guides/background-remove.md): OpenGen exposes foreground segmentation and alpha cutout extraction under the dedicated background-remove operation. Upload a private source image via POST /v1/assets, inspect exact constraints for bria/remove-background (alpha-capable PNG or WebP output only, with no prompt field), verify route availability and published per-image rates via POST /v1/pricing/estimate, and submit with a persisted Idempotency-Key once an executable route is configured. - [Generate video from text prompts](https://opengen.dev/docs/guides/text-to-video.md): OpenGen routes text-to-video prompts across 25 exact video model variants using one canonical schema for resolution, duration, aspect ratio, and native audio. Inspect regional endpoints and published per-second or token pricing via GET /v1/models/{provider}/{model}, verify spend with POST /v1/pricing/estimate, submit once with a persisted Idempotency-Key, and stream or poll private delivery progress without risking duplicate charges. - [Animate an owned image into video](https://opengen.dev/docs/guides/image-to-video.md): OpenGen image-to-video animates workspace-private start and optional end frames across 25 video models without publishing your source media. Upload your image through POST /v1/assets until state is ready, place its assetKey in input.firstFrame, run POST /v1/pricing/estimate to verify route capabilities and cost, submit once with a persisted Idempotency-Key, and resume or recover read-only until private video delivery is available. - [Keep subjects consistent with reference-to-video](https://opengen.dev/docs/guides/reference-to-video.md): OpenGen reference-to-video preserves characters, products, and style across 20 video models using typed input.references entries and structured Kling elements. Upload private reference media via POST /v1/assets, inspect per-type reference limits via GET /v1/models/{provider}/{model}?operation=reference-to-video, confirm pricing with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key without mixing incompatible frame modes. - [Edit videos with source clips and references](https://opengen.dev/docs/guides/video-edit.md): OpenGen video-edit modifies an existing workspace-private clip via input.sourceVideo (uploaded up to 100 MiB or reused from an owned prior job output) or top-level previousJobId. Inspect each model's exact override restrictions with GET /v1/models/{provider}/{model}?operation=video-edit because models like FLUX 3 Video preserve source duration and dimensions, estimate cost with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key. - [Extend video clips and continue owned jobs](https://opengen.dev/docs/guides/video-extend.md): OpenGen video-extend continues an existing clip across six video models using either an uploaded or reused input.sourceVideo asset or a stateful top-level previousJobId continuation pinned to the original model and deployment. Inspect route-specific duration caps via GET /v1/models/{provider}/{model}?operation=video-extend, verify spend with POST /v1/pricing/estimate, and submit once with a persisted Idempotency-Key while keeping all outputs workspace-private. - [Synthesize speech from text prompts](https://opengen.dev/docs/guides/text-to-speech.md): OpenGen models speech synthesis under the text-to-speech operation with typed voice, speed, audio outputFormat, and optional style systemPrompt controls. Inspect exact character limits and published character or token pricing for minimax/speech-02-hd and openai/gpt-4o-mini-tts via GET /v1/models/{provider}/{model}?operation=text-to-speech, run POST /v1/pricing/estimate to verify route eligibility, and submit once with a persisted Idempotency-Key when an executable route is configured. - [Verify OpenGen webhooks in Next.js App Router](https://opengen.dev/docs/guides/webhooks-nextjs.md): OpenGen delivers per-request generation lifecycle webhooks signed with Ed25519 keys published at GET /.well-known/webhook-jwks.json. Read the exact raw UTF-8 request body in a Next.js App Router Route Handler, validate all five X-OpenGen-Webhook headers and a 300-second replay window, verify the 128-character hex Ed25519 signature via node crypto, deduplicate by envelope id, and fetch private outputs separately via GET /v1/generations/{jobId}. - [Self-host OpenGen on Docker or Cloud Run and Vercel](https://opengen.dev/docs/guides/self-hosting.md): OpenGen is Apache-2.0 open source and self-hosts with three Node.js 22 processes (web, api, and worker), PostgreSQL 17 with automatic transactional migrations, and private S3 or R2 object storage—with no Redis or Kubernetes required. Configure AES-256-GCM provider vault encryption, OIDC, GitHub OAuth, or Email OTP sign-in, Ed25519 webhook signing keys, and optional Cloud Run plus keyless Vercel Workload Identity Federation deployment. ## Reference - [Errors & Recovery](https://opengen.dev/docs/errors.md): OpenGen returns structured JSON error envelopes with Cache-Control no-store on every non-2xx response, exposes RateLimit, RateLimit-Policy, and Retry-After headers for backpressure, and attaches typed structuredError objects to jobs. On network timeouts or submission-unknown states, recover read-only via GET /v1/generations/lookup or MCP job_get without blind paid retries. - [Versioning & HTTP Contracts](https://opengen.dev/docs/versioning.md): OpenGen versions its public REST API under /v1 with an OpenAPI 3.1.0 schema at GET /openapi.json covering 24 endpoints across 6 tags and gateway liveness at GET /health. Unauthenticated catalog reads carry public CDN caching and wildcard CORS, while all authenticated, private, MCP, and error responses enforce Cache-Control no-store. - [Frequently Asked Questions](https://opengen.dev/docs/faq.md): Concise technical answers to the most common questions about OpenGen's privacy guarantees, idempotent timeout recovery, micro-USD billing and null settlement states, managed credit versus BYOK, endpoint regions versus data residency, Ed25519 webhook verification, zero-auth read-only MCP discovery, and how OpenGen compares to fal.ai and Replicate. ## Interactive API Reference - [Public Developer API Reference (Markdown)](https://opengen.dev/docs/api.md): All 24 OpenAPI 3.1 endpoints across 6 tags with auth, idempotency, caching, and rate-limit rules. - [Interactive API Explorer (HTML)](https://opengen.dev/docs/api) - [OpenAPI 3.1 JSON Specification](https://opengen.dev/openapi.json) ## Agent Clients & Setup Evidence - [All Agent Clients & Verification Matrix](https://opengen.dev/docs/clients.md): Setup steps, OAuth/CLI commands, and dated live verification evidence across 12 clients. - [ChatGPT](https://opengen.dev/docs/clients/chatgpt.md): Add a custom MCP plugin and authorize a paying workspace in your browser. - [Claude](https://opengen.dev/docs/clients/claude.md): Use a remote connector, with no local installer or provider credentials. - [Claude Code](https://opengen.dev/docs/clients/claude-code.md): Register an HTTP MCP server, then use the client’s browser authorization. - [Cursor](https://opengen.dev/docs/clients/cursor.md): Preview a URL-only MCP configuration and authorize through Cursor. - [Codex](https://opengen.dev/docs/clients/codex.md): Add a Streamable HTTP server and use OAuth login with read/generate scopes. - [Muse](https://opengen.dev/docs/clients/muse.md): Add a Streamable HTTP MCP server in Muse Code with native OAuth. - [OpenClaw](https://opengen.dev/docs/clients/openclaw.md): Use the client’s MCP settings and browser authorization; verify the connection separately. - [Hermes Agent](https://opengen.dev/docs/clients/hermes.md): Register the remote OAuth MCP server with the Hermes CLI or config.yaml. - [OpenCode](https://opengen.dev/docs/clients/opencode.md): Configure a remote MCP server and complete the client’s OAuth flow. - [pi](https://opengen.dev/docs/clients/pi.md): Use the portable OpenGen CLI; native MCP is not assumed. - [Grok Bot](https://opengen.dev/docs/clients/grok-bot.md): Add OpenGen as a custom Remote HTTPS MCP connector in Grok Bot or Grok CLI. - [CLI & API](https://opengen.dev/docs/clients/cli.md): Use the portable CLI with browser login, or create one scoped workspace API key. ## Full Corpus & Discovery - [Documentation Hub (Markdown)](https://opengen.dev/docs.md) - [Full Documentation Corpus (llms-full.txt)](https://opengen.dev/llms-full.txt) - [Site AI Index (llms.txt)](https://opengen.dev/llms.txt) - [Installable Agent Skill (skill.md)](https://opengen.dev/skill.md) - [About OpenGen](https://opengen.dev/about.md) - [Contact OpenGen](https://opengen.dev/contact.md)