Appearance
Agents
38 operations. Paths are relative to https://api.frege.io.
Models this deployment will run
GET/v1/models
The models this deployment offers, each with what the gateway knows about it: price per million tokens, context size, and whether it can still call tools the way this deployment routes. WHICH models are offered stays configuration, because the gateway is whatever base_url points at and an air-gapped install has no catalogue to ask — but a non-empty list is now enforced when a model is SAVED, so a mistyped id is a validation error on a form instead of an error frame in the middle of somebody's conversation. An empty list means the deployment expresses no opinion and any id is accepted, exactly as before. A model whose status is not "usable" is still listed, so somebody whose agent already names it is told why it stopped working. models is the same ids as bare strings and is deprecated.
Authentication: bearer token.
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
Speech models of Frege's own voice
GET/v1/models/speech
The gateway's speech-to-text and text-to-speech models an environment or a voice agent can choose when speech runs through Frege, each text-to-speech model with the voices it speaks and the one used when the agent names none. Ids are stored as "frege/<id>". Empty lists, with offered false, when this deployment does not offer Frege's own voice.
Authentication: bearer token.
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 502 | Bad Gateway | error envelope |
List a project's agents
GET/v1/projects/{id}/agents
Returns the agents defined on this project, newest first, each with its instructions, model, and the allow-list of tools it may call. unknown_tools flags any entry that no longer exists in the active spec. Archived agents are excluded unless include_archived is set. Reachable by a project-scoped API key as well as a signed-in member, because a deployed runtime is exactly the caller that needs to find its own agent.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
include_archived | query | boolean | Include archived agents (default false) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Define an agent on a project
POST/v1/projects/{id}/agents
Creates a named agent: its instructions, the model it runs on, optional opaque runtime config, and the allow-list of tools it may call. The allow-list is an allow-list on purpose — an agent starts with nothing, so a spec that later grows a transfer_funds tool does not silently hand it to a support agent defined last month. Tool names that are not in the active spec are accepted and reported back in unknown_tools rather than refused, so an agent can be defined before its spec is uploaded. Send ?tools=$all (or tools: ["$all"] in the body) to give the agent every tool the environment exposes at that moment — a snapshot, not a live grant, so tools the spec gains later still have to be added. A sub-agent's tools: ["$all"] takes all of its parent's tools. skills is the same kind of allow-list over the environment's skills, by name: names not in the environment are accepted and reported back in unknown_skills, ?skills=$all (or skills: ["$all"]) takes every skill the environment holds at that moment, a sub-agent's skills must be a subset of its parent's, and an agent with any skills is offered the skill tool without naming it in tools. Organization admin or project manager only: choosing what an agent may touch is a capability grant, the same class of decision as a client's grants.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
tools | query | string | Send $all to give the agent every tool in the environment, overriding the body's tools |
skills | query | string | Send $all to give the agent every skill in the environment, overriding the body's skills |
Request body (application/json)
Schema: api.createAgentRequest.
| Field | Type | Description |
|---|---|---|
config | integer[] | |
context_management | agent.ContextManagement | |
decision_model | string | |
description | string | |
fallback_model | string | |
fallback_on | string[] | |
guardrail_ids | integer[] | |
guardrails | integer[][] | |
instructions | string | |
judge_model | string | |
language | string | |
max_turns | integer | |
model | string | |
name | string | |
permitted_models | string[] | |
skills | string[] | |
stt_model | string | |
subagents | api.subAgentInput[] | |
surface | string | |
tools | string[] | |
tts_model | string | |
vision_enabled | boolean | |
vision_image_max_px | integer | |
vision_min_confidence | number | |
vision_model | string | |
voice_id | string | |
voice_input | boolean | |
voice_output | boolean |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Get one agent
GET/v1/projects/{id}/agents/{agentRef}
Returns a single agent by its numeric id, with its sub-agents and the guardrails that apply to it. Reachable by a project-scoped API key as well as a signed-in member.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data: agent.agentFamilyResponse |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Update an agent
PATCH/v1/projects/{id}/agents/{agentRef}
Changes an agent's identity, instructions, model, config, or tool allow-list. Every field is optional; only what you send changes. Sending tools REPLACES the allow-list rather than merging into it — unticking a tool in the dashboard must actually take it away — so send the complete list, or omit the field to leave it alone. ?tools=$all (or tools: ["$all"] in the body) replaces it with every tool the environment exposes right now (a snapshot, not a live grant). skills works the same way: sending it replaces the skill allow-list, and ?skills=$all (or skills: ["$all"]) replaces it with every skill the environment holds right now. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
tools | query | string | Send $all to replace the agent's tools with every tool in the environment, overriding the body's tools |
skills | query | string | Send $all to replace the agent's skills with every skill in the environment, overriding the body's skills |
Request body (application/json)
Schema: api.updateAgentRequest.
| Field | Type | Description |
|---|---|---|
config | integer[] | |
context_management | agent.ContextManagement | |
decision_model | string | |
description | string | |
fallback_model | string | |
fallback_on | string[] | |
guardrail_ids | integer[] | |
guardrails | integer[][] | |
instructions | string | |
judge_model | string | JudgeModel and DecisionModel: "" goes back to the project's choice. |
language | string | |
max_turns | integer | |
model | string | |
name | string | |
permitted_models | string[] | |
skills | string[] | |
stt_model | string | |
subagents | api.subAgentInput[] | |
surface | string | |
tools | string[] | |
tts_model | string | |
vision_enabled | boolean | |
vision_image_max_px | integer | |
vision_min_confidence | number | |
vision_model | string | |
voice_id | string | |
voice_input | boolean | |
voice_output | boolean |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Archive an agent
DELETE/v1/projects/{id}/agents/{agentRef}
Retires an agent: it stops resolving, so a runtime can no longer boot it, and it drops out of the default listing. The row is kept rather than deleted because the agent's name appears in the audit trail of every tool call it ever made, and removing it would leave those entries naming something that cannot be looked up. Restore with POST /projects/{id}/agents/{agentRef}/unarchive. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
The models a conversation with this agent may run on
GET/v1/projects/{id}/agents/{agentRef}/models
What the Playground's model picker offers: default is the model a conversation starts on (the agent's own, else the deployment's), options are the models a person may switch it to — the agent's permitted_models, or every model the deployment offers when that list is empty. The same answer the widget reads from GET /embed/agent, plus paid_by, which the widget is not given: for each offered model and the fallback, whose provider account pays for it — scope agent (this agent's own key) or parent (a sub-agent's parent's key), and the provider. A model missing from paid_by is paid for by this deployment. Send the choice as "model" on each turn; the agent is never changed. With one option or none, show no picker.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
List the provider accounts this agent pays for itself
GET/v1/projects/{id}/agents/{agentRef}/provider-keys
An agent's own provider keys: the accounts its calls are charged to instead of this deployment's credits. Who pays for a call is decided on every call, by the maker named in the model id (anthropic/* for an anthropic key, google/* for google-vertex or google-ai-studio, mistralai/* for mistral): the agent's own active key for that maker; else, for a sub-agent, its parent's; else this deployment. Disconnected keys are listed after live ones. The key itself is never returned: it is held by the gateway and Frege keeps only an identifier.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Connect a provider account this agent pays with
POST/v1/projects/{id}/agents/{agentRef}/provider-keys
Hands a provider key to the gateway, which encrypts and holds it; Frege keeps only the identifier that comes back. A parent and each of its sub-agents may each pay with a different account, even with the same provider. The agent is given a gateway key of its own the first time, and the provider key is scoped to it alone. The gateway is told never to use shared capacity for the models this key covers, and every covered call is pinned to this provider, so an outage fails the call rather than quietly moving it onto this deployment's credits. Only providers whose models can be told apart by the model id are accepted, since that is how a call is matched to the key that pays for it; any other is refused with 422 on provider. Sending the same provider twice for one agent is refused (409) while the first is live, paused included. The key is TRIED before it is kept: a one-token call to the cheapest few models the provider itself serves, paid with this key; a key that fails is switched off again and refused with 422 on key. A provider whose models the catalogue cannot confirm is kept unverified. Not carried over when an agent is copied to another environment.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Request body (application/json)
Schema: api.connectBYOKRequest.
| Field | Type | Description |
|---|---|---|
key | string | |
label | string | |
provider | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Pause or resume a provider account this agent pays with
PATCH/v1/projects/{id}/agents/{agentRef}/provider-keys/{keyID}
Pausing switches the key off at the gateway and stops pinning calls to it, without handing the key over again to resume. Paused, the agent's calls to that provider are paid by its parent's active key for it if it is a sub-agent that has one, and by this deployment otherwise; a sub-agent paid for by this key moves the same way. A paused key still holds its provider's place — a second key for the same provider needs this one disconnected. A disconnected key cannot be resumed (409): connect a new one. The gateway is changed first and put back if recording the change fails, so the dashboard never says paused while the tenant's account is still paying.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
keyID (required) | path | string | Provider key ID |
Request body (application/json)
Schema: api.setBYOKActiveRequest.
| Field | Type | Description |
|---|---|---|
active | boolean |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
Disconnect a provider account this agent pays with
DELETE/v1/projects/{id}/agents/{agentRef}/provider-keys/{keyID}
Switches the key off at the gateway, then records that it was. From that moment the agent's calls to that provider are paid by its parent's active key for that provider if it is a sub-agent that has one, and by this deployment otherwise. The row stays, so a tenant rotating a key can still see which provider it was for.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
keyID (required) | path | string | Provider key ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Run one turn of an agent inside Frege
POST/v1/projects/{id}/agents/{agentRef}/run
Executes the agent's model loop against this environment's own MCP server, so grants, the write policy, redaction and the audit trail all apply exactly as they would to a customer's client. The agent is handed ONLY the tools its allow-list permits, enforced by what the model receives rather than by what it is told. Either side can keep the conversation: omit session_id and pass the returned history back with the next turn, or send session_id "new" to have Frege store it and continue with the id it returns. A stored conversation belongs to the identity that spent the credential, so another customer presenting its id is refused. Reachable with a project-scoped API key, because a voice worker or SDK process is the caller this exists for.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Request body (application/json)
Schema: api.runAgentRequest.
| Field | Type | Description |
|---|---|---|
approvals | agent.Answer[] | |
attachments | integer[] | |
client_id | integer | |
history | agent.Message[] | |
identity | string | |
message | string | |
model | string | |
playground_session_id | string | |
session_id | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 400 | Bad Request | error envelope |
| 404 | Not Found | error envelope |
| 502 | Bad Gateway | error envelope |
Fetch an agent's boot payload
GET/v1/projects/{id}/agents/{agentRef}/runtime
Everything a runtime needs to start this agent in one request: its instructions, its model, its opaque runtime config, and the FULL definition of every tool its allow-list permits — tool_name, description, and JSON Schema input_schema — resolved against the project's active spec. This is what makes an agent editable without a redeploy: a LiveKit voice worker or an SDK process calls this at session start instead of hardcoding a persona and a tool list. Allow-list entries that no longer exist in the active spec are omitted from tools and named in unknown_tools. skills names the skills the agent may load, as stored. Reachable with a project-scoped API key.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Run one agent turn, streamed
POST/v1/projects/{id}/agents/{agentRef}/stream
Runs a turn exactly as POST /run does and reports it as Server-Sent Events instead of one body. Frames are JSON objects on a data: line with a "type" field: "session" once at the start carrying the conversation id, "text_delta" as the model produces text, "tool_call" when the model asks for a tool, "choices" when the model asks the person a question with clickable options rather than guessing an argument, "pending" when the turn paused for a person to approve a write, "error" if the turn failed, and "done" carrying the same result body /run returns. The stream ends after "done" or "error". Only this endpoint offers the model the question tool, because only a streamed caller can be shown the question and send back the answer.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Request body (application/json)
Schema: api.runAgentRequest.
| Field | Type | Description |
|---|---|---|
approvals | agent.Answer[] | |
attachments | integer[] | |
client_id | integer | |
history | agent.Message[] | |
identity | string | |
message | string | |
model | string | |
playground_session_id | string | |
session_id | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | Server-Sent Events | |
| 400 | Bad Request | |
| 404 | Not Found |
Restore an archived agent
POST/v1/projects/{id}/agents/{agentRef}/unarchive
Brings a retired agent back: it resolves again and reappears in the default listing, with its instructions and tool allow-list exactly as they were. Organization admin or project manager only.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Open a live voice session with an agent
POST/v1/projects/{id}/agents/{agentRef}/voice-session
Mints a short-lived LiveKit access token so a browser can talk to this agent out loud, and asks LiveKit to dispatch the agent's worker into a freshly created room. Speech runs in Frege's voice worker (frege-voice), which LiveKit dispatches under the agent's dispatch name (config.livekit_agent_name, defaulting to frege-voice, the worker's own default) and which reaches back through /voice/calls/{room} with the deployment's worker secret; the agent's answers are ordinary turns, with its grants, guardrails and audit trail. The room name is unique per session on purpose: LiveKit applies a token's dispatch instruction only when the room is first created, so reusing a name would connect a browser to a room no agent ever joins. Returns 503 when the deployment has no LiveKit or no voice worker secret configured. 409 when the agent's environment has no speech vendor chosen or connected for what it must hear or say, so nobody waits in a room the worker will refuse. Every session is recorded as a voice call, timed by LiveKit's webhooks. Organization admin or project manager only — a session spends real vendor minutes and a real customer credential.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
agentRef (required) | path | string | Agent ID |
Request body (application/json)
Schema: api.voiceSessionRequest.
| Field | Type | Description |
|---|---|---|
client_id | integer |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 409 | Conflict | error envelope |
| 422 | Unprocessable Entity | error envelope |
| 503 | Service Unavailable | error envelope |
Files attached to one conversation
GET/v1/projects/{id}/attachments
Everything bound to the given conversation, oldest first. Unbound uploads are not listed: until a turn carries one it belongs to nothing.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
session_id (required) | query | string | Conversation id |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
Attach a file to a conversation
POST/v1/projects/{id}/attachments
Uploads one file for an agent conversation in this environment and returns its id, which the next turn passes in "attachments". Multipart, field name "file". Text goes through untouched — it is read here, instantly and at no cost — and HTML has its markup stripped. Anything that is not text is sent to the document reader and comes back as Markdown: PDFs, Office files, slide decks, scans, images with text in them. A recording — audio (OGG, MP3, WAV, M4A, AAC, FLAC, AIFF) or video (MP4, MOV, WebM, MPEG) — is heard by the deployment's transcription model instead and comes back as its transcript, a sentence or two a line, each with the time it starts at; one over 14 MB or 30 minutes, of another format, or sent to a deployment with no transcription model is refused with the reason. Archives and programs are still refused by name with advice, because nothing can read a document out of them. A deployment configured with no document reader takes text only and says so rather than pretending. WHAT IS LIMITED IS THE TEXT, not the upload. A file becomes part of the system prompt and stays there for the whole conversation, where the context trimmer cannot reach it, so a document that converts to more text than may be carried is REFUSED with its size rather than quietly cut in half — half a contract answers questions about the whole one, confidently and wrongly.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/x-www-form-urlencoded)
Type: string.
Request body (multipart/form-data)
Type: object.
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 400 | Bad Request | error envelope |
| 404 | Not Found | error envelope |
| 413 | Request Entity Too Large | error envelope |
| 422 | Unprocessable Entity | error envelope |
Remove an attachment
DELETE/v1/projects/{id}/attachments/{attachmentID}
Deletes the stored text and the original bytes. A conversation that already ran with this file keeps whatever it said about it; the file itself stops being sent with later turns.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
attachmentID (required) | path | integer | Attachment ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error envelope |
List the current user's chats on a project
GET/v1/projects/{id}/chats
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
Start a chat on a project
POST/v1/projects/{id}/chats
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.createChatRequest.
| Field | Type | Description |
|---|---|---|
agent_id | string | |
client_id | integer | |
title | string |
Responses
| Status | Description | Body |
|---|---|---|
| 201 | Created | data |
| 404 | Not Found | error envelope |
Get a chat and its messages
GET/v1/projects/{id}/chats/{chatID}
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
chatID (required) | path | integer | Chat ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
Send a message
POST/v1/projects/{id}/chats/{chatID}/messages
Streams the assistant's reply as server-sent events (text_delta, tool_call, tool_result, title, error, done). Anyone who may read this environment but not write it gets a read-only assistant: it explores the API and searches documentation but never executes operations.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
chatID (required) | path | integer | Chat ID |
Request body (application/json)
Schema: api.sendMessageRequest.
| Field | Type | Description |
|---|---|---|
message | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | SSE stream | |
| 404 | Not Found | |
| 422 | Unprocessable Entity |
LLM usage statistics in this environment
GET/v1/projects/{id}/llm-usage
LLM usage of this environment as four views over the same filtered set of calls: totals, a per-model breakdown (models), a per-client breakdown (clients) and a per-provider breakdown (providers). Every model call made through the gateway is one call: a turn that uses tools or falls back to another model makes several, and a failed call is counted too (in calls and failed_calls). Statistics only; individual calls are not listed. The environment comes from the X-Frege-Stage header, or the stage query parameter: live (the default) or staging. A call on staging is never counted with live. model_name matches part of the requested or the served model, case-insensitively, e.g. deepseek or claude. client_id keeps only the calls made for that client. q searches the client a call ran for: identifier, name, email, subject, and every identity their sign-in captured. identifier finds calls by the client's identity as the upstream sign-in captured it — any key of the client's identities (phone, email, username, name, subject or one an update_client step recorded), or the identifier guessed at sign-in. Part of a value matches, and a phone matches with or without spaces and plus. identifier_kind narrows it to one key. from and to bound when the call was made, as [from, to), and apply to totals, models, clients and tool_calls alike. A bare date is a UTC day, and as to it includes that whole day: from=2026-09-01&to=2026-09-30 is the whole of September. Calls that ran for no client — a project member in the console, or an eval run — match no client filter: with client_id, q or identifier set they are left out of totals and models too. models is one row per requested model, e.g. openai/deepseek/deepseek-v4-flash-0731. more_usage orders it by total tokens and model_usage by model name, each asc (the default when the parameter is present) or desc; both together order by usage first. Neither: heaviest first. clients is every client of the project in this environment, revoked ones included (revoked_at is set), each with their usage, heaviest first and then by client_id. A client with no matching call is listed with zeros and null first_used_at and last_used_at. client_id, q and identifier pick which clients are listed; model_name, from and to only narrow the calls counted for each. Calls with no client count in totals and models but appear in no client row. totals.tool_calls is how many tool calls in this environment the upstream answered with a 2xx status (200–299), from the audit trail (project.tool.call); denied, invalid, failed and non-2xx calls are not counted. It is a total for the environment, not per model or per client row: from, to, client_id, q and identifier apply to it; model_name does not. Every row — totals, each model, client, provider — carries paid_by: the same calls split by who paid. own_key is paid with one of the project's own provider keys (Settings → provider keys) and charged to that provider account; frege is paid out of Frege's credits. A call lands on a side when the gateway prices it, so a call not priced yet is in neither: own_key.calls + frege.calls + unpriced_calls = calls, less the failed calls the gateway refused before starting a generation, which cost nothing and have no price to wait for. paid_by=own_key or paid_by=frege keeps only those calls everywhere; it leaves out calls not priced yet. providers is one row per provider that served the calls (openai, anthropic, groq…), heaviest first; a project key is for one provider, so a row's paid_by.own_key is what that key paid. provider is null for calls not priced yet. total_cost_usd sums only the calls the gateway has priced, never an estimate. A call is priced shortly after it is made, by a background sweep that asks the gateway for its cost; until then, or if the gateway never reports one, it is counted in unpriced_calls. A failed call the gateway refused outright has nothing to price and is not counted there. coins are charged for successful calls only. Every row also carries share: the same calls split by whose they were (ADR-0042 §7). workflow is what the environment's setup asked for — the agents' turns, the judge on their guardrail rules, transcribing an upload, an eval run; frege is machinery Frege adds on its own — picking a large catalogue's tools for a turn, the decision model shadowing the judge, a chat's title. workflow.calls + frege.calls = calls. cached_input_tokens of input_tokens were read from the provider's prompt cache and cache_write_tokens written to it, where the provider reports them. conversations counts the conversations the calls belong to and conversation_cost_usd is what those calls cost; a call outside a conversation (an eval run, a skill draft) is in neither. totals also carries what these come to: cost_per_conversation_usd (conversation_cost_usd / conversations), frege_share (share.frege.total_cost_usd / total_cost_usd, from 0 to 1) and cache_hit_rate (cached_input_tokens / input_tokens); each is 0 when there is nothing to divide by. session_id keeps one conversation's calls: the session of an agent's turns (the session its run returned), or chat:<id> for a console or widget chat. With it, totals is that conversation's cost, split into workflow and frege; it does not apply to tool_calls.
Example response:
json
{"data": {
"totals": {"calls": 8, "failed_calls": 1, "input_tokens": 103534, "output_tokens": 10986, "total_tokens": 114520, "total_cost_usd": 0.0067625, "unpriced_calls": 0, "coins": 21, "tool_calls": 3},
"models": [
{"model": "openai/deepseek/deepseek-v4-flash-0731", "calls": 8, "failed_calls": 1, "input_tokens": 103534, "output_tokens": 10986, "total_tokens": 114520, "total_cost_usd": 0.0067625, "unpriced_calls": 0, "coins": 21, "first_used_at": "2026-09-10T08:25:24.825118Z", "last_used_at": "2026-09-10T08:32:02.070248Z"}
],
"clients": [
{"client_id": 19480, "identifier": "998901234567@cinerama.uz", "name": "Customer", "revoked_at": null, "calls": 5, "failed_calls": 0, "input_tokens": 70210, "output_tokens": 7420, "total_tokens": 77630, "total_cost_usd": 0.0045812, "unpriced_calls": 0, "coins": 15, "first_used_at": "2026-09-10T08:25:24.825118Z", "last_used_at": "2026-09-10T08:30:11.402113Z"},
{"client_id": 19526, "identifier": "936065604@cinerama.uz", "name": "Customer", "revoked_at": null, "calls": 0, "failed_calls": 0, "input_tokens": 0, "output_tokens": 0, "total_tokens": 0, "total_cost_usd": 0, "unpriced_calls": 0, "coins": 0, "first_used_at": null, "last_used_at": null}
]
}}Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
model_name | query | string | Part of the requested or served model, case-insensitive, e.g. deepseek or claude |
client_id | query | integer | Only calls made for this client; also lists only this client |
q | query | string | Search the client's identifier, name, email, subject and identities |
identifier | query | string | The client's identity from the upstream sign-in: part of a phone, email, username, name or subject |
identifier_kind | query | string | Match identifier against one identity key only, such as phone, email or client_id |
from | query | string | Only calls at or after this moment: RFC 3339 (2026-09-01T00:00:00Z) or a date (2026-09-01, midnight UTC) |
to | query | string | Only calls before this moment: RFC 3339, or a date, which includes that whole day (UTC) |
paid_by | query | string | Only calls paid this way: with the project's own provider key, or out of Frege's credits One of: own_key, frege. |
session_id | query | string | Only the calls of this conversation: an agent's session, or chat:<id> |
more_usage | query | string | Order models by total tokens One of: asc, desc. |
model_usage | query | string | Order models by model name One of: asc, desc. |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
LLM usage over time in this environment
GET/v1/projects/{id}/llm-usage/series
Usage of every model call this environment made through the gateway, summed per time bucket for a line graph. The environment comes from the X-Frege-Stage request header, default production. interval is the width of one point: hour, day (the default), week (starting Monday) or month. Buckets are cut in UTC. Every bucket in the window is returned, zeros where no call was made, so the line has no gaps. Each point's bucket is the start of its period. from and to bound the window, as on GET /projects/{id}/llm-usage: RFC 3339, or a bare date taken as a UTC day, with to including that whole day. Without to, the window runs to the end of the current hour, day, week or month (UTC); without from, it reaches back so the graph holds the last 12 hours, 7 days, 4 weeks or 12 months, the current one included. At most 1000 points per request. client_id keeps only the calls made for that client, as on GET /projects/{id}/llm-usage; without it every call in the environment is counted, whatever the customer. The model is never filtered. Each point carries paid_by, the same calls split into own_key (paid with the project's own provider key) and frege (Frege's credits), as on GET /projects/{id}/llm-usage; paid_by=own_key or paid_by=frege draws only that side.
Example response (interval=day&from=2026-09-08&to=2026-09-10):
json
{"data": {
"interval": "day", "from": "2026-09-08T00:00:00Z", "to": "2026-09-11T00:00:00Z",
"points": [
{"bucket": "2026-09-08T00:00:00Z", "calls": 0, "failed_calls": 0, "input_tokens": 0, "output_tokens": 0, "total_tokens": 0, "total_cost_usd": 0, "unpriced_calls": 0, "coins": 0},
{"bucket": "2026-09-09T00:00:00Z", "calls": 0, "failed_calls": 0, "input_tokens": 0, "output_tokens": 0, "total_tokens": 0, "total_cost_usd": 0, "unpriced_calls": 0, "coins": 0},
{"bucket": "2026-09-10T00:00:00Z", "calls": 8, "failed_calls": 1, "input_tokens": 103534, "output_tokens": 10986, "total_tokens": 114520, "total_cost_usd": 0.0067625, "unpriced_calls": 0, "coins": 21}
]
}}Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
interval | query | string | Width of one point One of: hour, day, week, month. |
from | query | string | Start of the window: RFC 3339 or a date (UTC) |
to | query | string | End of the window: RFC 3339, or a date, which includes that whole day (UTC) |
paid_by | query | string | Only calls paid this way: with the project's own provider key, or out of Frege's credits One of: own_key, frege. |
client_id | query | integer | Only calls made for this client |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Models this project can run
GET/v1/projects/{id}/models
The same models as /models. Who pays for each is no longer the project's to say: provider keys belong to agents, so it is per agent, in paid_by on GET /projects/{id}/agents/{agentRef}/models. roles: for each role (chat, judge, decision, transcription, embedding), chosen is the project's own choice (null for none, PUT /projects/{id}/models) and model_id what the role resolves to for the project, from project, organization or platform (ADR-0039); an agent's own judge_model and decision_model, and its model for chat, come before.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
Choose the project's model for a role
PUT/v1/projects/{id}/models
Who may change the project's settings (project.edit): a manager or developer of one of its stages, or the organization's admin; 404 for a caller who cannot see the project, 403 for one who cannot change it. As PUT /orgs/{orgID}/models, for the project: its choice comes before its organization's, and an agent's own (judge_model, decision_model, model) before the project's. A new embedding model embeds the project's documents again in a space of its own, and no other project's.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: llm.modelChoiceRequest.
| Field | Type | Description |
|---|---|---|
model_id | string | ModelID is a model's id (GET /models, choosable): a registry model, or a catalogue model, which joins the registry the first time it is chosen; null clears the choice. |
role | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Recommend models by what matters to you
POST/v1/projects/{id}/models/recommend
Ranks the models this deployment offers by the gateway's own data, without running anything. Constraints remove a model outright; weights (0–5 each) say how much each criterion counts, and all zero means price 3, speed 2, reliability 2, recency 1. A model that cannot call tools, cannot be made to (tool_choice), or is withdrawn within expiring_within_days (default 30) is never recommended. Free models are left out unless include_free: they are rate-limited too hard to carry an agent.
Accuracy is not a criterion, because the gateway has no data on it: how well a model does on THIS API is what an evaluation run measures. Speed, reliability, redundancy and precision come from each model's providers and are read only for the best measured of the shortlist by the other criteria; a criterion the gateway does not report scores as the middle of the field and its score is null. zdr keeps models a zero-data-retention endpoint can serve with tools — it does not route this deployment through one; the source's zdr ([models.sources.<name>] zdr) does.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.recommendModelsRequest.
| Field | Type | Description |
|---|---|---|
constraints | llm.Constraints | |
limit | integer | |
weights | llm.Weights |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 422 | Unprocessable Entity | error envelope |
| 503 | Service Unavailable | error envelope |
The portal's agent
GET/v1/projects/{id}/portal-config
The agent new portal conversations run on in this environment; null for none. agent is null too when the environment no longer has the agent.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
Choose the portal's agent
PUT/v1/projects/{id}/portal-config
New portal conversations run on this agent of the environment; existing ones keep theirs. null or "" clears the choice; an agent the environment does not have is 422.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
Request body (application/json)
Schema: api.portalConfigRequest.
| Field | Type | Description |
|---|---|---|
agent_id | string |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 400 | Bad Request | error envelope |
| 401 | Unauthorized | error envelope |
| 403 | Forbidden | error envelope |
| 404 | Not Found | error envelope |
| 422 | Unprocessable Entity | error envelope |
What has run in this environment
GET/v1/projects/{id}/runs
Newest first. Every trigger lands here — a playground session, an agent turn, an eval iteration, a hook's or a schedule's proactive run — so one screen answers "what did it do yesterday" whatever surface did it. Filter by trigger, or by session_id to read one conversation back in order. How long these are kept is the environment's own retention setting.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
trigger | query | string | playground, agent, eval, hook or schedule One of: playground, agent, eval, hook, schedule. |
session_id | query | string | Only runs in this conversation |
page | query | integer | Page to return, 1-based (default 1) |
page_size | query | integer | Rows per page (default 50, max 100) |
sort | query | string | Order: started_at, id, each also accepted with a leading - for descending |
limit | query | integer | DEPRECATED, use page_size. Max runs per page (max 100) |
offset | query | integer | DEPRECATED, use page. Rows to skip |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 422 | Unprocessable Entity | error envelope |
One run
GET/v1/projects/{id}/runs/{runID}
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
runID (required) | path | integer | Run ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
A run's messages, in order
GET/v1/projects/{id}/runs/{runID}/events
What was sent and what came back. after is the last sequence number already seen, so a browser polls for what it does not have instead of re-reading the log. A run's dropped count is what will never appear here — messages that happened and were not kept — so a reader can say "earlier messages are gone" rather than assume the list is complete.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
runID (required) | path | integer | Run ID |
after | query | integer | Last sequence number already seen |
limit | query | integer | Default and maximum 500 |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
List the project's tasks
GET/v1/projects/{id}/tasks
Recent long-running operations for this project, newest first: what ran, who ran it, and how it ended. The MCP protocol deliberately has no tasks/list — an AI client holds only an opaque task id and there is no scope a server could safely list against — but a project membership IS such a scope, which is why the dashboard can offer this and the protocol cannot. Requires inspect access.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
page | query | integer | Page to return, 1-based (default 1) |
page_size | query | integer | Rows per page (default 50, max 200) |
sort | query | string | Order: created_at, updated_at, status, id, each also accepted with a leading - for descending |
limit | query | integer | DEPRECATED, use page_size. Max tasks per page (max 200) |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
Read one task
GET/v1/projects/{id}/tasks/{taskID}
The current state of a long-running operation. Poll this at poll_interval_ms until terminal is true, then read result (on completed) or error (on failed). This is the dashboard's counterpart to the protocol's tasks/get, scoped to a project the caller belongs to. Requires inspect access.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
taskID (required) | path | string | Task ID |
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |
| 404 | Not Found | error envelope |
Ask a task to stop
POST/v1/projects/{id}/tasks/{taskID}/cancel
Records the intent to cancel. Nothing is killed mid-flight — the runner notices on its next heartbeat and unwinds — so an upstream write already in progress is never left half-done. Poll the task to see it reach cancelled. A task that already finished is not cancellable and returns 404. Requires edit access.
Authentication: bearer token.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
id (required) | path | string | Project ID |
taskID (required) | path | string | Task ID |
Responses
| Status | Description | Body |
|---|---|---|
| 204 | No Content | |
| 404 | Not Found | error envelope |
Providers available for BYOK
GET/v1/providers
Provider names a tenant can connect their own API key under. Derived from the live model catalogue: every vendor that has at least one model in this deployment's catalogue appears here. Pass one of these as provider when connecting a provider key on an agent.
Authentication: bearer token.
Responses
| Status | Description | Body |
|---|---|---|
| 200 | OK | data |