/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
-
200API keys
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.
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.
Authorization: Bearer $ROUTER_API_KEY\nContent-Type: application/json
production), puis copiez-la immédiatement — elle ne sera plus affichée.
ROUTER_API_KEY), dans un gestionnaire de secrets, ou dans votre
.env
local.
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/router/v1/api_keys
Returns all active + revoked keys belonging to your organization. The secret token is never returned.
200
API keys
/api/router/v1/api_keys
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.
name
string
requis
— Human-friendly identifier
expires_at
string
— Optional — ISO-8601 expiration date
scope
string
201
Created
403
Scope escalation blocked
422
Validation error
/api/router/v1/api_keys/{id}
Sets is_active=false on the key. Audit history is preserved; the key can no longer authenticate any request.
id
path
integer
requis
—
200
Revoked
404
Not found
/api/router/v1/api_keys/{id}
Only `name` and `expires_at` are mutable via the API. Scope and user_id are immutable.
id
path
integer
requis
—
expires_at
string
name
string
200
Updated
404
Not found
422
Validation error
/api/router/v1/audit
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)
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
200
Audit entries
/api/router/v1/audit/{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.
request_id
path
string
requis
— The Router generation_id / audit request_id
200
Audit entry with detections
404
Audit not found
/api/router/v1/billing/balance
Returns your organization's prepaid credit balance in CAD cents.
200
Balance
/api/router/v1/billing/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.
200
Models
/api/router/v1/billing/usage
Returns aggregated usage and a per-model breakdown for the current organization.
200
Usage
/api/v1/chat/completions
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]`.
messages
array
requis
— Conversation messages, oldest first. `content` can be a string or an array of parts (vision multimodal).
max_tokens
integer
model
string
— Model id (e.g. `claude-sonnet-4`, `gpt-5`) or `auto`
no_retention
boolean
— When `true`, Router skips prompt persistence (Guard audit) and asks the provider not to retain or train on the request (`provider.data_collection = deny`). Models that cannot guarantee this are rejected with HTTP 400 instead of being served. Same effect via the `X-No-Retention: true` header.
response_format
object
— Set `{"type": "json_object"}` for JSON mode, or `{"type": "json_schema", "json_schema": {"name": ..., "schema": {...}}}` for structured outputs. `json_schema` is enforced natively on OpenAI/Anthropic models and server-validated (HTTP 422 `schema_validation_failed`) on the others.
response_format.json_schema
object
— Required when `type` is `json_schema`
response_format.type
string
stream
boolean
— When `true`, the response is streamed as Server-Sent Events with OpenAI-compat chunks
strict
boolean
— When `true`, disables Router's automatic model fallback. If the requested model is unavailable, the request fails (HTTP 502) instead of silently falling back to an alternative.
system
string
— System prompt (alternative to embedding in messages)
temperature
number
tool_choice
any
— How the model picks tools: `"none"`, `"auto"`, `"required"`, or `{"type": "function", "function": {"name": "..."}}`
tools
array
— Array of tool/function definitions available to the model (OpenAI-compat). `{"type": "web_search"}` and `{"type": "fetch"}` are Router server tools: executed by the Router during the conversation, reported in `tool_executions`.
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
/api/v1/chat/completions/estimate
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.
messages
array
requis
max_tokens
integer
model
string
system
string
200
Estimate
/api/v1/classify
Deterministic classification with scores. `single` returns probabilities summing to 1; `multi` returns independent 0..1 scores; `binary` answers a yes/no question (`score` = probability of yes). Billed at the real upstream cost of the Jev decisions call.
input
string
requis
mode
string
requis
model
string
requis
options
array
— 1..255 entries. Required in single/multi mode.
question
string
— Requis en mode `binary` : question fermée (oui/non) posée sur `input`. La réponse donne `answer` (booléen) et `score` = probabilité de « oui ». Ignoré en mode single/multi.
Exemple
{
"input": "Disjoncteur QO120 20 A 1 pôle",
"mode": "binary",
"model": "~typesafe/jev-latest",
"question": "Ce produit est-il un disjoncteur ?"
}
200
Classification result
/api/v1/embeddings
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`).
input
any
requis
— String or array of strings to embed
model
string
— Embeddings model id
200
Embeddings result
402
Insufficient credits
403
AI not enabled for organization
429
Rate limited
502
Upstream provider error
/api/v1/models
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).
200
Model list
/api/v1/tools/fetch
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: ""`. Optional enrichment: `main_content` keeps only the main content in `text`; `structured_data` adds `structured_data.products[]` read from the received HTML; `document_links` adds the page's PDF links (spec sheets, guides, certificates); `highlights` adds verbatim passages for `query`; `summary` adds a schema-conformant object built from the page only. Without these parameters the response is identical to the legacy one. Enriched results are cached ~24 h (a cache hit is free) and `billing.cost_cad` sums transfer + Exa + LLM. The summary never fails the fetch: at worst `summary: null` with `summary_error`.
url
string
requis
— Public http(s) URL to fetch
document_links
boolean
— Ajoute `document_links: [{url, text}]` : liens PDF de toute la page (pas seulement du contenu principal), chemin en `.pdf` ou `type="application/pdf"`. `url` absolue (résolue contre `final_url`), sans fragment ni doublon ; `text` = texte du lien, sinon `title` ou `aria-label`, sinon `null`. Ordre de la page, 50 au plus ; `[]` pour un PDF lu directement ou une page distante en erreur.
highlights
object
— Ajoute `highlights: [string]` : passages copiés mot pour mot, les plus pertinents pour `query`.
highlights.query
string
requis
— Ce que les passages doivent couvrir
highlights.max_chars
integer
— Total maximal de caractères des passages
main_content
boolean
— Contenu principal seulement dans `text` (sans navigation, en-tête, pied de page, barres latérales ni bandeau de témoins). Exa /contents, sinon extraction locale.
max_chars
integer
— Max characters of returned text (default 200000)
render_js
boolean
— JS rendering is NOT supported (true → 400)
structured_data
boolean
— Ajoute `structured_data.products[]` lus dans le HTML reçu (JSON-LD avec @graph et ProductGroup/hasVariant, microdonnées, RDFa, OpenGraph) : {name, brand, mpn, sku, model, product_id, gtins, description, url, image, variants[]}. GTIN en chiffres seulement ; variantes seulement dans `variants`.
summary
object
— Ajoute `summary` conforme à `schema` (JSON Schema strict, racine `object`). Un nouvel essai au plus ; ensuite `summary: null` et `summary_error`. Le fetch n'échoue jamais à cause du résumé.
summary.schema
object
requis
— JSON Schema strict de la sortie
summary.query
string
— Ce que le résumé doit couvrir
Exemple
{
"document_links": true,
"highlights": {
"max_chars": 1500,
"query": "ampérage pouvoir de coupure dimensions"
},
"main_content": true,
"max_chars": 20000,
"structured_data": true,
"summary": {
"query": "Caractéristiques techniques du disjoncteur",
"schema": {
"additionalProperties": false,
"properties": {
"amperage_a": {
"type": [
"number",
"null"
]
},
"interrupting_rating_ka": {
"type": [
"number",
"null"
]
},
"poles": {
"type": [
"integer",
"null"
]
}
},
"required": [
"amperage_a",
"poles",
"interrupting_rating_ka"
],
"type": "object"
}
},
"url": "https://www.exemple-distributeur.ca/produits/qo120"
}
200
Fetched page
/api/v1/tools/web_search
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.
query
string
requis
country
string
— Country code hint (default ca)
lang
string
— Optional result language hint
max_results
integer
— Number of results (1..10, default 8)
200
Search results
Router est compatible avec les SDK OpenAI officiels (Python, Node, Go) —
changez simplement base_url. Pour un accès, écrivez-nous.