# OPG AI-readable context Website: https://opg.ceo/ Human docs: https://opg.ceo/docs/ Chinese Markdown docs: https://opg.ceo/docs.md English Markdown docs: https://opg.ceo/en/docs.md Repository: https://github.com/Jamailar/OPG_system Contact: contact@opg.ceo ## Public page inventory - Home: https://opg.ceo/ - Features: https://opg.ceo/features/ - Pricing: https://opg.ceo/pricing/ - Changelog: https://opg.ceo/changelog/ - Docs: https://opg.ceo/docs/ - Guides: https://opg.ceo/guides/ - Blog: https://opg.ceo/blog/ - Discussions: https://opg.ceo/community/ - Contributing: https://opg.ceo/contributing/ - About: https://opg.ceo/about/ - Contact: https://opg.ceo/contact/ - Terms: https://opg.ceo/terms/ - Privacy: https://opg.ceo/privacy/ ## Product summary OPG (One Person Group) is an open-source backend foundation for independent developers building multiple AI applications. It provides reusable backend and control-plane capabilities: app management, users and permissions, platform admin, tasks, uploads, database workspace, AI gateway, video jobs, usage logs, payments, messaging providers, runtime settings, audit, and observability. ## Public crawling policy Public website and docs content may be crawled by AI agents, search crawlers, documentation indexers, and developer assistants. The public docs are available as static HTML and Markdown. The site does not use user-agent-specific bot blocking, login walls, JavaScript-only docs, or anti-crawler challenges for public docs. ## Architecture overview - App runtime uses app-scoped APIs under `/:app/v1`. - SDK and CLI discover capabilities through `/sdk/manifest`. - Developer Grant authorizes SDK, database, AI, uploads, video, and MCP for one app. - Platform token authorizes global control-plane operations such as app creation, provider configuration, analytics, payments, and runtime settings. - Frontends and user projects do not receive provider secrets. - Database access is mediated by the backend proxy and constrained to the app namespace. - AI and video work should be asynchronous when long-running or cost-bearing. - Audit events, usage ledger, provider health, and request events are operational truth. ## Quickstart ```sh npm install opg-sdk npm install -g @jamba/opg-cli@latest --registry=https://registry.npmjs.org/ opg init --base-url https://your-opg.example.com opg login opg app list opg app create --name "Demo App" --slug demo opg login --app demo opg smoke opg db smoke opg codex install ``` ## Configuration - `OPG_BASE_URL`: Gateway base URL. - `OPG_APP_SLUG`: current app slug. - `OPG_API_KEY`: optional app Developer Grant. - `OPG_PLATFORM_TOKEN`: platform admin JWT. - `.opg/opg.config.json`: local base URL, app, and profile. - `.opg/credentials.json`: local credentials generated by login commands. - `.env.local`: local fallback. ## SDK usage ```ts import { createOpgClientFromLocalConfig, createOpgPlatformClient, } from "opg-sdk"; const opg = await createOpgClientFromLocalConfig(); const manifest = await opg.sdk.manifest(); const models = await opg.ai.models(); const usage = await opg.usage.aiLogs({ limit: 20 }); const platform = createOpgPlatformClient({ baseUrl: process.env.OPG_BASE_URL!, platformToken: process.env.OPG_PLATFORM_TOKEN!, }); ``` ## Capabilities - AI Gateway: `opg.ai.models()`, `opg.ai.chat()`, `opg.ai.responses()`, `opg.ai.embeddings()`, `opg.ai.image()`, `opg.ai.speech()`. - Agent: `opg.agents.list()`, `opg.agents.meta(slug)`, `opg.agents.run(slug, input)`, `opg.agents.stream(...)`. - Uploads: `opg.upload.presignedUrl()`, `imageBuffer()`, `fileBuffer()`. - Video: `opg.video.generateAsync()`, `queryTask()`, `wait(taskId)`. - Usage: `opg.usage.aiLogs()`. - SDK contract: `opg.sdk.manifest()`, `openapi()`, `examples()`, `smokeTest()`. - Database: `opg.database.manifest()`, `query()`, `execute()`. - Platform: `platform.apps`, `platform.runtimeSettings`, storage, SMTP, SMS, OAuth, payment, proxy, AI source/model, feedbacks, analytics, aiUsage, payments, email, site, redeem, admins. ## Backend contract - `GET /:app/v1/sdk/manifest` - `GET /:app/v1/sdk/openapi.json` - `GET /:app/v1/sdk/examples?target=node|react|codex` - `POST /:app/v1/sdk/smoke-test` - `POST /:app/v1/sdk/install-profile` - `POST /:app/v1/sdk/auth/sessions` - `POST /:app/v1/sdk/auth/token` - `GET /:app/v1/sdk/database/manifest` - `GET /:app/v1/sdk/database/tables` - `POST /:app/v1/sdk/database/query` - `POST /:app/v1/sdk/database/execute` ## Security and performance notes - Use existing libraries for AI provider SDKs, video provider APIs, object storage clients, SQL parsing/validation, queue workers, OpenAPI generation, and MCP protocol handling. - Self-build the OPG-specific control-plane contracts, app namespace enforcement, manifest shape, Developer Grant boundary, provider routing, usage ledger, and audit semantics. - Queue long-running or cost-bearing work, especially video generation, agent runs, webhooks, message delivery, and bulk sync. - Use presigned URLs for large uploads. - Short-cache public manifests and static docs, but do not public-cache secrets, credentials, or audit results. - Keep docs available as static HTML, Markdown, and plain text so crawlers do not need JavaScript.