RUNToken GATEWAY

API Reference

OpenAI-compatible model calls, plus RunToken’s own APIs for accounts, billing, channels and the model catalog.

Base URLhttps://api.ontosphere.ai

Authentication

Inference and the model catalog use an API key: Authorization: Bearer rt-.... Keys issued under the interim sk- prefix keep working. A key is shown once, when it is created, and can never be read again. Revoking or disabling it takes effect on its next request. Account management uses the JWT returned by registration or sign-in. Registration and sign-in need no credential of their own, and the billing webhook is verified by the provider’s signature.

User account

POST/v1/auth/register

Open an account, with its credit account and a first API key.

Public
POST/v1/auth/login

Exchange email and password for a JWT.

Public
GET/v1/me

Read the current account: {user, orgs:[{orgId,name,role}]}.

JWT
GET/v1/keys?orgId=…

List personal API keys, or an organization’s with orgId.

JWT
POST/v1/keys

Create keys with {name, orgId?, expiresAt?, monthlyQuotaCredits?, allowedModels?, quantity?}. A key belongs to the personal account by default; name an organization and its usage is charged to that organization’s shared balance. allowedModels takes exact catalog model ids and vendor/* wildcards (omit it, or pass ["*"], for every model); any other model is refused with 403 model_not_allowed. A quantity above one returns {data:[…]}. This response is the only time a key’s secret is shown.

JWT
PATCH/v1/keys/:id

Rename, disable or re-enable a key, or change its expiry, quota or allowed models.

JWT
DELETE/v1/keys/:id

Revoke one of the caller’s API keys.

JWT

Organizations

Every user has a personal account. Organizations are optional: members share the organization’s own balance, quota, usage and invoices. Without an orgId, keys and billing act on the personal account.

POST/v1/orgs

Create an organization with {name}; the creator becomes its owner.

JWT
GET/v1/orgs

List the organizations the caller belongs to, with their role.

JWT
GET/v1/orgs/:orgId/members

List an organization’s members; the caller must be one.

JWT
POST/v1/orgs/:orgId/members

Add an existing user with {email, role}; owner or admin only.

JWT

Models & inference

GET/v1/models

List the enabled models this key may call, their providers and customer prices.

API Key
GET/v1/catalog

The same catalog for a signed-in session, which the console browses.

JWT
POST/v1/chat/completions

Create an OpenAI-style chat completion, streaming over SSE if asked.

API Key

Billing

POST/v1/billing/topup

Create a top-up intent with {amount, currency?, orgId?}; the personal account by default.

JWT
POST/v1/billing/webhook

Receive the billing provider’s callback.

Signature
GET/v1/billing/balance?orgId=…

Read the personal balance. A JWT may pass orgId for an organization’s; an organization’s API key reads its own.

JWT / API Key
GET/v1/billing/usage?from=…&to=…&orgId=…

Summarize usage over a period, for the personal account or an organization.

JWT
GET/v1/billing/invoices?orgId=…

List invoices, personal or for an organization.

JWT
POST/v1/billing/invoices

Generate an invoice for a period with {from, to, orgId?}.

JWT

Resellers & affiliates

Apply to become a reseller; a RunToken administrator approves the application and sets the commission rate, a share of RunToken’s markup on referred usage. A user is attributed to a reseller when their account is created: pass referralCode to /v1/auth/register, or start Google sign-in at /v1/auth/google/start?ref=CODE. Attribution is permanent, and a reseller never earns commission on their own usage.

POST/v1/resellers

Apply to become a reseller; the application starts pending.

JWT
POST/v1/resellers/referrals

Create a referral code (approved resellers): 4–32 letters, digits, - or _, unique regardless of case.

JWT
GET/v1/resellers/referrals

List the caller’s codes and how many users each referred.

JWT
GET/v1/resellers/commissions

List accrued or paid commissions.

JWT
GET/v1/resellers/summary

Status, rate, referred users and commission totals.

JWT
GET/v1/admin/resellers?status=…

List resellers with their referrals and commission.

Platform-admin JWT
PATCH/v1/admin/resellers/:resellerId

Approve, suspend or reject, and set the rate: {status?, commissionPct?}.

Platform-admin JWT
POST/v1/admin/resellers/:resellerId/payouts

Record that the accrued commission was paid: Idempotency-Key header, {amountCredits, reference?}.

Platform-admin JWT
GET/v1/admin/resellers/:resellerId/payouts

List a reseller’s payouts and who recorded them.

Platform-admin JWT

Admin API

Every /v1/admin/* endpoint requires a platform-admin JWT. A user becomes isPlatformAdmin through PLATFORM_ADMIN_EMAILS.

POST/v1/admin/providers

Create a provider.

Platform-admin JWT
GET/v1/admin/providers

List providers.

Platform-admin JWT
PATCH/v1/admin/providers

Update a provider.

Platform-admin JWT
POST/v1/admin/models

Create a model.

Platform-admin JWT
GET/v1/admin/models

List models.

Platform-admin JWT
PATCH/v1/admin/models

Update a model.

Platform-admin JWT
POST/v1/admin/models/:id/deployments

Attach a provider deployment to a model.

Platform-admin JWT
GET/v1/admin/models/:id/deployments

List a model’s deployments.

Platform-admin JWT
POST/v1/admin/models/:id/pricing

Add a pricing period for a model.

Platform-admin JWT
GET/v1/admin/models/:id/pricing

List a model’s pricing periods.

Platform-admin JWT
GET/v1/admin/users?limit=…&offset=…&q=…

Search and paginate platform users.

Platform-admin JWT
PATCH/v1/admin/users/:userId

Set a user’s status: {status:"active"|"suspended"}.

Platform-admin JWT
POST/v1/admin/users/:userId/credits

Adjust a user’s credits: {amount, reason?}.

Platform-admin JWT
GET/v1/admin/orgs

List every organization.

Platform-admin JWT
PATCH/v1/admin/orgs/:orgId

Enable or disable an organization: {status:"active"|"disabled"}. A disabled organization’s keys are refused and it cannot be managed.

Platform-admin JWT
POST/v1/admin/orgs/:orgId/credits

Adjust an organization’s shared credits: {amount, reason?}.

Platform-admin JWT
GET/v1/admin/stats?days=…

Platform statistics over a number of days.

Platform-admin JWT
GET/v1/admin/invoices?status=…

List invoices, optionally filtered by status.

Platform-admin JWT
GET/v1/admin/receivables

Receivables, totalled per user.

Platform-admin JWT