Référence API · Router

Une API unique pour 40+ modèles IA, avec Guard anti-exfiltration.

Router remplace api.openai.com par une URL unique qui route vers Anthropic, OpenAI, Google, Cohere, Mistral et plus. Guard filtre les PII, secrets et tokens avant l'envoi. Facturation unique en CAD.

Version
0.107.8
Base URL
router.signalorange.ca
Authentification
Bearer token
Formats
JSON · SSE
Authentification

Bearer token sur chaque requête

Générez une clé API depuis votre tableau de bord Meridian, puis passez-la dans l'en-tête Authorization de chaque requête.

headers · auth
Authorization: Bearer $ROUTER_API_KEY\nContent-Type: application/json
  1. 1 Connectez-vous à votre tableau de bord Meridian: https://meridian.signalorange.ca/login.
  2. 2 Paramètres → Clés API → Nouvelle clé. Donnez-lui un nom (ex. production), puis copiez-la immédiatement — elle ne sera plus affichée.
  3. 3 Stockez-la comme variable d'environnement (ROUTER_API_KEY), dans un gestionnaire de secrets, ou dans votre .env local.
Endpoints

Référence par fonctionnalité

Extraite automatiquement depuis la spec OpenAPI servie à /api/router/docs/spec.json. Toute modification dans les contrôleurs se reflète ici dès la prochaine requête.

API Keys

GET /api/router/v1/api_keys

List API keys for the authenticated organization

Returns all active + revoked keys belonging to your organization. The secret token is never returned.

Réponses
  • 200 API keys
POST /api/router/v1/api_keys

Create a new API key

Creates a new API key attached to the authenticated organization + the user associated with the calling key. Response includes the **raw token** in the `key` field — **this is the only time it is returned.** Store it immediately. A standard-scope calling key cannot create super_admin keys.

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 201 Created
  • 403 Scope escalation blocked
  • 422 Validation error
DELETE /api/router/v1/api_keys/{id}

Revoke an API key (soft delete)

Sets is_active=false on the key. Audit history is preserved; the key can no longer authenticate any request.

Paramètres
  • id path integer requis —
Réponses
  • 200 Revoked
  • 404 Not found
PATCH /api/router/v1/api_keys/{id}

Update an API key (name, expires_at only)

Only `name` and `expires_at` are mutable via the API. Scope and user_id are immutable.

Paramètres
  • id path integer requis —
Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Updated
  • 404 Not found
  • 422 Validation error

Audit

GET /api/router/v1/audit

List recent Guard audit entries

Returns the most recent Guard audits for the authenticated organization, newest first. Supports pagination + filtering. ## Query parameters - `limit` — max rows (default 50, cap 500) - `offset` — skip N (for pagination) - `halted_only` — `true` to only return blocked requests - `min_severity` — `critical|high|medium|low`; at least one detection at or above this level - `from` — ISO-8601 lower bound on inserted_at (inclusive) - `to` — ISO-8601 upper bound (exclusive)

Paramètres
  • limit query integer — Default 50, max 500
  • offset query integer —
  • halted_only query boolean —
  • min_severity query string —
  • from query string — ISO-8601 datetime
  • to query string — ISO-8601 datetime
Réponses
  • 200 Audit entries
GET /api/router/v1/audit/{request_id}

Get a Guard audit entry by request_id

Returns the Guard audit row for a specific Router request. `request_id` is the `generation_id` returned in the chat/completions response (available at `result.guard.request_id`) or the `stream-...`/`halt-...` id generated internally for streaming or halted requests. 404 if not found or if the audit belongs to a different organization.

Paramètres
  • request_id path string requis — The Router generation_id / audit request_id
Réponses
  • 200 Audit entry with detections
  • 404 Audit not found

Billing

GET /api/router/v1/billing/balance

Current credit balance

Returns your organization's prepaid credit balance in CAD cents.

Réponses
  • 200 Balance
GET /api/router/v1/billing/models

List available models

Returns every model routable through Router for your organization, with provider and pricing tier. Unrestricted organizations (default) see the whole synced OpenRouter catalog; restricted organizations only see their platform models.

