Developer Documentation

DotProd OpenAI-Compatible API Reference

← DotProd Console

1. Base URL & Virtual Key Authentication

Use any official OpenAI SDK, evaluation harness, or HTTP client by pointing base_url at /v1 with your tenant virtual key.

Endpoint Base URL: https://dotprod.tech/v1

Header: Authorization: Bearer sk-...

Virtual keys are hashed with SHA-256 and tenant-isolated. Upstream Cloudflare Workers AI and Modal/vLLM proxy credentials never leave the DotProd Worker boundary.

2. Streaming Chat Completions (Python, TypeScript, cURL)

POST /v1/chat/completions — pass stream_options.include_usage=true to receive exact uncached, cached, and output token counts on the final SSE frame.

Python (openai SDK)


          

cURL (SSE Stream + Session Continuity)


          

3. Hybrid Routing (Workers AI + Modal/vLLM) & Stripe Webhooks

Built-in operational endpoints for upstream GPU clusters and Stripe Checkout settlement.

  • Workers AI Default: private-model and private-model-fast execute directly on Cloudflare Workers AI at the edge.
  • Modal / vLLM GPU Routing: Register any .modal.run/v1 or .modal.direct/v1 endpoint in Owner Console with a wk-... .ws-... token to authenticate automatically via Modal-Key and Modal-Secret.
  • Stripe Webhook Endpoint: Point Stripe webhooks at https://dotprod.tech/billing/webhooks/stripe for checkout.session.completed, checkout.session.async_payment_succeeded, charge.refunded, charge.dispute.created, and charge.dispute.closed.

4. Durable Object Credit Reservations, Guardrails & Error Codes

Each tenant is backed by a single-threaded SQLite Durable Object (TenantLedgerDO) that prevents concurrent overspend near zero balance.

  • Uncached vs. Cached Input — Prefix-cached prompt tokens are metered separately in GET /usage (preserving null when upstream omits cache telemetry).
  • 400 Bad Request — Guardrail content policy intervention (content_blocked) or unsupported non-text/tool bypass payload.
  • 401 Unauthorized — Missing, invalid, blocked, or revoked virtual API key.
  • 402 Payment Required — Available prepaid credit balance in TenantLedgerDO is below the conservative request reservation ceiling.
  • 403 Forbidden — Requested model is not enabled for your tenant, or the tenant account is suspended.
  • 429 Too Many Requests — Per-tenant sliding-window RPM rate limit or max_budget policy ceiling reached.