resources/llm.ts
Source: sdks/typescript/packages/sdk/src/resources/llm.ts. Back to the TypeScript SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class ProvidersResource
LLM and Model Gateway. Model providers, the model registry, routing rules and the Model Gateway: the only path agents and applications use to call models.
Resource
ProvidersResource.catalog
catalog(opts?: CallOptions)
Read the provider catalog. Every provider type the platform supports, with the fields and credentials it needs, labels in the language of the request, the configured providers of each type, and how its models are found (api: listing API, manual_only: typed by the administrator). Requires a reader role.
Route: /v1/providers/catalog (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.create
create(body: Doc, opts?: CallOptions)
Create a model provider. Creates a provider for the tenant, or a shared one with scope: platform (platform_admin only), and answers 201 without the credentials. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/providers (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | provider_type (or type, a catalog type or alias), optional name (default the type), api_base (or base_url), config, credentials (secret fields), regions, retention, scope (platform for a shared provider). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.delete
delete(id: string, opts?: CallOptions)
Delete a model provider. Deletes the provider and answers 204; a shared provider needs platform_admin (403 platform_only). Audited (provider.delete). Unknown or invisible provider: 404 provider_not_found. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/providers/{pid} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.disable
disable(id: string, opts?: CallOptions)
Disable a provider (kill switch). Kill switch of the provider: the gateway refuses its models at once (403 provider_disabled) and discovery is refused (409). A shared provider needs platform_admin. Audited (provider.disable). Requires tenant_admin, platform_admin, ai_platform_engineer or security_officer.
Route: /v1/providers/{pid}/disable (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.discoverModels
discoverModels(id: string, opts?: CallOptions)
Discover the models of a provider. Models the configured provider really serves, from its own listing API with the stored credentials and through the outbound guard (never a made up list). Each candidate carries what the provider returns (context window, maximum output, modalities, prices) completed with platform hints, a suggested registry id and category, and whether it is already registered; up to 1000 candidates. Providers without a listing API answer manual_only. A disabled provider answers 409 provider_disabled. Audited (provider.discover). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/providers/{pid}/models/discover (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.enable
enable(id: string, opts?: CallOptions)
Enable a disabled provider. Lifts the kill switch of the provider. A shared provider needs platform_admin. Audited (provider.enable). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/providers/{pid}/enable (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.get
get(id: string, opts?: CallOptions)
Get a configured provider. One provider without its credentials. A provider of another tenant, or an id that is not a UUID, answers 404 provider_not_found. Requires a reader role.
Route: /v1/providers/{pid} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.list
list(params?: ListParams, opts?: CallOptions)
List the configured providers. Shared providers and the providers of the caller's tenant, with their type, address, configuration, regions, retention, state and last test; credentials are never returned (only the names of the fields that are set). Requires a reader role.
Route: /v1/providers (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
params | ListParams | no | Extra fields merged into the request. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.test
test(id: string, opts?: CallOptions)
Test a provider connection. Calls the listing endpoint of the provider with its stored credentials (for signed protocols such as Bedrock and Vertex, checks that the credential set is complete) and answers ok, the HTTP status, a detail and the models seen. The result is stored as the connection state and audited (provider.test). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/providers/{pid}/test (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ProvidersResource.update
update(id: string, body: Doc, opts?: CallOptions)
Update a model provider. Changes the configuration, address, regions, retention or credentials of a provider. New credentials are written to the secret store and reset the connection state until the next test. A remote address must use TLS (422 tls_required) and pass the outbound address rules; an unknown credential field answers 422. A shared provider needs platform_admin. Audited (provider.update, without values). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/providers/{pid} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier (UUID) of the provider. | |
body | Doc | yes | Fields to change: config, api_base (or base_url), credentials (secret fields; a secret field sent in config is moved to them), regions, retention. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Type alias ModelStatus
Status of a registered model: approved, restricted, deprecated or blocked.
Definition: "approved" \| "restricted" \| "deprecated" \| "blocked".
Class ModelsResource
LLM and Model Gateway. Model providers, the model registry, routing rules and the Model Gateway: the only path agents and applications use to call models.
Resource
ModelsResource.create
create(body: Doc, opts?: CallOptions)
Register a model. Registers a model for the tenant, or a shared one with scope: platform (platform_admin only), and answers 201. The body is a Model Manifest v1 or a bare spec; it must be valid (422 invalid_manifest) and its category must exist. A model id already registered in the same scope answers 409 model_exists. Audited (model.create). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/models (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | A Model Manifest v1 (kind: Model, metadata, spec) or the spec alone (model_id, provider, provider_model_id, capabilities, context_window, status...), with the sheet fields, optional pricing and scope. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.createCategory
createCategory(body: { slug: string; label: { en: string; fr: string } } & Doc, opts?: CallOptions)
Create a model category. Creates a category for the tenant, or a shared one with scope: platform (platform_admin only, 403 platform_only), and answers 201. A slug already used answers 409 category_exists; invalid fields 422 parameter_invalid. Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/llm/categories (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | { slug: string; label: { en: string; fr: string } } & Doc | yes | slug (lowercase letters, digits, dashes and underscores, 1 to 40 characters, required), label (text or {en, fr}, 80 characters at most, required), description (500 characters at most), icon, sort_order (0 to 10000, default 100), scope (platform for a shared category). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.createVersion
createVersion(modelId: string, body: Doc, opts?: CallOptions)
Register a model version. Registers a version of the model in the tenant with status draft and answers 201. The version needs a licence (SPDX expression, or terms reference starting with https:// or LicenseRef-) and the weights provenance; invalid fields answer 422 model_version_invalid with their names, an existing version 409 model_version_exists. Audited (model.version.create). Requires a tenant principal with tenant_admin or platform_admin.
Route: /v1/models/{model_id}/versions (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
body | Doc | yes | version (1 to 64 characters: letters, digits, dots, dashes, underscores, plus), licence_spdx or licence_terms_ref, weights with source (https://, oci://, hf://, s3:// or registry://), digest (sha256: and 64 hex characters) and size_bytes (positive integer), optional capabilities (list of texts). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.delete
delete(modelId: string, opts?: CallOptions)
Delete a model from the registry. Deletes the tenant entry of the model (an override of a shared model brings the shared entry back), or the shared entry when there is no tenant entry; the shared entry needs platform_admin (403 platform_only). Answers 204; audited (model.delete). Unknown model: 404 model_not_found. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/models/{model_id} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model (not the provider model id). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.deleteCategory
deleteCategory(slug: string, opts?: CallOptions)
Delete a model category. Deletes a category created by the tenant or the platform and answers 204. A predefined category cannot be deleted (409 category_builtin), nor a category still used by a model (409 category_in_use); a shared category needs platform_admin (403 platform_only). Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/llm/categories/{slug} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
slug | string | yes | Slug of the category: lowercase letters, digits, dashes and underscores, 1 to 40 characters. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.disable
disable(modelId: string, opts?: CallOptions)
Disable a model (kill switch). Kill switch of the model for the tenant: the gateway refuses it at once (403 model_disabled). On a shared model this creates a tenant override. Audited (model.disable). Requires tenant_admin, platform_admin, ai_platform_engineer or security_officer.
Route: /v1/models/{model_id}/disable (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.enable
enable(modelId: string, opts?: CallOptions)
Enable a disabled model. Lifts the kill switch of the model for the tenant. Audited (model.enable). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/models/{model_id}/enable (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.get
get(modelId: string, opts?: CallOptions)
Get a registered model. One model of the registry, or its Model Manifest v1 with format=manifest. Unknown model: 404 model_not_found. Requires a reader role.
Route: /v1/models/{model_id} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.getCategory
getCategory(slug: string, opts?: CallOptions)
Get a model category. One model category with its number of models. Unknown slug: 404 category_not_found. Requires a reader role.
Route: /v1/llm/categories/{slug} (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
slug | string | yes | Slug of the category. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.importModels
importModels(body: { provider_id: string; models: Doc[] } & Doc, opts?: CallOptions)
Import discovered models. Registers the models chosen in a discovery. Idempotent: the ones already registered (same id, or same provider and provider model id) are skipped and listed with already_registered. Every item is checked first; one invalid item refuses the whole import with 422 import_invalid and the problem of each item. Each model and the import are audited. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/models/import (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | { provider_id: string; models: Doc[] } & Doc | yes | provider_id (provider id or name, required), models (1 to 200 objects from the discovery: provider_model_id and the optional registry id, category and sheet fields), optional scope (platform). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.iterate
iterate(params?: ListParams, opts?: CallOptions)
List the registered models. Models visible to the caller (shared models with the tenant overrides applied, and the tenant models), optionally filtered. One page only (next_cursor is always null). Requires a reader role.
Route: /v1/models (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
params | ListParams | no | Extra fields merged into the request. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.list
list(params?: ListParams, opts?: CallOptions)
List the registered models. Models visible to the caller (shared models with the tenant overrides applied, and the tenant models), optionally filtered. One page only (next_cursor is always null). Requires a reader role.
Route: /v1/models (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
params | ListParams | no | Extra fields merged into the request. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.listCategories
listCategories(opts?: CallOptions)
List the model categories. Model categories visible to the caller (predefined, shared and tenant ones) with their label and description in English and French, icon, order and number of models using them. One page only. Requires a reader role.
Route: /v1/llm/categories (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.listVersions
listVersions(modelId: string, opts?: CallOptions)
List the versions of a model. Versions of the model in the tenant, oldest first, with licence, weights source, digest and size, capabilities, status (draft, pending_approval, canary, active, superseded, rolled_back) and approval. Requires a tenant principal with tenant_admin, platform_admin, security_officer, finops, developer, auditor or viewer.
Route: /v1/models/{model_id}/versions (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.requestVersionApproval
requestVersionApproval(modelId: string, version: string, body: Doc = {}, opts?: CallOptions)
Request the approval of a version. Opens an approval request (action model_version_activation) for a draft version and answers 202 with its id; the version becomes pending_approval. The approvers are tenant_admin and security_officer, and the requester cannot approve its own request (separation of duties). A version that is not a draft answers 409 model_version_state. Audited. Requires a tenant principal with tenant_admin or platform_admin.
Route: /v1/models/{model_id}/versions/{version}/approval (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
version | string | yes | Version to approve, as registered. | |
body | Doc | {} | no | Optional {reason} shown to the approvers. |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.resolve
resolve(body: Doc, opts?: CallOptions)
Resolve the native call parameters. Capability Resolver: translates normalized call parameters (for example the reasoning effort none, low, medium, high, max) into the native parameters of the model, from what its manifest declares. An unsupported value is rejected with an explicit code or adjusted with a warning in the answer, never silently. Unknown model: 404 model_not_found. Requires a reader role.
Route: /v1/models/resolve (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | model (or model_id) and the normalized parameters, either in params or at the top level of the body. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.rollback
rollback(modelId: string, body: Doc = {}, opts?: CallOptions)
Roll back a model version. During a canary, aborts it: the active version keeps all the traffic. Otherwise, restores the version that was active before the last full publication. The version left becomes rolled_back, the step is added to the rollout history and audited (model.rollout.rollback). Nothing to roll back: 409 model_rollback_unavailable. Requires a tenant principal with tenant_admin or platform_admin.
Route: /v1/models/{model_id}/rollback (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
body | Doc | {} | no | Optional {reason} written to the rollout history and the audit trail. |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.rollout
rollout(modelId: string, opts?: CallOptions)
Read the rollout of a model. Active version, canary version and canary share of the model in the tenant, with the whole rollout history (publish, canary, rollback, actor, reason, approval). Requires a tenant principal with tenant_admin, platform_admin, security_officer, finops, developer, auditor or viewer.
Route: /v1/models/{model_id}/rollout (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.setStatus
setStatus(modelId: string, status: ModelStatus, opts?: CallOptions)
Change the status of a model. Sets the status to approved, restricted, deprecated or blocked (422 status_invalid otherwise). For a tenant, a promotion to approved is not applied at once: an approval request is opened and the answer is 202 with it; the status changes once it is approved. Other changes apply at once and are audited (model.status, with the previous and new status). Requires tenant_admin, platform_admin, ai_platform_engineer or security_officer.
Route: /v1/models/{model_id}/status (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
status | ModelStatus | yes | New status: approved, restricted, deprecated or blocked. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.startRollout
startRollout(modelId: string, version: string, body: Doc, opts?: CallOptions)
Publish a model version. Publishes an approved version fully (canary_percent 100, default) or as a canary for 1 to 99 percent of the traffic, picked deterministically from the caller (same session or principal, same version). Requires a tenant principal with tenant_admin or platform_admin.
Route: /v1/models/{model_id}/versions/{version}/rollout (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
version | string | yes | Approved version to publish. | |
body | Doc | yes | canary_percent (integer 1 to 100, default 100) and an optional reason. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.update
update(modelId: string, body: Doc, opts?: CallOptions)
Update a registered model. Changes fields of the model spec, the sheet (category, display_name, knowledge_cutoff) or the prices; the model id never changes. A tenant change of a shared model creates a tenant override. The merged spec must stay a valid Model Manifest v1 (422 invalid_manifest) and the category must exist. Audited (model.update). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/models/{model_id} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
modelId | string | yes | Registry identifier of the model. | |
body | Doc | yes | Spec fields to change, sheet fields and pricing (per million tokens: input_per_mtok, output_per_mtok, cached_input_per_mtok, cache_write_per_mtok; per unit: per_image, per_second, per_character; with a currency). Use POST .../status to change the status. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ModelsResource.updateCategory
updateCategory(slug: string, body: Doc, opts?: CallOptions)
Update a model category. Changes the label, description, icon or order of a category; the slug never changes. A predefined category answers 409 category_builtin; a shared category needs platform_admin. Invalid values answer 422 parameter_invalid. Audited. Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/llm/categories/{slug} (PATCH).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
slug | string | yes | Slug of the category. | |
body | Doc | yes | Fields to change: label and description (a text, or {en, fr}; label 80 characters at most, description 500), icon (lowercase name of 1 to 48 characters, or null), sort_order (0 to 10000). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Class IsolationResource
LLM isolation profile of the tenant or of a project (dedicated deployments, regions, providers).
Resource
IsolationResource.get
get(query: { project_id?: string } = {}, opts?: CallOptions)
Read the isolation mode. Effective isolation mode for the tenant or one of its projects: the project setting when present, else the tenant setting, else connected, with the declared internal hosts. Requires a tenant principal (400 tenant_required) with tenant_admin, platform_admin, security_officer, finops, developer, auditor or viewer.
Route: /v1/llm/isolation (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
query | { project_id?: string } | {} | no | Query string parameters of the route. |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
IsolationResource.put
put(body: Doc, opts?: CallOptions)
Set the isolation mode. Sets the isolation mode of the tenant or of one project. In local_only or air_gapped, only local providers (vLLM, Ollama, LM Studio) and the declared internal hosts are reachable: an external route is refused in preflight (403 isolation_external_route) and the outbound call is checked again (403 isolation_egress_denied). Audited (llm.isolation.set). Requires a tenant principal with tenant_admin, platform_admin or security_officer.
Route: /v1/llm/isolation (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | mode (connected, local_only or air_gapped), optional project_id (empty for the whole tenant) and internal_hosts (host names, optionally with a port, lowercase letters, digits, dots and dashes). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Class RoutesResource
LLM and Model Gateway. Model providers, the model registry, routing rules and the Model Gateway: the only path agents and applications use to call models.
Resource
RoutesResource.create
create(body: Doc, opts?: CallOptions)
Create a routing rule. Creates a routing rule of the tenant and answers 201. A platform principal without tenant answers 403 platform_only; an unknown strategy 422 parameter_invalid. Audited (route.create). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/routes (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | name (default default), match (request fields the rule applies to, a value or a list of values), strategy (priority by default, cost, latency, quality), candidates (model ids, or a single target_model), fallbacks, constraints, priority (default 100, lower first), enabled (default true). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
RoutesResource.delete
delete(id: string, opts?: CallOptions)
Delete a routing rule. Deletes a routing rule of the tenant and answers 204. Unknown rule: 404 route_not_found. Audited (route.delete). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/routes/{rid} (DELETE).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier of the routing rule. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
RoutesResource.list
list(params?: ListParams, opts?: CallOptions)
List the routing rules. Routing rules of the tenant by priority then name, each with its match, strategy, candidates, fallbacks, constraints and target_model (the first candidate). Requires a reader role.
Route: /v1/routes (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
params | ListParams | no | Extra fields merged into the request. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
RoutesResource.replace
replace(id: string, body: Doc, opts?: CallOptions)
Replace a routing rule. Replaces the match, strategy, candidates, fallbacks, constraints, priority and enabled flag of a rule of the tenant (omitted fields take their default; the name is kept). Unknown rule: 404 route_not_found. Audited (route.update). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/routes/{rid} (PUT).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
id | string | yes | Identifier of the routing rule. | |
body | Doc | yes | The complete rule: same fields as on creation except name. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
RoutesResource.simulate
simulate(body: Doc, opts?: CallOptions)
Simulate the routing of a request. Shows which model a request would be routed to, without calling it: the rule given by route_id or the first enabled rule that matches, the tenant allow and deny lists (narrowed by the request), the classification and the fallback policy. Answers the selected model, fallbacks, rejected candidates with their reason and the rule used; no eligible model answers 422 no_eligible_model. Restricted models are only allowed for tenant_admin and security_officer with allow_restricted. Requires a reader role.
Route: /v1/routes/simulate (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | Request to simulate: model, candidates, strategy, purpose, capabilities, data_classification (default internal), region_allow, provider_allow, model_allow, allow_restricted, fallback_policy (default allowed), optional route_id, and any field the rules match on. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Class LiteLLMResource
LLM and Model Gateway. Model providers, the model registry, routing rules and the Model Gateway: the only path agents and applications use to call models.
Resource
LiteLLMResource.config
config(opts?: CallOptions)
Generate the LiteLLM configuration. LiteLLM proxy configuration generated from the visible models and the enabled providers (a tenant provider wins over a shared one of the same type). It never holds a secret value: credentials are os.environ/<NAME> references resolved by the LiteLLM deployment. Requires tenant_admin, platform_admin, ai_platform_engineer, security_officer or auditor.
Route: /v1/litellm/config (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LiteLLMResource.sync
sync(opts?: CallOptions)
Push the configuration to LiteLLM. Makes the LiteLLM proxy hold exactly the generated model list: models created by the Control Plane and no longer wanted are removed, missing ones are added; models added by hand in LiteLLM are left alone. Without EAI_LITELLM_URL nothing is pushed (mode: in_process). A transport error answers 502 upstream_error. Audited (litellm.sync). Requires tenant_admin, platform_admin or ai_platform_engineer.
Route: /v1/litellm/sync (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Class AdaptersResource
LLM and Model Gateway. Model providers, the model registry, routing rules and the Model Gateway: the only path agents and applications use to call models.
Resource
AdaptersResource.list
list(opts?: CallOptions)
List the specialized adapters. Specialized adapters of the gateway (image generation, speech to text, text to speech, video generation...) with their modality, label in the language of the request and in both languages, status (configured when their address is set, else not_configured) and the controls applied to them. Requires a reader role.
Route: /v1/adapters (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Class ContextResource
Context Manager and execution context tokens (/v1/context): budget plan, issue, verify and revoke tokens, signing keys.
Resource
ContextResource.issue
issue(body: { audience?: string; delegation_id?: string; run_id?: string; ttl_seconds?: number }, opts?: CallOptions)
Issue a signed execution context. Builds and signs an ExecutionContext for the caller and returns token, context_id, kid, alg, issued_at and expires_at (201). - With run_id: the caller must have created the run, be its root principal or the user it acts for, or hold agent, tenant_admin or security_officer (403 forbidden); the delegation of the run is checked again and the agent manifest is included. - With delegation_id: the delegation must be valid and the caller one of its parties, or agent or tenant_admin. Errors: 400 context_wrong_audience for an audience the platform does not accept, 400 context_ttl_exceeded, 403 delegation_expired, 503 context_authority_unavailable. Audited as context.issue.
Route: /v1/context/issue (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | { audience?: string; delegation_id?: string; run_id?: string; ttl_seconds?: number } | yes | Audience, lifetime and the run or delegation the context is for. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ContextResource.jwks
jwks(opts?: CallOptions)
Get the public verification keys. Public verification keys as a JWKS (active, and retired ones still inside their verification window), each with kid, alg (ES256 or EdDSA) and use: sig. Any authenticated principal may read it. 503 context_authority_unavailable when the key registry cannot be read.
Route: /v1/context/jwks (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ContextResource.listKeys
listKeys(opts?: CallOptions)
List the signing keys. Registry of the context signing keys: kid, algorithm, status, dates of use, retirement and revocation. Needs security_officer or auditor. 503 context_authority_unavailable when the registry cannot be read.
Route: /v1/context/keys (GET).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ContextResource.plan
plan(body: { window: number; output: number; reasoning?: number; safety?: number; segments: Doc[] } & Doc, opts?: CallOptions)
Plan the context window. Context Manager dry run: computes the token budget of a model window (output, reasoning and safety reserves) and which segments are kept, compressed or dropped by priority. With model, the window and output reserve come from the registry. A window that is not a positive integer answers 422 parameter_invalid; segments that cannot fit answer 422 context_overflow. Requires a reader role.
Route: /v1/context/plan (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | { window: number; output: number; reasoning?: number; safety?: number; segments: Doc[] } & Doc | yes | model (or model_id), or window (tokens); output (reserved output tokens, default the model maximum capped at 4096), reasoning (reserved reasoning tokens), safety (margin) and segments (each with type, optional segment_id, priority, classification and its content). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ContextResource.revoke
revoke(contextId: string, opts?: CallOptions)
Revoke an execution context. Revokes an issued context before it expires; verifying it then answers context_revoked. Allowed for the principal that issued it, or tenant_admin or security_officer (403 forbidden). Revoking twice keeps the first date. 404 context_not_found. Audited as context.revoke.
Route: /v1/context/{context_id}/revoke (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
contextId | string | yes | Identifier (UUID) of the context, the jti claim of its token. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ContextResource.revokeKey
revokeKey(kid: string, body: { reason: string }, opts?: CallOptions)
Revoke a signing key. Revokes a context signing key at once: the contexts it signed no longer verify. Needs platform_admin. 404 signing_key_not_found. Audited as context.key.revoke at platform level.
Route: /v1/context/keys/{kid}/revoke (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
kid | string | yes | Key id, the RFC 7638 thumbprint of the public key. | |
body | { reason: string } | yes | Reason of the revocation. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
ContextResource.verify
verify(body: { token: string; audience?: string }, opts?: CallOptions)
Verify a signed execution context. Checks a token and returns valid, context_id, kid, alg, the claims and the context document. Checks, in order: structure and canonical form (context_malformed), algorithm and signature (context_invalid_signature), known non revoked key (context_unknown_key), issuer (context_wrong_issuer), audience (context_wrong_audience), lifetime (context_expired), tenant of the caller (403 context_tenant_mismatch), issuance record (context_revoked), digest of the document and delegation chain (a revoked delegation gives context_revoked). Refusals answer 401 unless stated and are audited; a success binds the verified identity to the audit events of the request.
Route: /v1/context/verify (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | { token: string; audience?: string } | yes | Token to verify and expected audience. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Interface GatewayMeta
Governance headers of a gateway answer, returned by createWithMeta.
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
decisionId | string | undefined | yes | Id of the policy decision, from the x-eai-decision-id header. |
costEstimated | string | undefined | yes | Estimated cost, from the x-eai-cost-estimated header. |
costMeasured | string | undefined | yes | Measured cost, from the x-eai-cost-measured header. |
requestId | string | undefined | yes | Request id of the call. |
Interface TranscriptionInput
Input of gateway.audio.transcribe, turned into a multipart form.
Fields:
| Name | Type | Required | Description |
|---|---|---|---|
file | Blob | yes | Audio to transcribe, sent with filename (default audio). |
filename | string | no | Name of the audio file sent with the multipart part (default audio). |
model | string | yes | Speech to text model alias of the gateway. |
language | string | no | Language of the user interface and of the messages: en or fr. |
prompt | string | no | Text that guides the transcription. |
response_format | string | no | Format of the transcription answer. |
eai | Doc | no | Governance extension, sent as a JSON form field. |
Class GatewayResource
Model gateway: the only path agents use to call models (OpenAI-compatible bodies plus eai).
Resource
Attributes:
| Name | Type | Required | Description |
|---|---|---|---|
audio | GatewayAudio | yes | Audio of the gateway: transcribe (multipart) and speech (audio bytes). |
chat | yes | Chat completions of the gateway: chat.completions.create, createWithMeta and stream. | |
images | GatewayImages | yes | Image generation of the gateway (generate). |
video | GatewayVideo | yes | Video generation of the gateway: generate and get. |
GatewayResource.embeddings
embeddings(body: EmbeddingRequest, opts?: CallOptions)
Compute embeddings. OpenAI compatible embeddings through the same controls as chat (kill switches, allow lists, classification, DLP on each input, cost guardrails, policy decision, audit). The model must declare the embeddings capability and, when dimensions is given, support it (422 capability_not_supported, 422 embedding_dimensions_invalid). Requires a tenant principal with the scope models:invoke.
Route: /v1/gateway/embeddings (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | EmbeddingRequest | yes | OpenAI embeddings request (model, input as a text or a list, optional dimensions) plus the optional eai object. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
GatewayResource.estimate
estimate(body: Doc, opts?: CallOptions)
Estimate a gateway call. Runs every preflight control of the gateway without calling the model and returns the resolved model, decision id, input tokens, maximum output tokens, estimator, estimated cost, cost limit, fallbacks, warnings and context plan. A request refused by a control answers with the same error as the real call. Requires a tenant principal with the scope models:invoke.
Route: /v1/gateway/estimate (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | Doc | yes | The body of the call to estimate, with optional kind (chat, embeddings or rerank); without kind it is guessed from input (embeddings) or query (rerank), else chat. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
GatewayResource.rerank
rerank(body: RerankRequest, opts?: CallOptions)
Rerank documents. Reranks documents against a query through the same controls as chat (DLP on the query, cost guardrails, policy decision, audit). The model must declare the rerank capability (422 capability_not_supported). Requires a tenant principal with the scope models:invoke.
Route: /v1/gateway/rerank (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | RerankRequest | yes | Rerank request: model, query, documents (texts or objects), optional top_n, plus the optional eai object. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
Class LlmResource
Single llm interface: generate, stream, embed and vision, all through the Model Gateway checks.
Resource
LlmResource.embed
embed(body: EmbeddingRequest, opts?: CallOptions)
Compute embeddings. OpenAI compatible embeddings through the same controls as chat (kill switches, allow lists, classification, DLP on each input, cost guardrails, policy decision, audit). The model must declare the embeddings capability and, when dimensions is given, support it (422 capability_not_supported, 422 embedding_dimensions_invalid). Requires a tenant principal with the scope models:invoke.
Route: /v1/gateway/embeddings (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | EmbeddingRequest | yes | OpenAI embeddings request (model, input as a text or a list, optional dimensions) plus the optional eai object. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).
LlmResource.generate
generate(body: ChatCompletionRequest, opts?: CallOptions): Promise<ChatCompletion>
Call a chat model. OpenAI compatible chat completion through every control of the gateway; with stream: true the answer is Server-Sent Events, with the cost guardrails checked during the stream. Requires a tenant principal (403 platform_only) whose credential carries the scope models:invoke.
Route: /v1/gateway/chat/completions (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | ChatCompletionRequest | yes | OpenAI chat request (model is the registry id, messages, stream, max_tokens, tools...) plus the optional eai object: data_classification (public, internal by default, confidential, restricted, secret), agent_id, session_id, run_id, purpose, project_id, effort, max_cost, fallback_policy and allow lists that can only narrow the tenant ones (provider_allow, model_allow, region_allow). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Returns: Promise<ChatCompletion>. Decoded JSON answer of the operation "Call a chat model".
Raises: the typed errors of the transport (Errors).
LlmResource.stream
stream(body: ChatCompletionRequest, opts?: CallOptions): AsyncGenerator<ChatCompletionChunk>
Call a chat model. OpenAI compatible chat completion through every control of the gateway; with stream: true the answer is Server-Sent Events, with the cost guardrails checked during the stream. Requires a tenant principal (403 platform_only) whose credential carries the scope models:invoke.
Route: /v1/gateway/chat/completions (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | ChatCompletionRequest | yes | OpenAI chat request (model is the registry id, messages, stream, max_tokens, tools...) plus the optional eai object: data_classification (public, internal by default, confidential, restricted, secret), agent_id, session_id, run_id, purpose, project_id, effort, max_cost, fallback_policy and allow lists that can only narrow the tenant ones (provider_allow, model_allow, region_allow). | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Returns: AsyncGenerator<ChatCompletionChunk>. Decoded JSON answer of the operation "Call a chat model".
Raises: the typed errors of the transport (Errors).
LlmResource.vision
vision(body: { prompt?: string; media_id?: string; content_base64?: string; mime_type?: string; model?: string } & Doc, opts?: CallOptions)
Understand an image. Starts a vision understanding job on an image media or inline image with a prompt (201, the job). The answer goes through the DLP with dlp_mode. detail answers 422 parameter_unsupported when the configured provider cannot honour it; a non image input answers 422 unsupported_media. Needs tenant_admin, developer or agent.
Route: /v1/multimodal/vision (POST).
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
body | { prompt?: string; media_id?: string; content_base64?: string; mime_type?: string; model?: string } & Doc | yes | Input image, prompt, model, DLP mode and detail level. | |
opts | CallOptions | no | Per call options (query, idempotency key, traceparent, headers). |
Raises: the typed errors of the transport (Errors).