# score-centering Hosted training observability for policy gradients. The service records five scalar aggregate metrics per training step and exposes them through a small v1 HTTP API. ## Core invariants - Each run belongs to one tenant (org). Tokens and sessions are tenant-scoped; a caller can only see its own org's runs. - All `/v1` endpoints, including billing, use `Authorization: Bearer `. Browser billing forms at `/app/billing/*` use the `sc_session` cookie instead, require an exact-match `Origin` header and an owner role, and redirect to Stripe. - Ingest accepts 1..=1024 samples per batch. `step` is an integer; the five metric fields (`mean_q_head_mass`, `mean_p_head_mass`, `mean_rho`, `mean_correction`, `epsilon_floor_rate`) are finite numbers. - Writes require an active or trialing subscription and available tier limits; reads remain available for read-only billing states. ## Privacy boundary Only scalar aggregates are stored and returned. We do not collect, store, or expose tensors, logprobs, token IDs, prompts, or completions. `config_json` and `tags_json` are opaque caller-managed strings, not model outputs. Error responses contain a fixed code and optional client-safe detail, never provider internals or secrets. ## Endpoints | Method | Path | Auth | Purpose | | --- | --- | --- | --- | | POST | `/v1/runs` | bearer | Create a run with `name`, optional `config_json` and `tags_json`. | | GET | `/v1/runs` | bearer | List runs in the authenticated org. | | POST | `/v1/tokens` | bearer | Create an API token; plaintext is returned once. | | POST | `/v1/ingest` | bearer | Ingest `run_id` and `samples` (`step` plus five scalar metrics). | | GET | `/v1/runs/{id}/summary` | bearer | Read metadata, latest sample, series, and alerts. | | GET | `/v1/runs/{id}/metrics` | bearer | Query scalar series with `from`, `to`, and `limit` (default 1000, clamped to 1..=10000). | | POST | `/v1/billing/checkout` | bearer | Start a Stripe-hosted Checkout session with `tier` and `cycle`. | | POST | `/v1/billing/portal` | bearer | Open the Stripe-hosted Customer Portal. | | POST | `/app/billing/checkout` | sc_session | Browser form behind `Origin` and owner checks; redirects to Stripe Checkout. | | POST | `/app/billing/portal` | sc_session | Browser form behind `Origin` and owner checks; redirects to Stripe Portal. | | POST | `/v1/stripe/webhook` | stripeSignature | Provider-only Stripe callback, authenticated by the Stripe-Signature header, not bearer; not for API consumers. Path is configured by `STRIPE_WEBHOOK_PATH`. | ## Billing states - `active` and `trialing`: writes allowed; tier limits apply. - `past_due` and `canceled`: read-only; writes return `402 payment_required`. - No subscription: read-only. ## Tiers - Starter: $29/month or $278/year; 5 runs, 7-day retention, 1 seat. - Pro: $99/month or $950/year; 50 runs, 30-day retention, 5 seats. - Team: $299/month or $2870/year; unlimited runs, 90-day retention, 20 seats. ## Links - [OpenAPI 3.1 spec](/openapi.json) - [Home](https://scorecentering.com/) - [Sign up](https://scorecentering.com/signup) - [crates.io](https://crates.io/crates/score-centering)