Skip to main content

resources/media.ts

Source: sdks/typescript/packages/sdk/src/resources/media.ts. Back to the TypeScript SDK reference index.

note

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.

Type alias MediaOperation​

Operation a media is uploaded for, for example stt, ocr, image_generation or voice_live.

Definition: \| "stt" \| "tts" \| "ocr" \| "vision_understanding" \| "image_generation" \| "image_edit" \| "video_generation" \| "video_processing" \| "diarization" \| "document_extraction" \| "voice_live".

Interface MediaUpload​

Input of MediaResource.upload: the file and its upload settings.

Fields:

NameTypeRequiredDescription
fileBlobyesContent to upload, sent with filename (default file).
filenamestringnoName of the uploaded file, sent with the multipart part (default file).
mime_typestringnoMedia type of the content, for example application/pdf or image/png.
operationMediaOperationnoOperation the media is meant for.
classification"public" | "internal" | "confidential" | "restricted" | "secret"noClassification of the media: public, internal, confidential, restricted or secret.
dlp_mode"detect" | "mask" | "tokenize" | "block"noDLP mode applied to the media: detect, mask, tokenize or block.
retention_daysnumbernoDays a backup is kept before it can be deleted, 1 or more.

Class MediaResource​

Multimodal. Media and multimodal processing: encrypted media storage and jobs for vision, image generation and edition, video processing and generation, speech to text, diarization, text to speech and multimodal DLP.

Resource

MediaResource.delete​

delete(id: string, opts?: CallOptions)

Delete a media. Deletes the media and its stored content. Allowed for its creator, tenant_admin or security_officer (403 forbidden). A media under legal hold answers 409 legal_hold. Audited as media.delete.

Route: /v1/media/{media_id} (DELETE).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the media.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MediaResource.get​

get(id: string, options: { includeContent?: boolean } & CallOptions = {})

Get a media. Returns the Multimodal Contract document of the media. With include_content=true the answer is {media, content_base64} with the decrypted content; this needs a clearance at least equal to the media classification (403 policy_denied) and is audited as media.read.

