# Dispike — full documentation dump # Generated 2026-11-21T23:35:20.187Z # Source: https://dispike.com/docs --- # Inference API URL: https://dispike.com/docs/en/api-reference/inference Description: OpenAI-compatible chat, completions, and embeddings endpoints served by the Dispike inference gateway. The inference gateway lives at `https://tokenhub.dispike.com/v1` and speaks the OpenAI REST contract. Any OpenAI SDK works. ## Authentication All requests require a bearer token from `/dashboard/keys`: ``` Authorization: Bearer sk-... ``` Keys are revocable from the dashboard or via the [Keys API](/docs/en/api-reference/keys). Rotating a key takes effect within ~5s globally. ## POST /v1/chat/completions Standard OpenAI chat-completions shape. ```bash curl https://tokenhub.dispike.com/v1/chat/completions \ -H "Authorization: Bearer $DISPIKE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-pro-260425", "max_tokens": 1024, "messages": [ {"role": "system", "content": "You are concise."}, {"role": "user", "content": "Explain AI token routing in two sentences."} ], "stream": false }' ``` Response: ```json { "id": "chatcmpl-...", "object": "chat.completion", "created": 1747353600, "model": "deepseek-v4-pro-260425", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "..." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 32, "completion_tokens": 64, "total_tokens": 96 } } ``` ## POST /v1/completions Legacy completions endpoint. Supported for OpenAI parity but new code should use chat/completions. ## POST /v1/embeddings ```bash curl https://tokenhub.dispike.com/v1/embeddings \ -H "Authorization: Bearer $DISPIKE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "text-embedding-3-small", "input": "hello world" }' ``` ## GET /v1/models Returns the models allowed by the requesting key's plan whitelist — not the global catalog. Use this to populate UI model pickers without leaking plans the user can't access. ## Streaming Set `"stream": true` for SSE-style streaming. The wire format matches OpenAI exactly: ``` data: {"choices":[{"delta":{"content":"He"}}]} data: {"choices":[{"delta":{"content":"llo"}}]} data: [DONE] ``` ## Error codes | Status | Meaning | |---|---| | `401` | Invalid or revoked key | | `403` | Model not in your plan's whitelist | | `402` | Budget cap exceeded (per-request or monthly) | | `429` | Rate limit hit; retry with exponential backoff | | `5xx` | Upstream provider or gateway issue; safe to retry idempotent calls | All error bodies follow the OpenAI shape: ```json { "error": { "message": "...", "type": "...", "code": "..." } } ``` --- # Auth API URL: https://dispike.com/docs/en/api-reference/auth Description: Session, registration, password, and identity endpoints exposed by the Dispike web app. These endpoints live at `https://dispike.com/api/auth/*` and are consumed by the website's own forms plus any sub-product needing to know "who is logged in." All set or read the Dispike session cookie. ## POST /api/auth/register ```http POST /api/auth/register Content-Type: application/json { "email": "...", "password": "...", "name": "..." } ``` Creates a GoTrue user, sends a confirmation email, returns `{ ok: true }`. The session is not established until the email is confirmed and the user logs in. ## POST /api/auth/login ```http POST /api/auth/login Content-Type: application/json { "email": "...", "password": "..." } ``` Sets the session cookie. Returns `{ user: { id, email, name, plan } }`. ## POST /api/auth/signout Clears the session cookie. Returns `{ ok: true }`. ## GET /api/auth/me Returns the current user (or `401` if unauthenticated). Used by sub-products to confirm identity. ```json { "user": { "id": "uuid", "email": "you@example.com", "name": "...", "plan": "pro" } } ``` ## POST /api/auth/forgot-password ```http POST /api/auth/forgot-password Content-Type: application/json { "email": "..." } ``` Sends a reset email. Always returns `{ ok: true }` — we never disclose whether an address exists. ## CORS Every `/api/auth/*` endpoint accepts requests from first-party Dispike origins (regex match) and dev origins listed in `XCT_CORS_EXTRA_ORIGINS`. Pre-flight (`OPTIONS`) responses are cached for 24h. See [Concepts: Authentication flow](/docs/en/concepts/auth-flow) for the full sub-product story. --- # Billing API URL: https://dispike.com/docs/en/api-reference/billing Description: Plan, checkout, portal, and invoice endpoints backed by Stripe. ## GET /api/billing/plan Returns the active plan for the current user. ```json { "plan": { "id": "pro", "name": "Dispike Pro", "renews_at": "2026-06-01T00:00:00Z", "entitlements": ["full-catalog", "priority-routing"] } } ``` Used by sub-products to render gating and entitlements without each app holding Stripe credentials. ## POST /api/billing/checkout ```http POST /api/billing/checkout Content-Type: application/json { "price_id": "price_..." } ``` Returns `{ url: "..." }` — a one-time Stripe Checkout session URL. Redirect the user there. On success they return to `/dashboard/billing?success=1`. ## GET /api/billing/portal Returns `{ url: "..." }` — a one-time Stripe Customer Portal URL where the user manages payment methods, switches plans, and downloads invoices. ## GET /api/billing/invoices Returns the user's invoice history. ```json { "invoices": [ { "id": "in_...", "amount": 2900, "currency": "usd", "status": "paid", "created": 1747000000, "pdf_url": "..." } ] } ``` ## POST /api/billing/webhook **Stripe → Dispike web app only.** Not for client use. Receives: - `checkout.session.completed` - `customer.subscription.created` - `customer.subscription.updated` - `customer.subscription.deleted` - `invoice.payment_failed` Updates `app_metadata.plan` on the GoTrue user. Signature verification is mandatory — see [Operations: Stripe webhooks](/docs/en/operations/stripe-webhooks). --- # Keys API URL: https://dispike.com/docs/en/api-reference/keys Description: Provision, list, and revoke inference API keys programmatically. The Keys API at `/api/keys` lets you provision and revoke inference keys without going through the dashboard. Useful for B2B partners minting per-tenant keys. ## GET /api/keys List the keys owned by the current account. ```json { "keys": [ { "id": "k_...", "label": "prod", "last_used": "2026-05-14T18:21:00Z", "created": "..." } ] } ``` We never return the secret value after creation — only the prefix and metadata. ## POST /api/keys ```http POST /api/keys Content-Type: application/json { "label": "prod" } ``` Returns the key **once**: ```json { "key": { "id": "k_...", "label": "prod", "value": "sk-..." } } ``` The `value` is shown a single time. Store it; we cannot recover it. ## DELETE /api/keys/:id Revokes the key. New requests are rejected within ~5 seconds globally. ```json { "ok": true } ``` ## Quotas - Free plan: 1 key - Pro: 5 keys - Team: 20 keys (shared across seats) - Enterprise: unlimited --- # Architecture Overview URL: https://dispike.com/docs/en/concepts/architecture Description: How routing, tenancy, identity, billing, and the application layer fit together in Dispike. Dispike is organized in three layers — **foundation models**, the **routing & tenancy hub**, and the **application layer** — held together by three shared planes: **identity**, **billing**, and **inference**. ``` ┌──────────────────────────────────────────────────────────────┐ │ Application layer │ │ Studio · Drama · healthcare & vertical-industry agents · │ │ Skills · MCP Gateway · Dispike Claw · Agent Desktop · Chat │ └──────────────┬───────────────────────────────────────────────┘ │ one session, one key envelope ┌──────────────▼───────────────────────────────────────────────┐ │ Dispike web app (Astro BFF, dispike.com) │ │ ├── /api/auth/* identity BFF │ │ ├── /api/billing/* Stripe BFF │ │ └── /api/me/* plan / key resolver │ └──────┬───────────────┬────────────────────┬──────────────────┘ ▼ ▼ ▼ Dispike auth Stripe AI token router service (GoTrue) (billing) (tokenhub.dispike.com/v1) │ fallback · budgets · virtual keys ▼ Foundation models (many providers) ``` ## Foundation models Dispike does not lock you into one model vendor. The router sits in front of multiple upstream providers plus self-hosted models, and exposes them through one OpenAI-compatible contract. Browse what's available at [/models](/models). ## Routing & tenancy hub ### Inference plane — AI token intelligent routing `https://tokenhub.dispike.com/v1` runs LiteLLM-based routing in front of every upstream. Each request is matched to a model the key is allowed to use, with automatic fallback when a provider degrades. Every API key is bound to a Dispike account, a plan whitelist, and a budget cap. Requests are logged to the usage ledger that drives `/dashboard/usage` and overage billing. ### Multi-tenant architecture Each tenant — a team, a customer of yours, or an individual end-user — gets its own keys, budgets, and usage ledger. Keys can be minted per tenant through the [Keys API](/docs/en/api-reference/keys); revoking one never affects another tenant. Application-layer products such as [Dispike Claw](/docs/en/products/claw) reuse the same isolation: every call is partitioned by user id. ### Identity plane Authentication is centralized on the Dispike auth service (a self-hosted GoTrue instance with Supabase as a dev fallback). The Dispike web app issues a host-only, `SameSite=Lax` session cookie. Every browser sub-product on a first-party Dispike subdomain inherits that session by calling the web app's BFF endpoints with `credentials: 'include'`. See [Authentication flow](/docs/en/concepts/auth-flow) and [Sub-product Integration](/docs/en/guides/sub-product-integration). ### Billing plane Stripe is the source of truth for plans, subscriptions, and invoices. The Dispike web app holds the only set of Stripe credentials; sub-products never call Stripe directly. Plan and entitlement state is mirrored onto each user's GoTrue `app_metadata` via Stripe webhooks landing at `/api/billing/webhook`. See [Plans, keys, and budgets](/docs/en/concepts/plans) and [Operations: Stripe webhooks](/docs/en/operations/stripe-webhooks). ## Application layer Everything above the router consumes the same identity, key envelope, and budget: | Product | What it is | Where | |---|---|---| | **Studio** | Audiovisual generation — images, video, voice | [/studio](/studio) | | **Drama** | AI short-drama production | [/drama](/drama) | | **Agents** | Healthcare and vertical-industry agents | [/agents](/agents) | | **Skills** | Reusable capabilities agents can call | [/skills](/skills) | | **MCP Gateway** | One endpoint for Model Context Protocol tools | [/mcp-gateway](/mcp-gateway) | | **Dispike Claw** | Your own hosted agent runtime bound to IM channels | [Docs](/docs/en/products/claw) | ## Sub-products Any first-party browser app integrates via three BFF endpoints and never holds its own Stripe or auth credentials: | Endpoint | Returns | |---|---| | `GET /api/auth/me` | Current user | | `GET /api/me/litellm-key` | Bearer + plan + allowed models | | `GET /api/billing/plan` | Plan id, entitlements, renewal | CORS is enforced via a regex allowlist over first-party origins plus localhost for development; see `src/lib/cors.ts`. ## Where data lives | Domain | Store | Notes | |---|---|---| | User identity | GoTrue Postgres | Primary region + encrypted DR mirror | | Subscriptions | Stripe | Stripe-managed (US) | | API usage | LiteLLM Postgres | Primary region | | Audit logs | Object storage | Primary region + DR | Enterprise contracts can pin a region or require a dedicated deployment — see [Enterprise: Data Residency](/docs/en/enterprise/data-residency). --- # Plans, keys, and budgets URL: https://dispike.com/docs/en/concepts/plans Description: How accounts map to plans, how keys are scoped, and how usage is metered. ## Plans Dispike ships three default plans plus a custom Enterprise tier: | Plan | Monthly | Includes | Cap | |---|---|---|---| | Free | $0 | basic model access, dashboard | hard cap, no overage | | Pro | $29 | full model catalog, priority routing | soft cap + overage | | Max | $99 | seats, shared budgets, audit log | soft cap + overage | | Enterprise | custom | SSO, custom SLA, regional pinning, DPA | negotiated | Stripe is the system of record for plan state. The Dispike web app reads it through `src/lib/billing.ts` and mirrors the active plan onto each user's GoTrue `app_metadata.plan` field via the `/api/billing/webhook` handler. ## Keys A key (`sk-…`) is bound to: 1. A **Dispike account** — invalidating the account invalidates all its keys. 2. A **plan whitelist** — only models allowed by the account's current plan can be invoked. Routes to disallowed models return `403`. 3. A **budget envelope** — per-request budget enforced at LiteLLM admission, plus cumulative monthly cap. Keys are minted via the dashboard or — for B2B integrations — through the [Keys API](/docs/en/api-reference/keys). They can be revoked at any time without affecting the user's other keys. ## Budgets Two budget signals matter: - **Per-request cost ceiling.** LiteLLM rejects a request whose estimated cost exceeds the per-request ceiling for the plan. This prevents accidental large prompts from draining a month's budget in one call. - **Cumulative monthly cost.** The usage ledger sums to a per-account total. Free plans hard-block at the cap; paid plans switch to overage at the published rate. You can inspect both via `GET /api/me/litellm-key` (returns the active envelope) and `GET /dashboard/usage` (visualizes the spend). ## Plan changes Upgrade and downgrade flow through Stripe Customer Portal. We listen for `customer.subscription.updated` and reflect the new entitlements within seconds (typically <2s end-to-end). Downgrades take effect at the end of the current billing cycle to avoid mid-cycle lockouts. See [Operations: Stripe webhooks](/docs/en/operations/stripe-webhooks) for failure modes. --- # Authentication flow URL: https://dispike.com/docs/en/concepts/auth-flow Description: How sessions, cookies, and identity are propagated across dispike.com and its sub-products. ## The 30-second model ``` user logs in once on → Dispike web app sets a host-only dispike.com (GoTrue) SameSite=Lax session cookie user visits a Dispike sub-product (e.g. chat) app boots → fetch('https://dispike.com/api/me/litellm-key', { credentials: 'include' }) ↑ browser auto-attaches the cookie because *.dispike.com is same-site ↑ Dispike web app returns: { key, plan, models, api_base } app hits tokenhub.dispike.com/v1/{models,chat/completions} with bearer ↑ the gateway enforces the user's plan whitelist + budget per request ``` Three BFF endpoints do all the work — sub-products never call GoTrue, Stripe, or LiteLLM admin APIs directly. ## Why this shape - **Single sign-on without OAuth dance.** Users log in once at `dispike.com` and their session works across every `*.dispike.com` sub-product, with no per-product redirect. - **Sub-products hold no secrets.** They never see the user's password, refresh token, or LiteLLM master key. The worst-case compromise of a sub-product is a leaked short-lived inference key. - **Centralized policy.** Plan whitelists, model gating, and budget enforcement live in one place (Dispike web app + LiteLLM) — sub-products can't drift from policy. ## Production vs dev In production the session cookie is `Secure`, so cookies will not attach to plain `http://` hosts. For local development, allow your dev origin via `XCT_CORS_EXTRA_ORIGINS=http://localhost:3000`. ## Desktop (Electron) Browser cookie inheritance doesn't apply to Electron — see [Guides: Desktop integration](/docs/en/guides/desktop-integration) for the OAuth-style flow we use for Dispike Agent Desktop. --- # Using LLMs and agents with Dispike docs URL: https://dispike.com/docs/en/concepts/llms-and-ai Description: Drop-in context for AI assistants — llms.txt, semantic anchors, structured references. We publish docs in a shape that's easy for LLM-powered tools (Cursor, Continue, Claude, ChatGPT) to ingest. ## llms.txt [/llms.txt](/llms.txt) and [/llms-full.txt](/llms-full.txt) follow the [llms.txt convention](https://llmstxt.org/): - `/llms.txt` — a curated index pointing at every important reference page. - `/llms-full.txt` — the same index plus the full text of every doc concatenated, suitable for one-shot context loading. Both files regenerate on every build. They're committed to the deploy so AI tools that crawl them get a consistent, fresh view. ## Markdown source Every doc page can be fetched as raw markdown by appending `?raw` to the URL: ``` GET https://dispike.com/docs/en/api-reference/inference?raw ``` This skips the wrapper layout and returns the markdown content + frontmatter. Useful when wiring Dispike docs into a RAG pipeline. ## Stable anchors Every `