Réponses
  • 200 Models
GET /api/router/v1/billing/usage

Usage summary

Returns aggregated usage and a per-model breakdown for the current organization.

Réponses
  • 200 Usage

Chat

POST /api/v1/chat/completions

Chat completions (OpenAI-compatible)

Generate a chat completion. Drop-in replacement for `POST https://api.openai.com/v1/chat/completions`. Routes the request through Meridian's Router with Guard anti-exfiltration enabled. Supports `auto` model selection (Router picks the cheapest model meeting your quality bar) or an explicit model id (e.g. `claude-sonnet-4`, `gpt-5`). Set `stream: true` to receive server-sent events with OpenAI-compatible `chat.completion.chunk` payloads terminated by `data: [DONE]`.

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Completion result (non-streaming) or SSE stream (streaming)
  • 402 Insufficient credits
  • 403 AI not enabled for organization
  • 429 Rate limited
  • 502 Upstream provider error
POST /api/v1/chat/completions/estimate

Estimate cost of a chat completion (preflight, no upstream call)

Returns the expected CAD cost of a chat completion without actually calling the upstream model. Uses a `char_count/4` heuristic for prompt tokens and the request's `max_tokens` as the completion budget. Useful for UI budget checks or for clients that need to price per request before consenting to the actual call. Pricing reflects the organization's current markup + FX rate.

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Estimate

Classify

POST /api/v1/classify

Classify text against labels (typesafe/jev-router)

Deterministic classification with scores. `single` returns probabilities summing to 1; `multi` returns independent 0..1 scores; `binary` answers a yes/no question. Billed at the real cost of the underlying scoring call.

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Classification result

Embeddings

POST /api/v1/embeddings

Create embeddings (OpenAI-compatible)

Generate vector embeddings for a string or a list of strings. Drop-in replacement for `POST https://api.openai.com/v1/embeddings`. Default model is `openai/text-embedding-3-small`. Specify `model` explicitly to use another embeddings model (e.g. `openai/text-embedding-3-large`, `cohere/embed-multilingual-v3.0`).

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Embeddings result
  • 402 Insufficient credits
  • 403 AI not enabled for organization
  • 429 Rate limited
  • 502 Upstream provider error

Models

GET /api/v1/models

List available models (OpenAI-compatible)

Returns the Router model catalog for your organization in OpenAI's list format. Use this endpoint from SDKs that call `client.models.list()`; the richer `/billing/models` endpoint stays available with Meridian-specific fields (tier, display_name, etc.). By default every synced OpenRouter model is listed. An organization can restrict its Router surface to its platform models (`/router/settings/ai`) — restricted orgs only see platform-active models here. Beyond the OpenAI fields (`id`, `object`, `created`, `owned_by`), each entry carries `context_length` (tokens, `null` when unknown), `pricing` (input/output CAD per 1M tokens with your org's markup + FX applied, `null` when the model is unpriced) and `supported_parameters` (what Router accepts for this model).

Réponses
  • 200 Model list

Tools

POST /api/v1/tools/fetch

Fetch a URL as raw text (Artemis enrichment)

Fetches a public `http(s)` URL server-side and returns its integral raw text (tags stripped, never summarized — numbers and units kept as-is), truncated at `max_chars`. HTML yields `title` + absolute `images`; PDFs yield `text` + `pages`. A distant 4xx/5xx returns `200` with the distant `status` and `text: ""`.

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Fetched page
POST /api/v1/tools/web_search

Web search (Artemis enrichment)

Runs a server-side web search and returns ranked results (`url`, `title`, `snippet`) plus a `billing` cost computed like LLM usage (provider USD cost through the org markup + FX). The backend is env-configurable; without a key the stub backend returns zero results.

Corps de la requête

application/json — voir la spec pour le schéma complet.

Réponses
  • 200 Search results

Besoin d'un SDK ou d'une clé API ?

Router est compatible avec les SDK OpenAI officiels (Python, Node, Go) — changez simplement base_url. Pour un accès, écrivez-nous.

[email protected] →