Route: /v1/media/{media_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the media.
options{ includeContent?: boolean } & CallOptions{}noPer call options (idempotency key, traceparent, headers, abort signal).

Raises: the typed errors of the transport (Errors).

MediaResource.list​

list(params?: ListParams, opts?: CallOptions)

List the media. Tenant media (Multimodal Contract documents), keyset paginated with cursor, filtered by media_type and classification (400 invalid_request for an unknown value).

Route: /v1/media (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MediaResource.upload​

upload(input: MediaUpload | FormData, opts?: CallOptions)

Upload a media. Stores a media (201) from JSON {content_base64, mime_type, filename?, operation?, dlp_mode?, retention_days?, classification?} or multipart/form-data with a file part and the same fields. Any tenant principal may call it. Steps: 1. Size checked against the platform maximum (50 MiB unless configured; 413 media_too_large). 2. File scan by ClamAV and YARA-X (422 file_blocked, 503 file_scan_unavailable). 3. Text extraction and DLP with dlp_mode (default detect; block answers 422 dlp_blocked when personal data is found); the classification is raised accordingly. 4. The content is encrypted with a tenant key and stored. Returns the Multimodal Contract document.

Route: /v1/media (POST).

NameTypeDefaultRequiredDescription
inputMediaUpload | FormDatayesA ready FormData, or a MediaUpload turned into one.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

Class MultimodalResource​

Multimodal. Media and multimodal processing: encrypted media storage and jobs for vision, image generation and edition, video processing and generation, speech to text, diarization, text to speech and multimodal DLP.

Resource

Attributes:

NameTypeRequiredDescription
body{ status: "running" | "succeeded" | "failed" | "cancelled"; output?: Doc; error?: string; units?: Doc },yesResult of the job sent by completeJob: status, output, error and measured units.
idstring,yesId of the job completed by completeJob.
optsCallOptions,noPer call options of completeJob.

MultimodalResource.completeJob​

completeJob(id: string, body: { status: "running" | "succeeded" | "failed" | "cancelled"; output?: Doc; error?: string; units?: Doc }, opts?: CallOptions)

Report the result of a queued job. Called by GPU workers (agent or service identities) to report a queued job result: status running, succeeded, failed or cancelled (else 400 invalid_request), with output, error and measured units; the quota reservation is committed or released. A finished job answers 409 conflict. Needs agent or tenant_admin. 404 not_found.

Route: /v1/multimodal/jobs/{job_id}/complete (POST).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the job.
body{ status: "running" | "succeeded" | "failed" | "cancelled"; output?: Doc; error?: string; units?: Doc }yesStatus, output, error and measured units of the job.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.diarize​

diarize(body: Doc, opts?: CallOptions)

Diarize an audio. Starts a diarization job (who spoke when) on an audio media or inline audio (201, the job). Only min_speakers and max_speakers apply here (word_timestamps answers 422 parameter_unsupported); min_speakers must not exceed max_speakers (422 parameter_invalid); an option the configured provider cannot honour answers 422 parameter_unsupported. Needs tenant_admin, developer or agent.

Route: /v1/multimodal/diarize (POST).

NameTypeDefaultRequiredDescription
bodyDocyesAudio input and speaker bounds.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.dlp​

dlp(body: Doc, opts?: CallOptions)

Run the DLP on a text or a media. Inspects text, the extracted text of a stored media, or inline content (scanned first), with the tenant DLP rules. Returns source, extracted_text_chars, the processed text, findings, action and classification. Nothing is stored. Any tenant principal may call it. Audited as multimodal.dlp.

Route: /v1/multimodal/dlp (POST).

NameTypeDefaultRequiredDescription
bodyDocyesText, stored media or inline content, and the DLP mode.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.editImage​

editImage(body: Doc, opts?: CallOptions)

Edit an image. Starts an image edition job from an image media or inline image and a prompt (201, the job). The input must be an image (422 unsupported_media). Needs tenant_admin, developer or agent.

Route: /v1/multimodal/images/edit (POST).

NameTypeDefaultRequiredDescription
bodyDocyesInput image, prompt, number of images, size and model.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.generateImage​

generateImage(body: Doc, opts?: CallOptions)

Generate images. Starts an image generation job (201, the job). The prompt is inspected by the DLP in block mode first: personal data answers 422 dlp_blocked. Usage is counted per image. Needs tenant_admin, developer or agent.

Route: /v1/multimodal/images/generate (POST).

NameTypeDefaultRequiredDescription
bodyDocyesPrompt, number of images, size and model.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.generateVideo​

generateVideo(body: Doc, opts?: CallOptions)

Generate a video. Starts a video generation job and answers 202 with the job; follow it with GET /v1/multimodal/jobs/{job_id}. Usage is counted in video seconds. Needs tenant_admin, developer or agent.

Route: /v1/multimodal/video/generate (POST).

NameTypeDefaultRequiredDescription
bodyDocyesPrompt, duration, size and model.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.getJob​

getJob(id: string, opts?: CallOptions)

Get a multimodal job. Returns the job: operation, status, input parameters, output, error, adapter, units and cost. 404 not_found.

Route: /v1/multimodal/jobs/{job_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the job.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.listJobs​

listJobs(params?: ListParams, opts?: CallOptions)

List the multimodal jobs. Jobs of the tenant, newest first, paginated with cursor, optionally filtered by status and operation.

Route: /v1/multimodal/jobs (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.processVideo​

processVideo(body: Doc, opts?: CallOptions)

Process a video. Extracts frames and/or the audio track of a video media or inline video (201, the job; queued when ffmpeg is not available). operations accepts frames and audio only (400 invalid_request). Needs tenant_admin, developer or agent.

Route: /v1/multimodal/video/process (POST).

NameTypeDefaultRequiredDescription
bodyDocyesInput video, operations, frame rate and audio sample rate.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.stt​

stt(body: Doc, opts?: CallOptions)

Transcribe speech to text. Starts a speech to text job on an audio media or inline audio (201, the job). The transcript goes through the DLP with dlp_mode. Only word_timestamps applies here (speaker bounds answer 422 parameter_unsupported). Usage is counted in audio seconds (duration_seconds, or read from a WAV header). Needs tenant_admin, developer or agent.

Route: /v1/multimodal/stt (POST).

NameTypeDefaultRequiredDescription
bodyDocyesAudio input, language, model, DLP mode and options.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.tts​

tts(body: Doc, opts?: CallOptions)

Synthesize speech from text. Starts a text to speech job (201, the job). The text is inspected by the DLP with dlp_mode (default block: personal data answers 422 dlp_blocked; mask speaks the masked text). Usage is counted in characters. Needs tenant_admin, developer or agent.

Route: /v1/multimodal/tts (POST).

NameTypeDefaultRequiredDescription
bodyDocyesText, voice, model and DLP mode.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

MultimodalResource.vision​

vision(body: 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).

NameTypeDefaultRequiredDescription
bodyDocyesInput image, prompt, model, DLP mode and detail level.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

Interface RealtimeSessionView​

Realtime session view returned by GET /v1/realtime/sessions/{id} and POST .../end.

Doc

Fields:

NameTypeRequiredDescription
idstringyesId of the session.
roomstringyesLiveKit room name (1 to 128 letters, digits, ., _, -). Default: derived from the tenant and the session.
identitystringyesParticipant identity in the room.
pipeline"echo" | "stt" | stringyesecho (default) or stt.
configDocyesConfiguration of the session.
statusstringyesState of the session.
audio_secondsnumber | stringyesSeconds of audio processed.
input_tokensnumberyesInput tokens used by the session.
output_tokensnumberyesOutput tokens used by the session.
usageDoc | nullyesUsage counters added to the budget consumption, for example input_tokens, output_tokens.
created_bystringyesPrincipal that created the session.
created_atstringyesTime the session was created.
ended_atstring | nullyesTime the session ended, null while it is open.

Interface RealtimeSession​

POST /v1/realtime/sessions response: the view plus connection material.

RealtimeSessionView

Fields:

NameTypeRequiredDescription
session_idstringyesId of the session.
ws_urlstringyesRelative path /v1/realtime/ws/{id}?token=<ws_token>.
ws_tokenstringyesSingle use token of the WebSocket; createToken gives a new one before a reconnection.
livekit{ url: string; token: string; room: string; configured: boolean }yesLiveKit URL, token and room, and whether LiveKit is configured.

Interface RealtimeConsent​

Body of POST /v1/realtime/sessions/{id}/consents.

Fields:

NameTypeRequiredDescription
purposestringyesUse of the target. Default backup.
retention_daysnumberyesDays a backup is kept before it can be deleted, 1 or more.
methodstringnoName of the method, for example basic, token or none.
participant_identitystringnoIdentity of the participant (1 to 128 letters, digits, ., _, :, @, -). Default: the participant of the session.
recording_allowedbooleannoWhether the audio may be recorded. Default false.
transcription_allowedbooleannoWhether the speech may be transcribed and stored. Default false.

Class RealtimeResource​

Realtime voice. Realtime voice sessions: a LiveKit room token and a WebSocket event protocol to stream audio to an agent, with participant consent, turns, DLP filtered transcripts, optional recordings and metering.

Resource

RealtimeResource.createSession​

createSession(body: { pipeline?: "echo" | "stt"; room?: string; ttl_seconds?: number; config?: Doc; agent_id?: string; on_behalf_of?: string } = {}, opts?: CallOptions)

Open a realtime session. Opens a session (201) and returns it with session_id, livekit (url, token, room, configured) and the WebSocket access (ws_url, ws_token, ws_token_expires_at). Needs tenant_admin, developer or agent. Checks: pipeline is echo or stt (400 invalid_request); config.vad and config.dlp_mode are valid (422 parameter_invalid); an agent caller acts for on_behalf_of, a user may only open a session for itself (403 identity_mismatch); LiveKit credentials are configured; the policy realtime.session.create is evaluated. The room defaults to a name derived from the tenant and the session. Audited as realtime.session.create.

Route: /v1/realtime/sessions (POST).

NameTypeDefaultRequiredDescription
body{ pipeline?: "echo" | "stt"; room?: string; ttl_seconds?: number; config?: Doc; agent_id?: string; on_behalf_of?: string }{}noRoom, pipeline, token lifetime, configuration, agent and user acted for.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.createToken​

createToken(id: string, opts?: CallOptions)

Get a new WebSocket token. New single use WebSocket token for an open session (reconnection), read under RLS: ws_url, ws_token, ws_token_expires_at. 409 session_ended; 404 not_found. Needs tenant_admin, developer or agent. Audited as realtime.session.token.

Route: /v1/realtime/sessions/{session_id}/token (POST).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.endSession​

endSession(id: string, opts?: CallOptions)

End a realtime session. Ends the session and records its usage event (voice_live: audio seconds, input and output tokens, measured cost). Ending a session already ended returns it unchanged. Needs tenant_admin, developer or agent. Audited as realtime.session.end.

Route: /v1/realtime/sessions/{session_id}/end (POST).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.getSession​

getSession(id: string, opts?: CallOptions)

Get a realtime session. Returns the session: room, identities, agent, pipeline, configuration, status, audio seconds, tokens and usage. 404 not_found.

Route: /v1/realtime/sessions/{session_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.listConsents​

listConsents(id: string, opts?: CallOptions)

List the consents of a session. Consents recorded for the session, in capture order, with their revocation when revoked. One page only.

Route: /v1/realtime/sessions/{session_id}/consents (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.recordConsent​

recordConsent(id: string, body: RealtimeConsent, opts?: CallOptions)

Record a participant consent. Consent of one participant (purpose, recording, transcription, retention, method), captured by the caller (201). The participant defaults to the participant of the session. The method must be verbal, click, written or api (422 parameter_invalid); the session must not be ended (409 session_ended); the policy realtime.consent.record is evaluated. Needs tenant_admin, developer or agent. Audited as realtime.consent.record.

Route: /v1/realtime/sessions/{session_id}/consents (POST).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
bodyRealtimeConsentyesThe consent of the participant.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.revokeConsent​

revokeConsent(id: string, consentId: string, opts?: CallOptions)

Revoke a consent. Revocation takes effect on the next audio event: transcription and recording are refused again. A consent already revoked or unknown answers 404 not_found. Needs tenant_admin, developer or agent. Audited as realtime.consent.revoke.

Route: /v1/realtime/sessions/{session_id}/consents/{consent_id}/revoke (POST).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
consentIdstringyesIdentifier (UUID) of the consent.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.transcripts​

transcripts(id: string, opts?: CallOptions)

List the transcripts of a session. Stored transcripts, already filtered by the DLP (the raw transcript is never stored), with turn, consent, participant, DLP findings and expiry. Needs tenant_admin, developer, auditor or security_officer.

Route: /v1/realtime/sessions/{session_id}/transcripts (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RealtimeResource.turns​

turns(id: string, opts?: CallOptions)

List the turns of a session. Turns with the participant, the user, the agent, the trace id, the status (a barge-in records cancelled) and the measured latency, in order. One page only.

Route: /v1/realtime/sessions/{session_id}/turns (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the realtime session.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

Class EvaluationsResource​

Evaluation and red team. Quality of the AI systems of the tenant: evaluation suites, evaluation runs, quality gates before promotion, A/B comparisons against a baseline and red team runs.

Resource

EvaluationsResource.checkGate​

checkGate(body: Doc, opts?: CallOptions)

Check the quality gate of a target. Checks that the latest finished run of every blocking suite of the target (for target.version when given, and limited to suite_ids when given) has passed. With run_missing: true, a suite without any run is run now; otherwise it counts as missing.

Route: /v1/evaluations/gates/check (POST).

NameTypeDefaultRequiredDescription
bodyDocyesTarget, optional suites and whether to run missing suites.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.createComparison​

createComparison(body: Doc, opts?: CallOptions)

Compare a candidate with a baseline. Runs one suite twice, on the baseline and on the candidate (each {type, ref, version}, type model by default, agent or prompt), and stores both runs, the per metric deltas and the verdict. Deltas are oriented by the comparator of each metric (gte: higher is better, lte: lower is better).

Route: /v1/evaluations/comparisons (POST).

NameTypeDefaultRequiredDescription
bodyDocyesJSON object: suite_id, baseline, candidate, optional tolerance (0 to 1, default 0) and outputs ({"baseline": [...], "candidate": [...]}, precomputed outputs per case).
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.createRun​

createRun(body: Doc, opts?: CallOptions)

Run an evaluation suite. Runs a suite now and returns the finished run (201). Needs tenant_admin, developer, security_officer or ai_governance_officer or agent.

Route: /v1/evaluations/runs (POST).

NameTypeDefaultRequiredDescription
bodyDocyesSuite, optional target, precomputed outputs and trigger.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.createSuite​

createSuite(body: Doc, opts?: CallOptions)

Create an evaluation suite. Creates a suite. Needs tenant_admin, developer, security_officer or ai_governance_officer. Errors 400 invalid_request: target type not in model, agent, prompt, rag_pipeline, skill or tool, unknown engine or kind, comparator other than gte or lte, or, for the custom engine, a metric other than exact_match, contains, not_contains, json_valid, faithfulness, latency or refusal. A name already used answers 409 conflict. The dataset gets its size and a SHA-256 digest of the cases. Writes the audit event evaluation.suite.create.

Route: /v1/evaluations/suites (POST).

NameTypeDefaultRequiredDescription
bodyDocyesName, target, engine, kind, dataset, cases, metrics and gate options.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.getComparison​

getComparison(id: string, opts?: CallOptions)

Get an A/B comparison. Returns one comparison. Needs tenant_admin, developer, security_officer, auditor, viewer or finops. Answers 404 comparison_not_found.

Route: /v1/evaluations/comparisons/{comparison_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the comparison.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.getRun​

getRun(id: string, opts?: CallOptions)

Get an evaluation run. Returns one evaluation run with its results per metric and per case. Open to any member of the tenant. Answers 404 not_found.

Route: /v1/evaluations/runs/{run_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the evaluation run.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.getSuite​

getSuite(id: string, opts?: CallOptions)

Get an evaluation suite. Returns one suite with its full list of cases and run_on_promotion. Open to any member of the tenant. Answers 404 not_found.

Route: /v1/evaluations/suites/{suite_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the suite.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.listComparisons​

listComparisons(query: { suite_id?: string } = {}, opts?: CallOptions)

List the A/B comparisons. Lists the comparisons of the tenant, newest first, at most 200, optionally for one suite. Each gives baseline, candidate, both run ids, per metric deltas, tolerance and verdict. Needs tenant_admin, developer, security_officer, auditor, viewer or finops.

Route: /v1/evaluations/comparisons (GET).

NameTypeDefaultRequiredDescription
query{ suite_id?: string }{}noQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.listRuns​

listRuns(params?: ListParams, opts?: CallOptions)

List the evaluation runs. Lists the evaluation runs of the tenant, newest identifier first, paginated, optionally filtered by suite and status. Each item follows the Evaluation Contract (target, engine, dataset, metrics, results, status, cost) with run_id, suite_id, trigger, case_results and error. Open to any member of the tenant.

Route: /v1/evaluations/runs (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

EvaluationsResource.listSuites​

listSuites(params?: ListParams, opts?: CallOptions)

List the evaluation suites. Lists the suites of the tenant ordered by name, paginated, as Evaluation Contract documents; cases gives the number of cases. Open to any member of the tenant.

Route: /v1/evaluations/suites (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

Class RedteamResource​

Evaluation and red team. Quality of the AI systems of the tenant: evaluation suites, evaluation runs, quality gates before promotion, A/B comparisons against a baseline and red team runs.

Resource

RedteamResource.createRun​

createRun(body: Doc, opts?: CallOptions)

Run a red team campaign. Sends adversarial probes to the target and stores the findings. Needs tenant_admin, developer, security_officer or ai_governance_officer.

Route: /v1/redteam/runs (POST).

NameTypeDefaultRequiredDescription
bodyDocyesTarget, engine, probes and accepted attack success rate.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RedteamResource.getRun​

getRun(id: string, opts?: CallOptions)

Get a red team run. Returns one red team run: target, engine, probes, status, summary (total, vulnerable, attack success rate, threshold, per category) and findings. Open to any member of the tenant. Answers 404 not_found.

Route: /v1/redteam/runs/{run_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the red team run.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

RedteamResource.listRuns​

listRuns(params?: ListParams, opts?: CallOptions)

List the red team runs. Lists the red team runs of the tenant, newest identifier first, paginated, and probes: the builtin probes (id and category), the garak probe families and whether garak is installed. Open to any member of the tenant.

Route: /v1/redteam/runs (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

Class AuditResource​

Audit events (/v1/audit): listing, application events, hash chain checks, WORM export and correlations.

Resource

AuditResource.correlations​

correlations(query?: Query, opts?: CallOptions)

Correlate events by trace, run or session. With trace_id, run_id or session_id (the first given wins), returns everything that shares that key: audit_events, LLM usage_events, runs, telemetry spans, multimodal_jobs (up to 1000 of each, 200 for runs and jobs), the trace_ids met and counts.

Route: /v1/audit/correlations (GET).

NameTypeDefaultRequiredDescription
queryQuerynoQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.export​

export(body: Doc = {}, opts?: CallOptions)

Export the audit trail. Writes the events of the period (bounds included) to write once storage, as NDJSON or CSV, with a manifest. Needs auditor, security_officer or tenant_admin.

Route: /v1/audit/export (POST).

NameTypeDefaultRequiredDescription
bodyDoc{}noPeriod, retention and format of the export. An empty body exports everything as NDJSON kept 365 days.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.get​

get(id: string, opts?: CallOptions)

Get an audit event. Returns one audit event with its sequence, hashes, actor, resource, decision and evidence. Needs auditor, security_officer or tenant_admin. The read is recorded in the evidence access log. Answers 404 not_found.

Route: /v1/audit/events/{event_id} (GET).

NameTypeDefaultRequiredDescription
idstringyesIdentifier (UUID) of the audit event.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.iterate​

iterate(params?: ListParams, opts?: CallOptions)

Search the audit events. Searches the audit events of the tenant, newest first (highest sequence first), paginated. All filters combine. Needs auditor, security_officer or tenant_admin. The search itself is recorded in the evidence access log (who, which query, how many results).

Route: /v1/audit/events (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.list​

list(params?: ListParams, opts?: CallOptions)

Search the audit events. Searches the audit events of the tenant, newest first (highest sequence first), paginated. All filters combine. Needs auditor, security_officer or tenant_admin. The search itself is recorded in the evidence access log (who, which query, how many results).

Route: /v1/audit/events (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.query​

query(params?: ListParams, opts?: CallOptions)

Search the audit events. Searches the audit events of the tenant, newest first (highest sequence first), paginated. All filters combine. Needs auditor, security_officer or tenant_admin. The search itself is recorded in the evidence access log (who, which query, how many results).

Route: /v1/audit/events (GET).

NameTypeDefaultRequiredDescription
paramsListParamsnoExtra fields merged into the request.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.record​

async record(body: AuditRecord, opts?: CallOptions): Promise<AuditRecorded>

Record an application audit event. Appends an application event to the tenant hash chain. The actor comes from the authentication; the sequence, the hashes and occurred_at from the server; the client details are kept under evidence.details.attributes, next to stream: sdk. The event is sealed and exported to the outbox and the SIEM like the platform events.

Route: /v1/audit/events (POST).

NameTypeDefaultRequiredDescription
bodyAuditRecordyesThe application event. Fields other than those of the schema are refused.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Returns: Promise<AuditRecorded>. A AuditRecorded: Receipt of POST /v1/audit/events.

Raises: EaiError, the typed errors of the transport (Errors).

AuditResource.verify​

verify(query?: Query, opts?: CallOptions)

Verify the audit chain. Recomputes the hash chain of the tenant from the first event and returns tenant_id, valid, count, last_hash, broken_at, reason and verified_at. When the chain is broken, broken_at is the sequence of the first faulty event and reason says why: sequence gap, prev_hash mismatch or hash mismatch. Needs auditor, security_officer or tenant_admin. The verification is recorded in the evidence access log.

Route: /v1/audit/verify (GET).

NameTypeDefaultRequiredDescription
queryQuerynoQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

AuditResource.verifyEvidence​

verifyEvidence(opts?: CallOptions)

Verify the chain and every seal. Verifies the whole tenant chain and every seal and returns tenant_id, valid, chain (hash chain result), seals (count and failures), clock (timestamp failures) and events (number checked). Needs auditor, security_officer or tenant_admin. The verification is recorded in the access log.

Route: /v1/evidence/verify (GET).

NameTypeDefaultRequiredDescription
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

Interface AuditRecord​

Body of POST /v1/audit/events: no other field is accepted (422).

Fields:

NameTypeRequiredDescription
actionapp.${string}yesApplication action in the app. namespace, for example app.invoice.validated.
resource{ type: string; id: string; name?: string }yesResource the action is about: type, id and optional name.
outcome"success" | "failure" | "error"noOutcome of the action: success, failure or error.
detailsDocnoFree attributes (at most 16384 bytes of JSON), kept under evidence.details.attributes; credentials are redacted.
classificationClassificationnoClassification of the event data.
trace_idstringnoW3C trace id, 32 hexadecimal characters.
event_timestringnoClient clock, ISO 8601 with a time zone.

Interface AuditRecorded​

Receipt of POST /v1/audit/events.

Fields:

NameTypeRequiredDescription
event_idstringyesId of the recorded event.
sequencenumberyesOrdered steps of the failover, as free objects.
hashstringyesDigest of the source content, for example sha256:....
prev_hashstring | nullyesHash of the previous event of the chain, null for the first one.
occurred_atstringyesTime the platform recorded the event, ISO 8601.
event_timestring | nullyesWhen the action happened on the client clock (ISO 8601), at most the allowed clock skew ahead of the server. Default: the server time.
actionstringyesRecorded action.
stream"sdk"yesAudit stream of the event, always sdk.
actorAuditEvent["actor"]yesActor taken from the authentication of the call.
decisionAuditEvent["decision"]yesapprove or reject.

Interface Span​

Span built locally by TelemetryResource.startSpan and sent by endSpan.

Fields:

NameTypeRequiredDescription
namestringyesName of the span.
trace_idstringyesW3C trace id, 32 lowercase hexadecimal characters, to correlate the event with a trace.
span_idstringyesRandom id of the span, 16 hexadecimal characters.
parent_span_idstring | nullyesParent span id taken from the traceparent, or null.
start_time_unix_nanonumberyesStart time in nanoseconds since the epoch.
end_time_unix_nanonumberyesEnd time in nanoseconds since the epoch, 0 while the span is open.
attributesDocyesFree attributes of the component, such as the provider of a model.
statusstringyesStatus of the span, ok until endSpan sets it.
eventsDoc[]yesTimed events added by recordEvent.

Class TelemetryResource​

Telemetry. Traces, request journal, live stream and service level objectives (SLO) of the platform.

Resource

Attributes:

NameTypeRequiredDescription
body{ availability: number; latency_seconds: number; latency_objective: number; reason?: string },yesObjectives sent by setSloTarget: availability, latency, latency objective and reason.
optsCallOptions,noPer call options of setSloTarget.
servicestring,yesPlatform service whose objectives setSloTarget sets.

TelemetryResource.endSpan​

endSpan(span: Span, status = "ok", opts?: CallOptions)

Ingest telemetry spans. Accepts up to 5000 spans and answers 202 with the number accepted, the number stored (a span already known for the same trace and span id is skipped) and the result of each exporter (ok or error). Requires a tenant principal with tenant_admin, developer or agent (403 forbidden).

Route: /v1/telemetry/spans (POST).

NameTypeDefaultRequiredDescription
spanSpanyesOpen span to close; an ended span throws span_ended.
status"ok"noFinal status of the span (default ok).
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: EaiError, the typed errors of the transport (Errors).

TelemetryResource.ingestSpans​

ingestSpans(body: { spans: Doc[] } & Doc, opts?: CallOptions)

Ingest telemetry spans. Accepts up to 5000 spans and answers 202 with the number accepted, the number stored (a span already known for the same trace and span id is skipped) and the result of each exporter (ok or error). Requires a tenant principal with tenant_admin, developer or agent (403 forbidden).

Route: /v1/telemetry/spans (POST).

NameTypeDefaultRequiredDescription
body{ spans: Doc[] } & DocyesOTLP JSON export request (resourceSpans) or {spans: [...]} where each span has trace_id, span_id, optional parent_span_id, name, service, start_time, end_time (ISO 8601 or startTimeUnixNano / endTimeUnixNano), status, attributes, optional cost {amount, currency}, run_id and session_id.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

TelemetryResource.logs​

logs(query?: { level?: "error" | "info"; service?: string; trace_id?: string; q?: string; from?: string; to?: string; limit?: number } & Query, opts?: CallOptions)

List the request journal. Request journal of the tenant from the span summaries, newest first: one line per span with its time, level (error when the span failed, else info), service, name, message (error type, or method, route and status code), duration, trace, span, run and kept attributes. Never a prompt or a model output. Requires a tenant principal with platform_admin, tenant_admin, auditor, viewer or support_engineer (403 forbidden). An unknown level or a from after to answers 400 invalid_request.

Route: /v1/telemetry/logs (GET).

NameTypeDefaultRequiredDescription
query{ level?: "error" | "info"; service?: string; trace_id?: string; q?: string; from?: string; to?: string; limit?: number } & QuerynoQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

TelemetryResource.overview​

overview(query?: Query, opts?: CallOptions)

Read the telemetry overview. Dashboard of the tenant over the last days days: number of requests (root spans), errors, error rate, p50 and p95 latency in milliseconds, total cost, and per day requests, errors and cost (span costs plus the measured or estimated cost of the LLM usage events). Also says which exporters (Opik, OpenTelemetry, ClickHouse) are configured. The total cost is labelled USD. Requires a tenant principal (403 tenant_required).

Route: /v1/telemetry/overview (GET).

NameTypeDefaultRequiredDescription
queryQuerynoQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

TelemetryResource.recordEvent​

recordEvent(span: Span, name: string, attributes: Doc = {}): Span

Adds a timed event to an open span (no request).

NameTypeDefaultRequiredDescription
spanSpanyesOpen span; an ended span throws span_ended.
namestringyesName of the event.
attributesDoc{}noAttributes of the event.

Returns: Span. The same span, with the event added.

Raises: EaiError.

TelemetryResource.setSloTarget​

setSloTarget(service: string, body: { availability: number; latency_seconds: number; latency_objective: number; reason?: string }, opts?: CallOptions)

Set the objectives of a service. Objectives of one platform service, written in the database where they override the EAI_SLO_* defaults for every replica within 30 seconds. Platform administrator only (403 forbidden). An unknown service answers 404 slo_service_unknown. The change, with the values before and after and the reason, is audited (telemetry.slo.target.update); the answer gives the stored objectives with their version.

Route: /v1/telemetry/slo/targets/{service} (PUT).

NameTypeDefaultRequiredDescription
servicestringyesService whose objectives are set: control_plane_api, model_gateway, tool_gateway or realtime.
body{ availability: number; latency_seconds: number; latency_objective: number; reason?: string }yesNew availability and latency objectives of the service.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

TelemetryResource.slo​

slo(query?: { window_minutes?: number; tenant_id?: string } & Query, opts?: CallOptions)

Read the SLO error budgets. For each service, over the last window_minutes minutes: requests, errors (5xx), requests over the latency target, the latency target and where it comes from (database or settings), and for availability and latency the target, bad ratio, remaining budget and burn rate. Counts are those of the replica that answers. Requires platform_admin, tenant_admin, auditor, viewer or support_engineer (403 forbidden). A platform administrator reads the whole platform or one tenant; anyone else reads only its own tenant (403 slo_scope_forbidden for another one). A window outside 1 to EAI_SLO_RETENTION_MINUTES answers 422 slo_window_invalid. Each read is audited (telemetry.slo.read).

Route: /v1/telemetry/slo (GET).

NameTypeDefaultRequiredDescription
query{ window_minutes?: number; tenant_id?: string } & QuerynoQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

TelemetryResource.startSpan​

startSpan(name: string, attributes: Doc = {}, traceparent?: string): Span

Opens an explicit span (no request), child of a W3C traceparent when given.

NameTypeDefaultRequiredDescription
namestringyesName of the span.
attributesDoc{}noAttributes of the span, copied.
traceparentstringnoW3C traceparent of the parent; a malformed value throws validation_error.

Returns: Span. The open span, with a new trace id when no parent is given.

Raises: EaiError.

TelemetryResource.trace​

trace(traceId: string, opts?: CallOptions)

Get one trace. Every span of the trace in start order (with cost when known), the span count, total duration in milliseconds, error count, the audit events that carry this trace id, and a link to the trace in Opik when Opik is configured. Requires a tenant principal (403 tenant_required). A malformed id answers 400 invalid_request; a trace without span nor audit event answers 404 not_found.

Route: /v1/telemetry/traces/{trace_id} (GET).

NameTypeDefaultRequiredDescription
traceIdstringyesTrace identifier: 32 hexadecimal characters (W3C trace context), case insensitive.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).

TelemetryResource.traces​

traces(query?: { status?: "ok" | "error" | "unset"; service?: string; run_id?: string; from?: string; to?: string; limit?: number } & Query, opts?: CallOptions)

List the recent traces. Recent traces of the tenant, newest first: one row per root span with its name, service, start, duration, status, run, session and its span and error counts. Requires a tenant principal with platform_admin, tenant_admin, auditor, viewer or support_engineer (403 forbidden). An unknown status or a from after to answers 400 invalid_request.

Route: /v1/telemetry/traces (GET).

NameTypeDefaultRequiredDescription
query{ status?: "ok" | "error" | "unset"; service?: string; run_id?: string; from?: string; to?: string; limit?: number } & QuerynoQuery string parameters of the route.
optsCallOptionsnoPer call options (query, idempotency key, traceparent, headers).

Raises: the typed errors of the transport (Errors).