` and `

` gets a slug derived from the heading text and rendered as `id="..."`. These slugs are stable across edits — when we rename a heading, we add a backwards-compat anchor. ## Cite-friendly structure Each page has: - A single `

` matching the frontmatter `title` - A 1-2 sentence summary right under it (= frontmatter `description`) - Headings in semantic order, no skipping levels - Tables for matrix-style facts (plans, error codes, SLAs) That structure plays well with extractive summarizers and quote-citation tools. --- # Service Level Agreement URL: https://dispike.com/docs/en/enterprise/sla Description: Uptime, latency, and support response commitments for paid plans. This SLA applies to paid plans. Free is best-effort with no commitments. ## Uptime | Plan | Monthly uptime | Credit | |---|---|---| | Pro | 99.5% | 5% of MRR per 0.1% missed below 99.5% | | Team | 99.9% | 10% of MRR per 0.1% missed below 99.9% | | Enterprise | 99.95% (custom available) | Negotiated; up to 30% MRR cap | Uptime is measured at the gateway edge against synthetic probes from three regions. Maintenance windows announced ≥48h in advance do not count against uptime; emergency security patches do not count if they take <15 minutes. ## Latency | Plan | p50 | p95 | |---|---|---| | Pro | <800ms | <2000ms | | Team | <600ms | <1500ms | | Enterprise | custom | custom | Measured at gateway → first-token for chat/completions on the default model. Excessive token counts (>4k input) get a proportional latency budget. ## Support response | Severity | Pro | Team | Enterprise | |---|---|---|---| | **S1** — production down | 4h | 1h | 15 min | | **S2** — degraded but functional | next business day | 4h | 1h | | **S3** — question / non-blocking | 3 business days | 1 business day | 4h | S1 always escalates to PagerDuty. Enterprise S1 includes a phone bridge. ## Credit claims Submit within 60 days of the missed window. Credits apply to the next invoice and do not roll over past 12 months. Contact `support@dispike.com`. Enterprise customers use their dedicated channel in the customer portal. --- # Data residency (Enterprise) URL: https://dispike.com/docs/en/enterprise/data-residency Description: Region pinning options and the dedicated-cluster deployment model. Enterprise contracts unlock data-residency controls beyond the default shared footprint: ## Region pinning Choose a single region to host **all** customer data: - **EU (Frankfurt)** — GDPR-native. - **US (Virginia)** — for latency to North American users. Pinning disables cross-region DR; we recommend coupling with an explicit DR plan (snapshots-only or warm standby in the same region). ## Dedicated cluster For regulated workloads, we deploy a single-tenant cluster: - Isolated Postgres for identity + inference logs - Isolated LiteLLM gateway with the customer's choice of providers - Customer's own KMS root keys (BYOK) - Customer-supplied VPN or PrivateLink for ingress Operated by Dispike, billed at a different rate than shared infra. Talk to us via `hello@dispike.com`. ## Customer-hosted For air-gapped or fully-sovereign environments, the Dispike gateway can be deployed inside the customer's cloud (AWS / Azure / GCP). The customer pays for compute; Dispike provides the software, updates, and support. Identity and billing still flow through dispike.com unless the customer opts for fully-offline mode. ## Reach out Email `hello@dispike.com`. Typical evaluation cycle is 4–8 weeks; we'll walk you through a deployment plan, run a proof-of-concept against your data, and produce a custom DPA. --- # Procurement & contracts URL: https://dispike.com/docs/en/enterprise/procurement Description: How to buy Dispike at the enterprise tier — paper, security review, SSO, invoicing. ## Standard package Every Enterprise contract includes: - A **Master Service Agreement** (MSA) — we can use yours or our template. - A **Data Processing Addendum** — see [/dpa](/dpa) for the standard text. - A **custom SLA** — defaults are in [SLA](/docs/en/enterprise/sla), negotiated up from there. - **SSO (SAML or OIDC)** — IdP-initiated or SP-initiated. - **SCIM provisioning** — auto-provision and de-provision seats from your IdP. - **Audit log export** — periodic delivery to your SIEM via S3 or webhook. - **Dedicated support contact** — named CSM + Slack Connect. ## Buying process 1. **Discovery call** (30 min) — we scope your use case and identify gaps vs the shared plan. 2. **Security review** — we share our SOC 2 progress, DPA, sub-processor list, pen-test summary. Your team's review form is welcome. 3. **POC** (typically 2–4 weeks) — full Pro-tier access, your real workload, success criteria agreed up front. 4. **Paper** — MSA + Order Form + DPA. We aim for sign in <2 weeks from POC end. 5. **Provisioning** — SSO + SCIM + custom domain + dedicated capacity (if applicable) in <1 week. ## Pricing models - **Per-seat** — $$ per seat / month with a minimum. - **Usage-based** — committed monthly compute, overage at published rate. - **Hybrid** — base platform fee + metered usage. - **Custom deployment** — annual platform fee + compute pass-through. ## Invoicing Annual prepaid (NET-30 from invoice). Multi-year discounts available. Custom payment terms negotiable above a threshold. ## Renewals Auto-renew by default with 60-day cancellation notice. We send a renewal reminder 90 days before the term ends and an open invitation to upgrade or right-size. Contact: `hello@dispike.com`. --- # Enterprise onboarding playbook URL: https://dispike.com/docs/en/enterprise/onboarding-playbook Description: What happens between signing the order form and your first production traffic. A 30-day playbook the Dispike CSM follows on every Enterprise signup. We share it so you know what to expect — and so your procurement team can map our checkpoints to yours. ## Week 0 — kickoff - **Day 0**: Signed order form + DPA filed. - **Day 1**: CSM intro email; calendar holds for weekly sync + one-time kickoff (60 min). - **Day 2**: Slack Connect channel created (`#dispike-`); shared Notion page with this playbook + your tracker. ## Week 1 — provisioning - SSO connection (SAML or OIDC) configured on both sides. - SCIM token issued; we test provisioning end-to-end with a dummy user. - Initial seats created from your IdP. Pilot users invited. - Dedicated capacity allocated (if applicable). Healthcheck dashboard linked. ## Week 2 — proof of value - Pilot users run real workloads. Daily usage report from our side. - We surface latency / cost / error breakdown vs. your previous provider. - Tuning calls as needed — model routing, prompt patterns, budgets. ## Week 3 — production cutover plan - Define the cutover window. Rollback steps written down on both sides. - Synthetic probes pointed at your endpoints. SLA baseline measured. - Incident escalation contacts on file in PagerDuty. ## Week 4 — go-live - Production traffic ramped per the cutover plan (typically 10% → 50% → 100%). - 24h hyper-care window. CSM available on Slack Connect. - Post-go-live retro at the end of week 4. ## Ongoing - Weekly sync drops to monthly after 90 days. - Quarterly business review with usage trend, SLA scorecard, roadmap preview. - Annual contract renewal touchpoint at term-90, term-30. --- # Support tier matrix URL: https://dispike.com/docs/en/enterprise/support-matrix Description: Channels, response targets, and what each support tier includes. ## Tier comparison | Capability | Free | Pro | Team | Enterprise | |---|---|---|---|---| | Docs + community | ✓ | ✓ | ✓ | ✓ | | Email support (24h) | — | ✓ | ✓ | ✓ | | In-product chat | — | ✓ | ✓ | ✓ | | Dedicated Slack Connect | — | — | — | ✓ | | Phone bridge for S1 | — | — | — | ✓ | | Named CSM | — | — | — | ✓ | | 24×7 on-call (PagerDuty) | — | — | — | ✓ | | Architectural reviews | — | — | annual | quarterly | | Roadmap input | — | — | community | direct | ## Severity definitions - **S1** — production down or unsafe data exposure. Page immediately. - **S2** — degraded but workable. File via support channel. - **S3** — bug, feature request, question. File via support channel. ## Response targets See [SLA](/docs/en/enterprise/sla). Enterprise customers get 15-min S1 acknowledgement and 1h status update cadence until resolution. ## How to reach us | Channel | Best for | |---|---| | `support@dispike.com` | All tiers; default for S2/S3 | | In-product chat | Quick questions, all paid tiers | | Slack Connect | Enterprise, anything non-S1 | | PagerDuty number | Enterprise S1 only | | `security@dispike.com` | Vulnerabilities, all tiers | Every Enterprise customer gets a one-page contact card in their kickoff packet — laminate-friendly version available on request. --- # Status & incident communication URL: https://dispike.com/docs/en/enterprise/status-page Description: Where to watch operational state and how we communicate during incidents. ## Status page Live at [status.dispike.com](https://status.dispike.com). Components: - **Gateway (tokenhub.dispike.com)** — inference API availability + p95 latency - **Identity (Dispike auth service)** — login, session, registration - **Billing** — Stripe webhook ingestion and plan-state sync - **Console** — `dispike.com/dashboard` - **Docs** — `dispike.com/docs` Each component publishes a 90-day uptime history. JSON feed at `/status.json`; RSS at `/status.rss`. ## Incident severity | Level | Definition | Public update cadence | |---|---|---| | **Investigating** | Anomaly detected, scope unconfirmed | within 15 min of detection | | **Identified** | Root cause known, fix in progress | every 30 min | | **Monitoring** | Fix deployed, watching | every hour | | **Resolved** | Service restored, postmortem pending | postmortem within 5 business days | Enterprise customers get the same updates pushed to their dedicated Slack Connect channel within 60 seconds of the public post. ## Postmortems Within 5 business days of any S1 incident. We publish a redacted version on the status page and share the full version (including timelines, alerts, and corrective actions) with affected Enterprise customers. Our template includes: detection → diagnosis → mitigation → root cause → corrective action → action items with owners. We follow blameless review practice — naming systems and processes, not individuals. ## Scheduled maintenance Announced ≥48h in advance via: - Status page (banner) - Email to billing-admin contacts - Slack Connect for Enterprise Emergency security patches with <15 min duration may go out without advance notice. We document them retroactively on the status page. --- # Introduction URL: https://dispike.com/docs/en/get-started/introduction Description: What Dispike is, who it's for, and how the pieces fit together. Dispike.com is the intelligent distribution and application hub for the AI era. High-performance AI token routing and a multi-tenant architecture seamlessly connect foundation models to an upper layer of audiovisual generation, healthcare and vertical-industry agents — helping enterprises and super-individuals break through technical barriers and deploy AI-native applications quickly and efficiently. Everything runs behind a single account, a single billing plane, and a single OpenAI-compatible API at `https://tokenhub.dispike.com/v1`. This documentation covers everything a developer, integrator, or enterprise buyer needs to ship on top of Dispike: account setup, the inference API, keys and budgets, sub-product integration, deployment, and operational guarantees. ## Who this is for - **Developers** building applications against the inference gateway (`https://tokenhub.dispike.com/v1`). - **Super-individuals** who want one key for every model and a ready-made set of agents, skills, and creative tools. - **Integrators** wiring a browser sub-product into the unified identity + billing flow. - **Enterprises** evaluating Dispike for multi-tenant rollout, compliance, SLA, residency, and procurement. - **Operators** running the Dispike stack — staging deploys, rotating secrets, debugging webhooks. ## What you get | Layer | What it does | Where | |---|---|---| | **AI token intelligent routing** | One OpenAI-compatible API in front of many models, with fallback, per-request and monthly budgets, and virtual keys | `https://tokenhub.dispike.com/v1` | | **Multi-tenant architecture** | Per-tenant keys, budgets, isolation, and usage ledgers — for teams, customers, and end-users | `/dashboard/keys`, `/dashboard/usage` | | **Application layer** | Studio and Drama (audiovisual generation), healthcare and vertical-industry agents, Skills, MCP Gateway, Dispike Claw | `/studio`, `/drama`, `/agents`, `/skills`, `/mcp-gateway` | | **Console** | Account, billing, keys, usage, and add-ons in one place | `https://dispike.com/dashboard` | All layers share one identity (your Dispike account), one billing relationship (Stripe-backed), and one usage ledger. ## How the docs are organized - **Get Started** — install, authenticate, make your first request. - **Concepts** — mental model for accounts, plans, keys, budgets, and the gateway. - **Products** — the [Dispike AI platform](/docs/en/products/ai-platform) and [Dispike Claw](/docs/en/products/claw). - **API Reference** — every public endpoint with request/response examples. - **Guides** — task-shaped recipes (integrate auth, ship a sub-product, handle webhooks). - **Operations** — runbooks, deploy, secrets, Stripe webhooks, testing. - **Security & Compliance** — DPA, regions, encryption, audit posture. - **Enterprise** — procurement, custom SLAs, dedicated capacity. If you're new, start with [Quick Start](/docs/en/get-started/quickstart). If you're integrating an existing app, jump to [Sub-product Integration](/docs/en/guides/sub-product-integration). --- # Quick Start URL: https://dispike.com/docs/en/get-started/quickstart Description: Create an account, get an API key, and make your first inference call in under five minutes. This page walks you from zero to your first response from the Dispike inference gateway. ## 1. Create an account 1. Open [dispike.com/register](https://dispike.com/register). 2. Sign up with email + password. We send a confirmation link via Resend; the account is activated when you click it. 3. You'll land on the dashboard at `dispike.com/dashboard`. New accounts start on the **Free** plan. ## 2. Get an API key The gateway uses bearer tokens scoped to your account. Two ways to retrieve one: **Dashboard** — go to `/dashboard/keys`. Click **Create key**, copy the value (we only show it once), and give it a descriptive label. **Programmatic** — keys can also be minted via the LiteLLM admin API once your account has an entitlement. See [Provisioning keys](/docs/en/api-reference/keys). ```bash export DISPIKE_API_KEY="sk-..." ``` ## 3. Make your first request The gateway is OpenAI-compatible. Any OpenAI client library works — just swap the base URL. ```bash curl https://tokenhub.dispike.com/v1/chat/completions \ -H "Authorization: Bearer $DISPIKE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-pro-260425", "max_tokens": 1024, "messages": [{"role": "user", "content": "Say hello in one sentence."}] }' ``` Python: ```python import os from openai import OpenAI client = OpenAI( api_key=os.environ["DISPIKE_API_KEY"], base_url="https://tokenhub.dispike.com/v1", ) resp = client.chat.completions.create( model="deepseek-v4-pro-260425", max_tokens=1024, messages=[{"role": "user", "content": "Say hello in one sentence."}], ) print(resp.choices[0].message.content) ``` ## 4. Check usage Every request is logged. Visit `/dashboard/usage` for a live readout of: - Tokens consumed today / this billing cycle - Per-model breakdown - Remaining budget against your plan cap Free-tier accounts get a hard ceiling — paid plans get a soft cap with overage billing. See [Plans & Pricing](/docs/en/concepts/plans) for the full matrix. ## What's next - [Concepts: Plans, keys, and budgets](/docs/en/concepts/plans) - [Guide: Integrate auth into a sub-product](/docs/en/guides/sub-product-integration) - [API Reference: chat/completions](/docs/en/api-reference/inference) --- # Installation URL: https://dispike.com/docs/en/get-started/installation Description: SDK install steps for Node.js, Python, and Go clients, plus environment setup. Dispike's gateway is OpenAI-compatible, so you install the same SDK you'd use for OpenAI and point it at our base URL. ## Node.js ```bash npm install openai ``` ```ts import OpenAI from 'openai'; export const dispike = new OpenAI({ apiKey: process.env.DISPIKE_API_KEY!, baseURL: 'https://tokenhub.dispike.com/v1', }); ``` ## Python ```bash pip install openai ``` ```python import os from openai import OpenAI dispike = OpenAI( api_key=os.environ["DISPIKE_API_KEY"], base_url="https://tokenhub.dispike.com/v1", ) ``` ## Go ```bash go get github.com/sashabaranov/go-openai ``` ```go cfg := openai.DefaultConfig(os.Getenv("DISPIKE_API_KEY")) cfg.BaseURL = "https://tokenhub.dispike.com/v1" client := openai.NewClientWithConfig(cfg) ``` ## Environment variables | Variable | Purpose | |---|---| | `DISPIKE_API_KEY` | Bearer token issued from `/dashboard/keys` | | `DISPIKE_BASE_URL` | Optional override; defaults to `https://tokenhub.dispike.com/v1` | | `DISPIKE_DEFAULT_MODEL` | Optional default model id used by your app | Never commit `DISPIKE_API_KEY` to git. Store it in your platform's secret manager — see [Operations: Secrets](/docs/en/operations/secrets). --- # Integrate a browser sub-product URL: https://dispike.com/docs/en/guides/sub-product-integration Description: Wire any first-party Dispike app into the unified identity, plan, and inference flow. How to wire a new browser sub-product (anything on `*.dispike.com`) into the Dispike identity + inference gateway flow. > **Scope**: this guide covers **browser** sub-products only — apps that run inside a normal Chromium / Firefox / Safari window on a `*.dispike.com` subdomain. For the Electron desktop app see [Desktop integration](/docs/en/guides/desktop-integration). ## Prerequisites 1. **Subdomain on `dispike.com`** — your app must be served from `https://.dispike.com`. Anything else needs an explicit allowlist entry in the Dispike web app env (`XCT_CORS_EXTRA_ORIGINS=https://your-other-host.com`) and a security review. 2. **HTTPS in production** — the session cookie has `Secure`, so cookies will not attach to plain http hosts in production. 3. **User has a Dispike account** — first-time visitors get redirected to `dispike.com/login`; we don't ship a per-product signup form. ## Step 1 — fetch the identity envelope ```ts async function getDispikeIdentity() { const res = await fetch('https://dispike.com/api/me/litellm-key', { credentials: 'include', }); if (res.status === 401) { window.location.href = 'https://dispike.com/login?return=' + encodeURIComponent(window.location.href); return null; } return res.json() as Promise<{ key: string; plan: string; models: string[]; api_base: string; }>; } ``` That single call gives you the bearer, the user's plan, the models they can hit, and the gateway base URL. ## Step 2 — make inference calls ```ts const id = await getDispikeIdentity(); if (!id) return; const res = await fetch(`${id.api_base}/chat/completions`, { method: 'POST', headers: { Authorization: `Bearer ${id.key}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: id.models[0], messages: [{ role: 'user', content: 'Hello' }], }), }); ``` ## Step 3 — react to plan changes The plan field returned by `/api/me/litellm-key` is fresh-on-load. For long-lived sessions, re-fetch it on focus or every 5 minutes. A plan downgrade will start returning `403` from `/chat/completions` for models you used to have access to — handle it gracefully by re-fetching `models` and updating your UI. ## Common mistakes - **Forgetting `credentials: 'include'`.** Without it the browser doesn't send the session cookie and you'll always get `401`. - **Hardcoding `api_base`.** Always read it from the identity envelope. We will move the gateway hostname in the future. - **Caching the bearer.** It's short-lived (rotated when the user revokes or plan changes). Re-fetch on `401`. - **Calling Stripe / GoTrue directly.** Don't. Sub-products own no shared secrets. --- # Deployment URL: https://dispike.com/docs/en/guides/deployment Description: Deploy the Dispike web app to Cloudflare Pages with the Node adapter + Wrangler. The Dispike web app ships as an Astro hybrid app behind the Node adapter, with Cloudflare Pages as the production runtime. ## Local build ```bash npm install npm run build # astro build → ./dist npm run start # node ./dist/server/entry.mjs — preview the production bundle ``` ## Cloudflare Pages ```bash npm run pages:dev # wrangler pages dev ./dist npm run pages:deploy # build + wrangler pages deploy ./dist ``` `wrangler.toml` pins the project name; Cloudflare environment variables hold all secrets — `STRIPE_SECRET_KEY`, `GOTRUE_ADMIN_TOKEN`, `LITELLM_MASTER_KEY`, etc. See [Operations: Secrets](/docs/en/operations/secrets) for the full list. ## Required environment variables | Var | Purpose | |---|---| | `PUBLIC_SUPABASE_URL` | Local dev fallback identity provider | | `PUBLIC_SUPABASE_ANON_KEY` | Anon key for dev | | `GOTRUE_URL` | Base URL of the Dispike auth service (self-hosted GoTrue) | | `GOTRUE_ADMIN_TOKEN` | Long-lived service JWT for webhook user updates | | `STRIPE_SECRET_KEY` | Stripe secret | | `STRIPE_WEBHOOK_SECRET` | Stripe webhook signing secret | | `STRIPE_PRICE_PRO_MONTHLY` | Stripe price id for Pro | | `STRIPE_PRICE_TEAM_MONTHLY` | Stripe price id for Team | | `LITELLM_BASE_URL` | Base URL of the Dispike inference gateway (Dispike Router) | | `LITELLM_MASTER_KEY` | Dispike Router master key for key provisioning | | `XCT_CORS_EXTRA_ORIGINS` | Comma-separated dev/external origins | ## Smoke test the deploy After every deploy: 1. Hit `/` — homepage 200. 2. Hit `/api/auth/me` — should be `401` when not signed in. 3. Hit `/dashboard` while signed in — sidebar shell renders. 4. Trigger a Stripe test event (`stripe trigger checkout.session.completed`) — webhook returns `200`. Or just run the smoke suite: ```bash npm run test:smoke ``` See [Operations: Test framework](/docs/en/operations/testing). --- # Desktop integration (Electron) URL: https://dispike.com/docs/en/guides/desktop-integration Description: How Dispike Agent Desktop and other native apps authenticate users without browser cookies. Browser cookie inheritance does not work in Electron, mobile, or any native app. Those clients use an OAuth-style device flow against the Dispike web app. ## Flow ``` desktop app Dispike web app user browser │ │ │ │ POST /api/auth/device/start ───▶│ │ │ { client: "agent-desktop" } │ │ │ │ │ │ ◀── { device_code, user_code, │ │ │ verify_url, interval } │ │ │ │ │ │ open verify_url in browser ─────────────────────────────────────▶│ │ │ ◀── user logs in, approves ──│ │ │ │ │ POST /api/auth/device/poll ────▶│ │ │ { device_code } │ │ │ │ │ │ ◀── { access_token, refresh, │ │ │ expires_in } │ │ ``` Poll every `interval` seconds (default 5s). Stop on `400 expired_token` or `200`. ## Token storage Store the access token in the OS keychain: - **macOS** — `keytar` writing to Keychain. - **Windows** — Credential Manager. - **Linux** — Secret Service (gnome-keyring/kwallet). Never persist to plain files. Refresh on `401`. ## Using the token Same as browser — but pass it via `Authorization: Bearer` header instead of relying on the cookie: ```ts const res = await fetch('https://dispike.com/api/me/litellm-key', { headers: { Authorization: `Bearer ${accessToken}` }, }); ``` The `/api/me/litellm-key` envelope is identical. From there, identical inference flow. ## Updates Dispike Agent Desktop self-updates from `/api/agent-desktop/releases`. The endpoint returns a manifest with current/min versions and a signed download URL. --- # Handle Dispike webhooks URL: https://dispike.com/docs/en/guides/handle-webhooks Description: Subscribe to plan, key, and usage events from Dispike. Dispike emits webhooks for Enterprise customers and B2B partners that need to react to plan, key, or usage changes. ## Subscribe Configure the webhook URL via `hello@dispike.com` or — when self-serve is available — `/dashboard/webhooks`. ## Events | Event | When | |---|---| | `user.plan_changed` | A user's plan changed (upgrade, downgrade, or expiry) | | `user.key_created` | A new inference key was minted | | `user.key_revoked` | A key was revoked | | `usage.threshold_crossed` | An account crossed a configured % of its monthly cap | Payload shape: ```json { "id": "evt_...", "type": "user.plan_changed", "created": 1747353600, "data": { "user_id": "uuid", "previous_plan": "pro", "current_plan": "team" } } ``` ## Signatures Every webhook is signed with `X-Dispike-Signature: t=,v1=`. Verify with the secret returned at subscription time: ```ts import crypto from 'node:crypto'; function verify(payload: string, header: string, secret: string): boolean { const [t, v1] = header.split(',').map((p) => p.split('=')[1]); const expected = crypto .createHmac('sha256', secret) .update(`${t}.${payload}`) .digest('hex'); return crypto.timingSafeEqual(Buffer.from(v1), Buffer.from(expected)); } ``` ## Retries We retry on non-2xx for up to 24h with exponential backoff. Always return `2xx` *quickly* — defer slow work to your own queue. Idempotency: every event has a unique `id`. Use it as the idempotency key in your handler. --- # Secrets & environment URL: https://dispike.com/docs/en/operations/secrets Description: Every secret the Dispike web app needs, where it lives, and how to rotate it. ## Source of truth | Secret | Where stored | Owner | |---|---|---| | `STRIPE_SECRET_KEY` | Cloudflare Pages env | Billing | | `STRIPE_WEBHOOK_SECRET` | Cloudflare Pages env | Billing | | `GOTRUE_JWT_SECRET` | Railway (Dispike auth service) | Identity | | `GOTRUE_ADMIN_TOKEN` | Cloudflare Pages env | Identity | | `LITELLM_MASTER_KEY` | Cloudflare Pages env | Inference | | `RESEND_API_KEY` | Railway (Dispike auth service) | Identity | Local development reads from `.env`; never commit it — `.gitignore` already includes it. ## Rotation **Stripe key** — rotate from Stripe Dashboard → API keys → Roll. Update the value in Cloudflare Pages, redeploy. Stripe lets the old key linger for 12h. **Stripe webhook secret** — re-create the webhook endpoint in Stripe Dashboard with the new secret. Update env, redeploy. Old endpoint can be deleted after one successful event under the new key. **GoTrue admin token** — re-run the token-minting snippet from [Concepts: Authentication flow](/docs/en/concepts/auth-flow). Update env, redeploy. Old tokens are valid until their `exp` claim; rotate the JWT secret if you suspect compromise. **LiteLLM master key** — generate a new one from the Dispike Admin, swap env, redeploy. Per-user inference keys are unaffected — only the admin/provisioning surface is. ## Audit Every rotation should be logged with date, actor, and reason in `docs/security/rotation-log.md` (private repo). Enterprise tenants can request rotation logs as part of their compliance package — see [Security & Compliance](/docs/en/security/overview). --- # Stripe webhooks URL: https://dispike.com/docs/en/operations/stripe-webhooks Description: How billing events flow into the Dispike web app, what can fail, and how to replay. `/api/billing/webhook` is the only endpoint Stripe ever calls. It must be: - **Idempotent** — Stripe retries on `5xx`. Don't double-apply effects. - **Signature-checked** — every request is verified against `STRIPE_WEBHOOK_SECRET`. Unsigned events return `400`. - **Fast** — Stripe times out after ~30s. Defer slow work to a background queue. ## Events we listen for | Event | Effect | |---|---| | `checkout.session.completed` | Mark user as paid, set initial plan | | `customer.subscription.created` | Set plan on `app_metadata.plan` | | `customer.subscription.updated` | Re-sync plan + entitlements | | `customer.subscription.deleted` | Downgrade to Free | | `invoice.payment_failed` | Tag user `payment_failed=true`, send dunning email | ## Failure modes **Signature mismatch** — `400`. Caller logs the discrepancy. Most often: wrong env (test secret in prod) or a stale webhook endpoint. **GoTrue down** — webhook returns `500`. Stripe retries with exponential backoff for ~3 days. If GoTrue stays down past then, manually replay from the Stripe dashboard. **Plan id unknown** — webhook returns `200` but logs a warning. We don't fail the event because Stripe state is the truth; instead, the plan resolver in `src/lib/billing.ts` falls back to Free until the price id is added to the plan map. ## Replay From Stripe Dashboard → Developers → Webhooks → click the failed event → **Resend**. For batch replay during an incident, use the Stripe CLI: ```bash stripe events resend --type customer.subscription.updated --since 1747000000 ``` ## Local development ```bash stripe listen --forward-to http://localhost:4321/api/billing/webhook ``` Copy the printed `whsec_...` into `.env`. Then: ```bash stripe trigger checkout.session.completed ``` --- # Test framework URL: https://dispike.com/docs/en/operations/testing Description: How the Playwright test suite is structured, run, and aggregated. The Dispike web app ships with a multi-tier Playwright suite. Every PR runs **smoke** + **e2e**; the nightly job runs everything including a11y and visual regression, then writes the [test dashboard](/docs/en/operations/test-dashboard). ## Suite layout ``` tests/ ├── smoke/ every route loads with 200 + a key DOM marker ├── e2e/ flows: auth, blog filter, share buttons, dashboard, pricing ├── api/ contract tests for /api/* endpoints (status + shape) ├── a11y/ axe scan on the top 10 pages ├── visual/ per-section snapshots (nightly only) └── fixtures/ reusable mocks (Stripe, Supabase, LiteLLM) ``` ## Local commands ```bash npm run test # all suites except visual npm run test:smoke # < 30 seconds — route load + 200 npm run test:e2e # full user flows npm run test:api # API contract tests npm run test:a11y # axe-core scan npm run test:visual # snapshot suite (use --update-snapshots after intentional UI changes) npm run test:dashboard # aggregate recent runs → docs/test-dashboard ``` ## Picking the right suite | Change | Run | |---|---| | Markdown / blog content | `test:smoke` | | Component refactor | `test:smoke` + `test:e2e` | | New API endpoint | `test:api` + add a smoke for it | | Visual change | `test:visual --update-snapshots` after review | | Pre-merge full sweep | `npm test` | ## What CI runs - **Pull request**: `test:smoke` + `test:e2e` + `test:api` — blocks merge on failure. - **Nightly main**: all suites + `test:visual` + dashboard publish. See `.github/workflows/test.yml` for the full pipeline. --- # Test dashboard URL: https://dispike.com/docs/en/operations/test-dashboard Description: Where to read pass-rate, flake, and coverage trends from the Playwright suite. The dashboard at [/internal/test-dashboard](/internal/test-dashboard) aggregates the last 30 runs of the Playwright suite. It's regenerated: - After every CI run on `main` - After every successful nightly job - On demand: `npm run test:dashboard` ## What it shows | Panel | Source | |---|---| | **Pass rate trend** | `tests.passed / tests.total` across the last 30 runs | | **Top 10 flakiest tests** | Tests whose verdict has changed in the last 30 runs without code changes | | **Slowest 10 tests** | Median wall-clock from the JSON reporter | | **Route coverage matrix** | Every route under `src/pages/` × which suite touches it | | **Last failure log** | Stack + screenshot of the most recent failure per spec | ## Where data is stored - Per-run JSON: `playwright-report/results.json` - Rolling history: `.test-history/{YYYY-MM-DD}-{run-id}.json` (gitignored) - Aggregated output: `docs/test-dashboard/index.html` (committed) The aggregator script is `scripts/aggregate-test-results.mjs` — it reads recent history, computes the metrics, and writes a static dashboard. No external service required. ## Cleaning up flakes When a test lands on the flake list: 1. Reproduce locally with `--repeat-each=10`. 2. If genuinely flaky, mark `test.fixme` with a `// flake: ` note. **Do not** use `.skip` — fixme keeps the test discoverable. 3. File a Linear ticket against the owning team. Flakes auto-decay off the list after 7 days without recurrence. We treat sustained pass rate <99% as a release blocker. --- # Runbooks URL: https://dispike.com/docs/en/operations/runbooks Description: Step-by-step procedures for common operational tasks and incidents. ## Deploy a hotfix 1. Branch from `main`, name it `hotfix/`. 2. Make the change. Run `npm run test:smoke` locally. 3. PR → request 1 reviewer → smoke + e2e gate must pass. 4. Merge. `pages:deploy` runs from CI on `main`. 5. Verify via `/internal/test-dashboard` — the next smoke run should be green within 5 minutes. ## Roll back ```bash npm run pages:deploy -- --branch ``` Or from Cloudflare Pages UI → Deployments → Rollback. Confirms in ~30 seconds. Database schema changes do **not** roll back automatically. If the bad deploy migrated, restore from the backup at the dated backup bucket (`/`) first. ## Stripe webhook is failing 1. Stripe Dashboard → Developers → Webhooks → check error rate. 2. If signature mismatch, verify `STRIPE_WEBHOOK_SECRET` matches the endpoint's signing secret in Stripe. 3. If `500`, check Cloudflare Pages logs for `/api/billing/webhook`. Most common cause: GoTrue admin token expired — see [Secrets](/docs/en/operations/secrets) for rotation. 4. Replay failed events: Stripe Dashboard → Webhooks → Failed → Resend. ## A user can't log in 1. `/dashboard/keys` — confirm user exists in GoTrue admin. 2. Check `email_confirmed_at` — unconfirmed users can't sign in. 3. Resend confirmation: GoTrue admin → user → Resend. 4. If email never arrived, check Resend dashboard — most often a domain reputation issue, not GoTrue. ## Gateway latency spike 1. Check the Dispike Router health endpoint. 2. If a single model is slow, LiteLLM should auto-failover; verify routing in admin. 3. If the whole gateway is slow, escalate to infra — upstream provider capacity or network path. ## Where alerts go Pages: PagerDuty rotation. Slack: `#ops-alerts`. --- # Dispike AI Platform URL: https://dispike.com/docs/en/products/ai-platform Description: AI token intelligent routing, multi-tenant architecture, and the application layer on top. The Dispike AI platform is the hub between foundation models and the applications people actually use. It has three parts that share identity, billing, and observability: | Part | What it does | Where | |---|---|---| | **AI token intelligent routing** | One OpenAI-compatible API for many models — fallback, budgets, virtual keys | `https://tokenhub.dispike.com/v1` | | **Multi-tenant architecture** | Per-tenant keys, budgets, isolation, and usage | `/dashboard/keys`, `/dashboard/usage` | | **Application layer** | Studio, Drama, healthcare and vertical-industry agents, Skills, MCP Gateway, Dispike Claw | [/studio](/studio), [/agents](/agents), [/skills](/skills), [/mcp-gateway](/mcp-gateway) | It is built for both enterprises and super-individuals: the same platform serves a solo builder with one key and an enterprise issuing thousands of tenant keys. ## AI token intelligent routing Documented in detail in [API Reference: Inference](/docs/en/api-reference/inference). Key features: - **One API, many models** — OpenAI-compatible REST and SSE in front of multiple upstream providers. See the catalog at [/models](/models). - **Fallback** — when an upstream degrades, requests route to an equivalent model instead of failing. - **Plan-based model whitelist** — a key can only call models its plan allows; `GET /v1/models` returns exactly that list. - **Budgets** — per-request cost ceilings plus monthly caps, enforced at admission. - **Virtual keys** — mint, label, and revoke keys without touching provider credentials. ## Multi-tenant architecture - **Per-tenant keys** — issue a key per team, customer, or end-user through the dashboard or the [Keys API](/docs/en/api-reference/keys). - **Per-tenant budgets** — every key carries its own budget envelope; one tenant cannot drain another's. - **Isolation** — usage, logs, and application data are partitioned per account. Products like [Dispike Claw](/docs/en/products/claw) partition sessions, memory, and channels per user id. - **Usage ledger** — every request is metered and visible in `/dashboard/usage`, rolled up per key and per model. ## Application layer | Product | What it is | |---|---| | [Studio](/studio) | Audiovisual generation: images, video, and voice from one workspace | | [Drama](/drama) | AI short-drama production, from script to finished episodes | | [Agents](/agents) | Ready-to-use agents, including [healthcare agents](/agents#cat-healthcare) and vertical-industry agents | | [Skills](/skills) | Reusable capabilities your agents can call | | [MCP Gateway](/mcp-gateway) | One endpoint for Model Context Protocol tools, governed by your keys and budgets | | [Dispike Claw](/docs/en/products/claw) | Your own hosted agent runtime, bound to Telegram, Discord, or Slack | | Dispike Agent Desktop | Desktop agent app — see [Desktop integration](/docs/en/guides/desktop-integration) | Every product above uses the same account, the same key envelope, and the same budget — spend in Studio and spend through the API land in one ledger. ## Next steps - [Quick Start](/docs/en/get-started/quickstart) — first request in five minutes. - [Plans, keys, and budgets](/docs/en/concepts/plans) - [Architecture Overview](/docs/en/concepts/architecture) --- # Dispike Claw URL: https://dispike.com/docs/en/products/claw Description: Your own OpenClaw agent runtime — launch an isolated instance and bind an IM channel in seconds. Dispike Claw is a hosted "OpenClaw" agent runtime, offered as a paid add-on from your Dispike dashboard. Each user launches their own agent — with private memory, skills, and tools — and binds IM channels (Telegram, Discord, Slack) so end-users can chat with it on the platform of their choice. > **TL;DR** — Buy the add-on → click **Launch OpenClaw** → paste a bot token. Your agent is live, isolated, and metered through your existing Dispike Router budget. ## How it works Dispike Claw runs as **one shared Dispike Claw instance** operated by Dispike. The dashboard never spins up a container per customer. Instead it holds a single `type=user` API key and provisions you as an isolated **app_user** via the `X-Fastclaw-End-User` header — keyed to your Dispike `user.id`. ``` dashboard ──(Bearer FASTCLAW_USER_KEY + X-Fastclaw-End-User: )──▶ Dispike Claw POST /v1/users → mint your isolated app_user POST /api/agents → create your OpenClaw agent POST /api/providers → wire its model to Dispike Router with your key POST /api/agents/{id}/channels/telegram → bind your bot ``` Everything partitions per `user.id`: sessions, memory, files, agents, and channel bindings. No other tenant can see or reach your agent. ## Getting started 1. **Purchase** — open **Dashboard → Dispike Claw** ([/dashboard/claw](/dashboard/claw)) and click **Purchase Dispike Claw**. This is a standalone subscription, independent of your Free / Pro / Team plan. 2. **Launch** — click **Launch OpenClaw**. One call provisions your agent and points its model at Dispike Router using your existing virtual key, so inference spend flows through your normal budget. 3. **Bind a channel** — pick Telegram / Discord / Slack, paste the bot token, and click **Connect**. Dispike Claw validates the token live and starts delivering messages immediately — no restart. 4. **Chat** — message your bot. Your agent replies with its own memory and skills. ## Plan & billing Access is gated by the `xct_claws_access` entitlement, granted by **either**: - the standalone **Dispike Claw add-on** (its own Stripe subscription, tracked in `app_metadata.claws_addon`), or - a plan that bundles the entitlement. The dashboard checks this with `hasClawsAccess(app_metadata)`. Canceling the add-on flips `claws_addon.active` to `false` and the **Launch** / channel actions lock again — your data is retained. ## Channels | Channel | Credential | Notes | |---|---|---| | Telegram | Bot token from [@BotFather](https://t.me/BotFather) | Validated via `getMe`; binds by bot username | | Discord | Bot token (Developer Portal) | Validated via `/users/@me` | | Slack | Bot token (`xoxb-…`) | Validated via `auth.test` | A bound channel goes live without a restart. You can disconnect any channel from the dashboard at any time. ## API reference All routes require an authenticated Dispike session cookie and that your account has `xct_claws_access`. They proxy to Dispike Claw under your isolated app_user. ### `GET /api/me/claws` Status for the dashboard. ```json { "entitled": true, "configured": true, "provisioned": true, "agent": { "id": "agt_…" }, "channels": [{ "type": "telegram", "accountId": "mybot", "enabled": true }], "degraded": false } ``` ### `POST /api/me/claws/provision` Launch (or re-assert) your OpenClaw instance. Idempotent — a second call reuses your existing agent. ```json { "agent": { "id": "agt_…", "name": "My OpenClaw", "model": "…" }, "app_user_id": "u_…" } ``` `403 claws_access_required` if your account isn't entitled; `502` on a provisioning failure. ### `GET / POST / DELETE /api/me/claws/channels` - `GET` — list bound channels. - `POST` `{ "type": "telegram", "botToken": "…" }` — bind a channel; returns `{ ok, type, botUsername }`. - `DELETE` `{ "type": "telegram", "accountId": "mybot" }` — disconnect. `409 not_provisioned` if you haven't launched an agent yet; `400 unsupported_channel` for an unknown type. ## Data isolation Because every call carries `X-Fastclaw-End-User: `, Dispike Claw rebinds the request to a stable internal app_user minted from that id. Sessions, memory, agent files, and channel rows all live under that app_user — there is no shared-tenant surface. App_users cannot redirect user-scope provider config either, so the calling app's Dispike Router wiring can't be tampered with from inside the agent. ## For operators The dashboard needs three env vars (see `.env.example`): ```bash CLAWS_BASE_URL=https:// # shared Dispike Claw instance FASTCLAW_USER_KEY=sk_… # one type=user key (fastclaw apikey create --type user) STRIPE_PRICE_CLAWS=price_… # the add-on's Stripe price ``` Deploy Dispike Claw with `FASTCLAW_BIND=all` and a Postgres `FASTCLAW_STORAGE_DSN` for durability, and subscribe the Stripe webhook to the add-on price so `customer.subscription.*` events flip `claws_addon.active`. ## See also - [Integrate a browser sub-product](/docs/en/guides/sub-product-integration) — the identity + Dispike Router flow Dispike Claw reuses. - [Plans & entitlements](/docs/en/concepts/plans) --- # Security & Compliance URL: https://dispike.com/docs/en/security/overview Description: Encryption, residency, audit posture, and how to request compliance artifacts. ## Threat model Dispike defends against three primary threats: 1. **Credential theft from sub-products** — mitigated by never sharing Stripe/GoTrue/LiteLLM secrets with sub-products. The worst-case compromise yields short-lived inference keys, not the user's account. 2. **Inference key abuse** — mitigated by plan whitelists and per-request budget envelopes enforced at the gateway. A leaked key can't drain a month's budget in a single call and can't access models outside the plan. 3. **Webhook impersonation** — mitigated by HMAC signature checks on every Stripe event. ## Encryption | Layer | At rest | In transit | |---|---|---| | GoTrue Postgres | AES-256 (Railway managed) | TLS 1.3 | | LiteLLM Postgres | AES-256 (Railway managed) | TLS 1.3 | | Stripe data | (managed by Stripe — PCI-DSS Level 1) | TLS 1.3 | | Object storage (audit) | AES-256-GCM | TLS 1.3 | | Cloudflare Pages | (managed by Cloudflare) | TLS 1.3 | ## Data residency | Domain | Region | Notes | |---|---|---| | Identity (GoTrue) | Primary region | Encrypted DR mirror in EU | | Inference logs (LiteLLM) | Primary region | Encrypted DR mirror in EU | | Billing (Stripe) | US (Stripe-managed) | Required by PCI scope | | Audit object storage | Primary region + EU mirror | Customer-pinnable on Enterprise | Enterprise customers may pin a single region — see [Enterprise: Data Residency](/docs/en/enterprise/data-residency). ## Audit log Every privileged action (key rotation, plan override, admin login) is recorded with: actor, timestamp, source IP, action, target, result. Retained 365 days. Enterprise customers can request an export via their account team. ## Compliance posture | Standard | Status | |---|---| | SOC 2 Type II | Q4 2026 target | | GDPR | DPA available — see [DPA](/dpa) | | HIPAA | Roadmap; contact for BAA discussion | | ISO 27001 | Q1 2027 target | ## Vulnerability reporting Email `security@dispike.com`. We aim for first-response within 24h, fix or mitigation within 30 days for critical issues. We do not currently run a public bounty program. ## Subprocessors Listed at the [DPA](/dpa). Updated within 30 days of any change. --- # Data residency URL: https://dispike.com/docs/en/security/data-residency Description: Where customer data lives, what crosses borders, and how to constrain it. ## Default footprint A free or paid (non-Enterprise) account's data lives in: - **Primary region** — GoTrue Postgres, LiteLLM Postgres, object storage. The hosting region is listed in our [DPA](/dpa) sub-processor schedule. - **EU (Frankfurt)** — DR mirror, 6h lag. - **Stripe (US, EU)** — billing only. ## What crosses borders - Identity → only on DR mirror (encrypted, internal). - Inference content → does not leave the gateway's region in production; we don't echo to a logging sink outside the region. - Stripe billing data → outside our control, governed by Stripe's [International Data Transfers](https://stripe.com/legal/idpa). ## Enterprise residency pinning Enterprise contracts can pin to: - **Primary region only** — disable EU DR; data lives in the primary region exclusively. RPO is degraded to "best-effort" since DR is off. - **EU only** — primary and DR both served from EU regions. - **Single tenant on dedicated cluster** — separate Postgres/LiteLLM/object storage instances in the customer's preferred region. See [Enterprise: Data residency](/docs/en/enterprise/data-residency). ## Sub-processor changes We notify all customers ≥30 days before adding or removing a sub-processor that handles customer data. Enterprise customers can object to a sub-processor change; we'll work with you on a remediation path. --- # 推理 API URL: https://dispike.com/docs/zh/api-reference/inference Description: Dispike 推理网关提供的 OpenAI 兼容 chat/completions、completions、embeddings 端点。 推理网关位于 `https://tokenhub.dispike.com/v1`,使用 OpenAI REST 协议。任意 OpenAI SDK 可直接使用。 ## 认证 所有请求需要 `/dashboard/keys` 颁发的 Bearer Token: ``` Authorization: Bearer sk-... ``` 密钥可从控制台或 [Keys API](/docs/en/api-reference/keys) 吊销,5 秒内全球生效。 ## POST /v1/chat/completions 标准的 OpenAI chat-completions 格式。 ```bash curl https://tokenhub.dispike.com/v1/chat/completions \ -H "Authorization: Bearer $DISPIKE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-pro-260425", "max_tokens": 1024, "messages": [ {"role": "system", "content": "请简洁。"}, {"role": "user", "content": "用两句话解释 AI Token 路由。"} ], "stream": false }' ``` ## POST /v1/embeddings ```bash curl https://tokenhub.dispike.com/v1/embeddings \ -H "Authorization: Bearer $DISPIKE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "text-embedding-3-small", "input": "hello world" }' ``` ## GET /v1/models 返回 **当前密钥计划允许** 的模型 (非全局目录)。用它驱动 UI 模型选择器,不会泄露未授权模型。 ## 流式 `"stream": true` 开启 SSE 流。线协议与 OpenAI 完全一致: ``` data: {"choices":[{"delta":{"content":"你"}}]} data: {"choices":[{"delta":{"content":"好"}}]} data: [DONE] ``` ## 错误码 | 状态 | 含义 | |---|---| | `401` | 密钥无效或已吊销 | | `403` | 模型不在计划白名单 | | `402` | 超出预算 (单请求或月度) | | `429` | 限流,指数退避重试 | | `5xx` | 上游或网关问题,幂等请求可重试 | --- # 架构总览 URL: https://dispike.com/docs/zh/concepts/architecture Description: 路由、多租户、身份、计费与上层应用如何在 Dispike 中协同。 Dispike 分为三层 —— **底层大模型**、**路由与多租户枢纽**、**上层应用** —— 由三个共享平面串联:**身份**、**计费**、**推理**。 ``` ┌──────────────────────────────────────────────────────────────┐ │ 上层应用 │ │ Studio · Drama · 健康医疗与垂直行业 Agent · │ │ Skills · MCP Gateway · Dispike Claw · Agent Desktop · Chat │ └──────────────┬───────────────────────────────────────────────┘ │ 同一会话、同一密钥包络 ┌──────────────▼───────────────────────────────────────────────┐ │ Dispike Web 应用 (Astro BFF, dispike.com) │ │ ├── /api/auth/* 身份 BFF │ │ ├── /api/billing/* Stripe BFF │ │ └── /api/me/* 计划 / 密钥解析 │ └──────┬───────────────┬────────────────────┬──────────────────┘ ▼ ▼ ▼ Dispike 认证服务 Stripe AI Token 路由 (GoTrue) (计费) (tokenhub.dispike.com/v1) │ 回退 · 预算 · 虚拟密钥 ▼ 底层大模型 (多家供应商) ``` ## 底层大模型 Dispike 不绑定单一模型厂商。路由层位于多家上游供应商与自托管模型之前,以统一的 OpenAI 兼容协议对外提供。可用模型见 [/zh/models](/zh/models)。 ## 路由与多租户枢纽 ### 推理平面 —— AI Token 智能路由 `https://tokenhub.dispike.com/v1` 基于 LiteLLM 在所有上游之前做路由。每个请求只会命中密钥允许的模型,供应商降级时自动回退。每个 API Key 都绑定到 Dispike 账户、计划白名单与预算上限。每次请求落账,驱动 `/dashboard/usage` 与超量计费。 ### 多租户架构 每个租户 —— 团队、你的客户或单个终端用户 —— 都拥有独立的密钥、预算与用量账本。可通过 [Keys API](/docs/en/api-reference/keys) 按租户签发密钥;吊销一个租户的密钥不会影响其他租户。[Dispike Claw](/docs/zh/products/claw) 等上层产品沿用同样的隔离方式:所有调用按用户 id 分区。 ### 身份平面 认证集中在 Dispike 认证服务 (自托管 GoTrue,开发环境用 Supabase 兜底)。Dispike Web 应用签发 host-only、`SameSite=Lax` 的会话 Cookie。所有第一方 Dispike 子域上的浏览器子产品,通过 `credentials: 'include'` 调用 BFF 端点即可继承会话。 详见 [子产品集成](/docs/zh/guides/sub-product-integration)。 ### 计费平面 Stripe 是计划、订阅、发票的事实源。Dispike Web 应用持有唯一一份 Stripe 凭证;子产品永远不直接调用 Stripe。计划与权益通过 `/api/billing/webhook` 镜像到用户的 GoTrue `app_metadata` 上。 详见 [计划、密钥与预算](/docs/zh/concepts/plans) 与 [Stripe Webhook 参考](/docs/en/operations/stripe-webhooks)。 ## 上层应用 路由层之上的所有产品共用同一套身份、密钥包络与预算: | 产品 | 说明 | 入口 | |---|---|---| | **Studio** | 视听生成 —— 图像、视频、语音 | [/zh/studio](/zh/studio) | | **Drama** | AI 短剧生产 | [/zh/drama](/zh/drama) | | **Agents** | 健康医疗与垂直行业 Agent | [/zh/agents](/zh/agents) | | **Skills** | Agent 可调用的可复用能力 | [/zh/skills](/zh/skills) | | **MCP Gateway** | 统一的 Model Context Protocol 工具入口 | [/zh/mcp-gateway](/zh/mcp-gateway) | | **Dispike Claw** | 托管的专属智能体运行时,可绑定 IM 渠道 | [文档](/docs/zh/products/claw) | ## 数据落点 | 域 | 存储 | 说明 | |---|---|---| | 用户身份 | GoTrue Postgres | 主区域 + 加密 DR 镜像 | | 订阅 | Stripe | Stripe 托管 (美国) | | API 用量 | LiteLLM Postgres | 主区域 | | 审计日志 | 对象存储 | 主区域 + DR | 企业合同可锁定区域或要求专属部署 —— 见 [企业: 数据驻留](/docs/en/enterprise/data-residency)。 --- # 计划、密钥与预算 URL: https://dispike.com/docs/zh/concepts/plans Description: 账户如何映射到计划,密钥如何作用域化,用量如何计量。 ## 计划 Dispike 默认提供三档 + 一档企业定制: | 计划 | 月费 | 包含 | 上限 | |---|---|---|---| | Free | $0 | 基础模型、控制台 | 硬封顶,无超量 | | Pro | $29 | 全模型、优先路由 | 软封顶 + 超量 | | Max | $99 | 多席位、共享预算、审计 | 软封顶 + 超量 | | Enterprise | 议价 | SSO、定制 SLA、区域锁定、DPA | 议价 | Stripe 是计划状态的事实源。Dispike Web 应用通过 `src/lib/billing.ts` 读取,并经 `/api/billing/webhook` 镜像到 GoTrue 的 `app_metadata.plan` 字段。 ## 密钥 一把密钥 (`sk-...`) 绑定: 1. **Dispike 账户** —— 注销账户即吊销所有密钥。 2. **计划白名单** —— 仅允许当前计划的模型,越权返回 `403`。 3. **预算包络** —— LiteLLM 在准入时校验单请求成本,并累加到月度上限。 通过控制台或 [Keys API](/docs/en/api-reference/keys) 创建。可随时吊销,不影响其他密钥。 ## 预算 两个预算信号: - **单请求成本上限**。LiteLLM 在准入时拒绝预估成本超过单请求上限的请求,避免一次大 prompt 耗光月度预算。 - **月累计成本**。用量账本汇总到账户级。Free 计划达上限即硬阻断;付费计划切到超量按价目计费。 `GET /api/me/litellm-key` 返回当前包络;`/dashboard/usage` 可视化消耗。 ## 计划变更 升降级通过 Stripe Customer Portal。我们监听 `customer.subscription.updated`,秒级 (通常 <2s) 同步权益。降级在当前账单周期结束时生效,避免周期内被锁。 失败模式见 [运维: Stripe Webhook](/docs/en/operations/stripe-webhooks)。 --- # 服务等级协议 URL: https://dispike.com/docs/zh/enterprise/sla Description: 付费计划的可用性、延迟、支持响应承诺。 本 SLA 适用于付费计划。Free 计划尽力服务,无承诺。 ## 可用性 | 计划 | 月度可用性 | 抵扣 | |---|---|---| | Pro | 99.5% | 低于 99.5% 每 0.1% 抵扣 5% MRR | | Team | 99.9% | 低于 99.9% 每 0.1% 抵扣 10% MRR | | Enterprise | 99.95% (可定制) | 议价;MRR 上限 30% | 可用性按网关边缘三地探针计。提前 48h 公告的维护窗口不计;<15 分钟的紧急安全补丁不计。 ## 延迟 | 计划 | p50 | p95 | |---|---|---| | Pro | <800ms | <2000ms | | Team | <600ms | <1500ms | | Enterprise | 定制 | 定制 | 按默认模型 chat/completions 网关 → 首 Token 计。>4k 输入按比例放宽预算。 ## 支持响应 | 严重度 | Pro | Team | Enterprise | |---|---|---|---| | **S1** —— 生产宕机 | 4h | 1h | 15 分钟 | | **S2** —— 降级可用 | 下个工作日 | 4h | 1h | | **S3** —— 咨询 / 非阻塞 | 3 工作日 | 1 工作日 | 4h | S1 自动升级到 PagerDuty。Enterprise S1 含电话桥。 ## 抵扣申请 事件后 60 天内提交。下一份发票抵扣,不跨 12 个月累积。 联系 `support@dispike.com`;Enterprise 走专属客户门户。 --- # 简介 URL: https://dispike.com/docs/zh/get-started/introduction Description: Dispike 是什么、面向谁、各部分如何组合。 Dispike.com 定位为面向AI时代的智能分发与上层应用枢纽,通过高性能AI Token智能路由与多租户架构,无缝连接底层大模型与上层视听生成、健康医疗及垂直行业Agent生态,助力企业与超级个体打破技术壁垒,实现AI原生应用的敏捷部署与高效落地。 所有能力共用一个账户、一套计费,以及一个 OpenAI 兼容的 API:`https://tokenhub.dispike.com/v1`。 本文档面向开发者、超级个体、集成方与企业采购方,涵盖账户、推理 API、密钥与预算、子产品集成、部署与运维保障。 ## 适合谁 - **开发者**:基于推理网关 `https://tokenhub.dispike.com/v1` 构建应用。 - **超级个体**:一把密钥调用所有模型,直接使用现成的 Agent、Skills 与创作工具。 - **集成方**:把浏览器子产品接入统一身份 + 计费。 - **企业**:评估多租户落地、合规、SLA、数据驻留与采购流程。 - **运维**:发布、密钥轮换、Webhook 排障。 ## 包含什么 | 层级 | 作用 | 入口 | |---|---|---| | **AI Token 智能路由** | 一个 OpenAI 兼容 API 对接多家模型,支持故障回退、单请求与月度预算、虚拟密钥 | `https://tokenhub.dispike.com/v1` | | **多租户架构** | 按租户隔离的密钥、预算与用量账本,覆盖团队、客户与终端用户 | `/dashboard/keys`、`/dashboard/usage` | | **上层应用** | Studio 与 Drama (视听生成)、健康医疗与垂直行业 Agent、Skills、MCP Gateway、Dispike Claw | `/zh/studio`、`/zh/drama`、`/zh/agents`、`/zh/skills`、`/zh/mcp-gateway` | | **控制台** | 账户、计费、密钥、用量与增值服务统一管理 | `https://dispike.com/dashboard` | 各层共享一套身份 (Dispike 账户)、一套计费 (Stripe) 与一份用量账本。 ## 文档结构 - **快速开始** —— 安装、认证、首个调用。 - **核心概念** —— 账户、计划、密钥、预算、网关的心智模型。 - **产品** —— [Dispike AI 平台](/docs/en/products/ai-platform) 与 [Dispike Claw](/docs/zh/products/claw)。 - **API 参考** —— 公开端点的请求/响应样例。 - **指南** —— 任务型实战 (接入身份、上线子产品、处理 Webhook)。 - **运维** —— Runbook、发布、密钥、Stripe Webhook、测试。 - **安全与合规** —— DPA、区域、加密、审计。 - **企业版** —— 采购、定制 SLA、专享算力。 新用户从 [快速开始](/docs/zh/get-started/quickstart) 开始;接入已有应用直接看 [子产品集成](/docs/zh/guides/sub-product-integration)。 --- # 快速开始 URL: https://dispike.com/docs/zh/get-started/quickstart Description: 注册账户、获取 API Key、5 分钟内完成首个推理调用。 本页带你从零到首次收到 Dispike 推理网关的响应。 ## 1. 注册账户 1. 打开 [dispike.com/register](https://dispike.com/register)。 2. 用邮箱 + 密码注册。Resend 会发送验证邮件,点击链接后账户激活。 3. 自动跳转到 `dispike.com/dashboard`。新账户默认 **Free** 计划。 ## 2. 获取 API Key 网关使用与账户绑定的 Bearer Token。两种方式: **控制台** —— 进入 `/dashboard/keys` → **Create key** → 复制 (仅展示一次),给一个有意义的标签。 **程序化** —— 当账户已有授权时可通过 LiteLLM 管理 API 申请。详见 [Keys API](/docs/en/api-reference/keys)。 ```bash export DISPIKE_API_KEY="sk-..." ``` ## 3. 发起首次调用 网关是 OpenAI 兼容的,任意 OpenAI SDK 直接换 base URL 即可。 ```bash curl https://tokenhub.dispike.com/v1/chat/completions \ -H "Authorization: Bearer $DISPIKE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "deepseek-v4-pro-260425", "max_tokens": 1024, "messages": [{"role": "user", "content": "一句话打个招呼。"}] }' ``` Python: ```python import os from openai import OpenAI client = OpenAI( api_key=os.environ["DISPIKE_API_KEY"], base_url="https://tokenhub.dispike.com/v1", ) resp = client.chat.completions.create( model="deepseek-v4-pro-260425", max_tokens=1024, messages=[{"role": "user", "content": "一句话打个招呼。"}], ) print(resp.choices[0].message.content) ``` ## 4. 查看用量 每次请求都会落账。`/dashboard/usage` 实时展示: - 今日 / 本周期消耗 Token - 按模型拆分 - 剩余预算 Free 计划硬封顶;付费计划软封顶 + 按超量计费。完整矩阵见 [计划与定价](/docs/zh/concepts/plans)。 ## 下一步 - [概念: 计划、密钥与预算](/docs/zh/concepts/plans) - [指南: 接入子产品](/docs/zh/guides/sub-product-integration) - [API 参考: chat/completions](/docs/zh/api-reference/inference) --- # 接入浏览器子产品 URL: https://dispike.com/docs/zh/guides/sub-product-integration Description: 把任意第一方 Dispike 应用接入统一身份、计划与推理。 如何把一个新的浏览器子产品 (任何 `*.dispike.com` 子域应用) 接入 Dispike 身份 + 推理网关。 > **适用范围**:本文仅覆盖 **浏览器** 子产品 (Chromium / Firefox / Safari)。Electron 桌面应用见 [桌面集成](/docs/en/guides/desktop-integration)。 ## 前置 1. **dispike.com 子域** —— 必须服务于 `https://.dispike.com`。其他域需要在 Dispike Web 应用中配置 `XCT_CORS_EXTRA_ORIGINS` 并经过安全评审。 2. **HTTPS 生产** —— 会话 Cookie 带 `Secure`,生产 http 域不会附带。 3. **用户已有 Dispike 账户** —— 首次访问自动跳转到 `dispike.com/login`;我们不在子产品提供注册表单。 ## 第一步 —— 拉取身份包络 ```ts async function getDispikeIdentity() { const res = await fetch('https://dispike.com/api/me/litellm-key', { credentials: 'include', }); if (res.status === 401) { window.location.href = 'https://dispike.com/login?return=' + encodeURIComponent(window.location.href); return null; } return res.json() as Promise<{ key: string; plan: string; models: string[]; api_base: string; }>; } ``` 一次调用拿到 Bearer、用户计划、可用模型、网关地址。 ## 第二步 —— 发起推理 ```ts const id = await getDispikeIdentity(); if (!id) return; const res = await fetch(`${id.api_base}/chat/completions`, { method: 'POST', headers: { Authorization: `Bearer ${id.key}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ model: id.models[0], messages: [{ role: 'user', content: '你好' }], }), }); ``` ## 第三步 —— 响应计划变更 长会话请在 focus 事件或每 5 分钟刷新一次身份包络。降级后 `chat/completions` 会对已禁用模型返回 `403`,请优雅刷新 `models` 并更新 UI。 ## 常见错误 - **忘加 `credentials: 'include'`**:浏览器不带 Cookie,永远 `401`。 - **写死 `api_base`**:永远读包络。我们会迁移网关域名。 - **缓存 Bearer**:它是短期的 (吊销或计划变更会失效)。`401` 时重新拉。 - **直接调用 Stripe / GoTrue**:不要。子产品不持有任何共享密钥。 --- # Dispike Claw URL: https://dispike.com/docs/zh/products/claw Description: 属于你自己的 OpenClaw 智能体运行时——几秒内启动隔离实例并绑定 IM 渠道。 Dispike Claw 是托管的「OpenClaw」智能体运行时,作为付费插件从 Dispike 控制台提供。每个用户启动属于自己的智能体——拥有独立的记忆、技能和工具——并绑定 IM 渠道(Telegram、Discord、Slack),让终端用户在自己习惯的平台上与之对话。 > **一句话** —— 购买插件 → 点击 **Launch OpenClaw** → 粘贴 bot token。你的智能体即刻上线、数据隔离,推理花费走你现有的智能路由预算。 ## 工作原理 Dispike Claw 以**一个共享 Dispike Claw 实例**运行,由 Dispike 统一运维。控制台**不会**为每个客户单独开容器,而是持有一把 `type=user` API key,通过 `X-Fastclaw-End-User` 请求头把你开通为隔离的 **app_user**——以你的 Dispike `user.id` 为键。 ``` 控制台 ──(Bearer FASTCLAW_USER_KEY + X-Fastclaw-End-User: )──▶ Dispike Claw POST /v1/users → 铸造你的隔离 app_user POST /api/agents → 创建你的 OpenClaw 智能体 POST /api/providers → 用你的 key 把模型接到智能路由 POST /api/agents/{id}/channels/telegram → 绑定你的 bot ``` 会话、记忆、文件、智能体和渠道绑定全部按 `user.id` 分区。其他租户无法看到或访问你的智能体。 ## 快速开始 1. **购买** —— 打开 **控制台 → Dispike Claw**([/dashboard/claw](/dashboard/claw)),点击 **Purchase Dispike Claw**。这是独立订阅,与你的 Free / Pro / Team 计划相互独立。 2. **启动** —— 点击 **Launch OpenClaw**。一次调用即开通智能体,并用你现有的虚拟 key 把模型指向智能路由,推理花费走你正常的预算。 3. **绑定渠道** —— 选择 Telegram / Discord / Slack,粘贴 bot token,点击 **Connect**。Dispike Claw 会实时校验 token 并立即开始投递消息——无需重启。 4. **对话** —— 给你的 bot 发消息,智能体会带着自己的记忆和技能回复。 ## 计划与计费 访问由 `xct_claws_access` 权限控制,以下**任一**方式即可授予: - 独立的 **Dispike Claw 插件**(独立 Stripe 订阅,记录在 `app_metadata.claws_addon`),或 - 自带该权限的计划。 控制台通过 `hasClawsAccess(app_metadata)` 判定。取消插件会把 `claws_addon.active` 置为 `false`,**启动** / 渠道操作随即重新锁定——你的数据会保留。 ## 渠道 | 渠道 | 凭据 | 说明 | |---|---|---| | Telegram | [@BotFather](https://t.me/BotFather) 的 bot token | 通过 `getMe` 校验;以 bot 用户名绑定 | | Discord | bot token(开发者门户) | 通过 `/users/@me` 校验 | | Slack | bot token(`xoxb-…`) | 通过 `auth.test` 校验 | 绑定后的渠道无需重启即可上线。你可随时在控制台断开任意渠道。 ## API 参考 所有接口都需要已登录的 Dispike 会话 cookie,且账号具备 `xct_claws_access`。它们以你的隔离 app_user 身份代理到 Dispike Claw。 ### `GET /api/me/claws` 控制台状态。 ```json { "entitled": true, "configured": true, "provisioned": true, "agent": { "id": "agt_…" }, "channels": [{ "type": "telegram", "accountId": "mybot", "enabled": true }], "degraded": false } ``` ### `POST /api/me/claws/provision` 启动(或重新确认)你的 OpenClaw 实例。幂等——再次调用会复用已有智能体。 ```json { "agent": { "id": "agt_…", "name": "My OpenClaw", "model": "…" }, "app_user_id": "u_…" } ``` 账号未授权时返回 `403 claws_access_required`;开通失败返回 `502`。 ### `GET / POST / DELETE /api/me/claws/channels` - `GET` —— 列出已绑定渠道。 - `POST` `{ "type": "telegram", "botToken": "…" }` —— 绑定渠道;返回 `{ ok, type, botUsername }`。 - `DELETE` `{ "type": "telegram", "accountId": "mybot" }` —— 断开。 尚未启动智能体时返回 `409 not_provisioned`;未知渠道类型返回 `400 unsupported_channel`。 ## 数据隔离 由于每次调用都携带 `X-Fastclaw-End-User: <你的 user.id>`,Dispike Claw 会把请求重绑到从该 id 铸造的稳定内部 app_user。会话、记忆、智能体文件和渠道记录都归于该 app_user——不存在共享租户面。app_user 也无法改写用户级 provider 配置,因此无法从智能体内部篡改调用方的智能路由接线。 ## 运维须知 控制台需要三个环境变量(见 `.env.example`): ```bash CLAWS_BASE_URL=https:// # 共享 Dispike Claw 实例 FASTCLAW_USER_KEY=sk_… # 一把 type=user key(fastclaw apikey create --type user) STRIPE_PRICE_CLAWS=price_… # 插件的 Stripe 价格 ``` 部署 Dispike Claw 时设置 `FASTCLAW_BIND=all` 和 Postgres `FASTCLAW_STORAGE_DSN` 以保证持久化,并把 Stripe webhook 订阅到该插件价格,使 `customer.subscription.*` 事件能翻转 `claws_addon.active`。 ## 参见 - [接入浏览器子产品](/docs/zh/guides/sub-product-integration) —— Dispike Claw 复用的身份 + 智能路由流程。 - [计划与权限](/docs/zh/concepts/plans)