API Bələdçisi
API Reference
Base URL: …. Gateway auth is Authorization: Bearer nxr_live_…. Platform endpoints use the session cookie. Errors always follow {error:{message,type,code}} with an X-Request-Id header.
| Method | Path | Description |
|---|---|---|
| GET | /v1/models | List models available to your API key (OpenAI shape). |
| POST | /v1/chat/completions | Chat completion, OpenAI-compatible. stream=true for SSE. |
| POST | /v1/embeddings | Embeddings — 400 when no configured provider supports them. |
| GET | /v1/usage | Your usage totals (API key auth). |
| GET | /api/models | Public model catalog with pricing. |
| GET | /api/status | Public provider health. |
| POST | /api/auth/register | DISABLED — returns 403. Registration is Google sign-in only; use POST /api/auth/google. |
| POST | /api/auth/login | Login — sets the HttpOnly nexora_session cookie (7 days). |
| GET | /api/auth/me | Current user. |
| POST | /api/auth/logout | Revoke the session and clear the cookie. |
| GET | /api/keys | List your API keys (masked). Create returns the full key once. |
| POST | /api/keys | Create an API key. |
| DELETE | /api/keys/{id} | Revoke an API key. |
| GET | /api/wallet | Wallet balance. |
| GET | /api/wallet/transactions | Wallet transactions (paginated). |
| POST | /api/wallet/deposit-request | Manual deposit request (admin review). method must be manual. |
| POST | /api/wallet/redeem-promo | Redeem a promo code (once per user). |
| GET | /api/usage?range=24h|7d|30d|custom | Usage totals, per-model breakdown, daily series. |
| GET | /api/usage/requests | Paginated request log. |
| POST | /api/playground/chat | Session-auth chat through the gateway (same billing). |
Billing
Cost = input_tokens / 1,000,000 × input price + output_tokens / 1,000,000 × output price, using the model's published pricing. The amount is deducted from your wallet after a successful response. The gateway checks your balance is at least $0.0001 before forwarding; insufficient balance returns 402. If a provider reports no usage, tokens are recorded as 0 and no charge is made. Rate limit: 60 requests/min per API key (429 with Retry-After). Zero providers: /v1/models returns an empty list and chat returns 503 no_provider.