Skip to main content

Channels, models, and policies

Applies to

Aivory v2.4.7 and later. This covers the "AI & models" rail: Channels / Models / Model tags / Model policy / Context & memory / Moderation. Screenshots show the Chinese admin UI unless noted; English labels are cited inline.

A channel stores "how to connect to an upstream provider" (protocol type + Base URL + credentials); a model stores "which specific model can be called through that connection" (request ID + capabilities + pricing + policy). Managing them separately lets the same model ID coexist across different accounts, regions, gateways, or cost policies.

The minimum conditions for users to chat: an enabled, working channel; at least one enabled chat model linked to it; and a valid "Default chat model" in the model policy. Full walkthrough: Administrator first-run setup.

Planning channels

ScenarioRecommendation
Same provider, prod and test keysTwo channels, names marking the environment; never let a test key back the default model
Same model reachable via two gatewaysTwo channels + two model records for independent ordering, disabling, or fallback
Splitting by team, region, or costOne channel per contract, region, or budget pool
Provider offers no model-listing endpointKeep the channel and "New model" manually; list import is not a precondition for using a channel

Channel API keys belong only in the admin UI (stored server-side in the channel record; the UI shows masked state). Never put provider keys into VITE_* variables, frontend pages, public examples, browser request parameters, or application logs.

Creating a channel: field-by-field

The dialog shares these fields across all types:

FieldDescriptionExampleDefault
NameAdmin-facing label; never affects requestsOpenAI prodrequired
TypeUpstream protocol family: OpenAI / Claude / Gemini / Mock, etc.OpenAIrequired
API formatChat models only; selects the conversation protocol variantchat / responsesper type
Base URLUpstream API root; blank uses the vendor defaulthttps://api.openai.com/v1vendor default
API keyServer-side secret; blank when editing keeps the saved keysk-…empty
EnabledDisabling instantly removes every model under it from new requestsonon
  • Set Type to OpenAI; nearly every compatible gateway (Azure-compatible endpoints, one-api-style routers, local Ollama/vLLM OpenAI endpoints) lives in this family.
  • Base URL: the upstream API root, which may end in /v1, /v2, /v3, or a custom gateway path; blank means https://api.openai.com. Pasting the web console address instead of the API address is the single most common mistake.
  • API format: OpenAI has two conversation protocols (chat completions vs responses). Trust the provider docs; the same model name does not imply both work.
  • To also use embedding or image capabilities from this channel, just create models of those kinds under it — the channel itself doesn't switch.

Channel list and editor: type, API format, Base URL, API key

Channel list and editor dialog. "Key set / no key" shows state only; key contents are never echoed back.

Validate immediately after saving

  1. Save and enable the channel.
  2. Click "Fetch from upstream" in the dialog: a returned model list proves address, key, and network all work.
  3. A failed listing does not mean the channel is unusable — many providers restrict listing. Add one known model ID and send a real short request to verify network, auth, model entitlement, and quota.

Model discovery and bulk import

Three paths:

  • Fetch models from a channel (recommended for routine deltas): on "AI & models → Models", choose a saved channel; Aivory reads its current upstream list, separates "available / already added", and hides entries Aivory doesn't support yet. Bulk-add what you tick; duplicates are skipped with an explicit report.
  • "Fetch from upstream" inside the channel editor: tick models while creating the channel — best for first-time onboarding.
  • Manual "New model": for providers with no listing endpoint, private gateways, or inference-only keys.
Import is not judgment

Auto-import doesn't decide what should be user-visible, whether a model is chat/image/embedding, or whether pricing and context descriptions are right. Review enabled state, capability flags, and billing fields record by record before exposing anything.

Models list: channel, capabilities, and enabled state per model

Models list. The same request ID can exist once per channel without conflict.

Model record fields

The editor is grouped into Basic / Chat behaviour / Pricing / Permissions / Tags / Skills / Image generation. Core fields:

FieldDescriptionExampleDefault
ChannelUpstream used for requestsOpenAI prodrequired
Fallback channelRetries automatically before the user sees an error; must match the primary channel's type and format — only URL and key may differbackup gatewaynone
Kindchat / image / embeddingchatrequired
Label / request_idDisplay name for humans; the request ID is the literal model ID sent upstreamGPT flagship / real IDrequired
Tool modenative (function calling) / prompt (simulated) / nonenativeper kind
Built-in toolsPlatform tools pre-ticked for this model ("default all" or custom)customall
MCP toolsMCP services pre-ticked for this model; only globally enabled, already-synced services can runcustomoff
Provider-hosted toolsNone by default; add explicit request JSON per tool only after its own security reviewempty
Vision / Stream / Deep researchCapability declarations affecting upload entry and research modeonper model
Fast modelMarks THE model for "Fast" mode: hidden from the advanced picker, name never shown to users, deep research forced offno
System promptAppended to every request for this modelempty
param_controls / extra upstream params (JSON)User-adjustable parameter mapping and merged extra JSON; precedence: built-in params > param controls > extra params{"temperature":0.7}empty
DimensionRequired for embedding models; must equal the model's real output size1536
Compaction threshold (tokens)Overrides the global trigger for this model; 0 = use global0
Input/output/cache-read/cache-write price per 1M, price per imageDrive credit deduction and the Usage & billing analyticsper provider0
Enabled (visible to users)Off removes it from pickers and new requestson
The classic mis-flag symptom

"A model appears in the picker but the first request fails" almost always means capability flags disagree with the upstream: non-function-calling models marked native, chat models marked embedding, or assuming every model handles vision/JSON/streaming. Run one minimal request per claimed capability.

Model policy and context compaction

"AI & models → Model policy" holds system-level model selection. Empty slots fall back to the conversation model (or task model) as labeled; the default chat model is the only hard requirement:

FieldPurposeGuidance
Default chat modelMain model for new conversationsvalidated, cost-controlled
Title generation modelTitles in the conversation listlow-latency, non-thinking
Query routing modelDecides whether a query needs tools in auto modelow-latency, non-thinking
File routing modelChooses skip / snippet retrieval / full-text before assembling file contextreliably emits JSON
Other internal task modelMemory extraction, research planning and verification, search query generationstable mid-tier
Verify (auditor) modelSecond model auditing answers in review modepick "None" to disable
Image prompt modelPolishes prompts before drawing"None" to skip
Default tool modeDefault tool-calling mode for new chats (auto / on / off)auto

Model policy page with the internal task model slots

"AI & models → Context & memory" governs long-conversation compaction and memory. Key values and defaults:

FieldDescriptionDefault
Enable compaction / Enable memoryMaster switcheson / on
Keep recent roundsRecent turns preserved verbatim during compaction6
Compact above (tokens)Estimated prompt size that triggers compaction32000
Target low-water (%)Post-compaction target as a share of the trigger (25–80)
Retain latest messages (%)Share of newest messages kept verbatim (10–50)
Summary output capMax output tokens per summarization request8192
Compaction request budgetTotal input + reserved output budget per background summary request
Summary modelBlank uses the current conversation modelempty

Context & memory page: compaction thresholds and summary model

Ordering, tags, visibility, and quotas

  • Model tags ("AI & models → Model tags") feed picker filters — make operational semantics like "recommended / economy / long-context / image" explicit.
  • Visibility and per-model allowances go through user groups and the model's Permissions block: model-group quotas (by cost or call count, rolling window) decide which groups may use a model and whether overage burns credits or is refused. See Plans, credits, and payments.
  • Start by exposing only a few validated models; widen by cost, context, speed, or data-handling boundaries.

Models list rendered in the English admin UI

Change management and troubleshooting

The safe channel/model change flow:

  1. Record the current default model, every policy slot, and the plans, workspace policies and quotas referencing the model.
  2. Create or edit the channel and store new credentials.
  3. Send short requests with the target model; check streaming, tools, image, or embedding behavior in practice.
  4. Only then change enabled state, ordering, and global policies.
  5. Watch Usage, error records and user feedback; retire the old channel/model once steady. When rotating keys, validate the new key before disabling the old credential — never delete your way out of a live conversation.

Common test-connection failures

SymptomCheck first
401 / auth failureKey copied fully and not revoked; leaving the key blank while editing keeps the old value — it does not clear it
404 / model not foundrequest_id matching provider docs character-for-character; right API format (chat vs responses)
Base URL errorsConsole web address pasted instead of API root; missing version path a gateway requires
Listing fetch failsWhether the provider allows listing, server egress and DNS, inference-only key
Timeouts / dropped streamsNetwork path and proxy timeouts; a reverse proxy buffering the SSE stream (Domain, HTTPS, and OAuth)
Models exist but chat failsModel kind, enabled state, channel enabled state, default policy pointing at it
Same ID hits the wrong upstreamThe channel linked to the model record — not the display name
Fallback channel never firesFallback must share the primary channel's type and API format, or it won't retry
Disable/delete blast radius

Disabling a channel instantly makes all its models unusable for new requests; deleting a channel cascades to its model records. Before disabling or deleting a model, confirm no policy slot, verifier, image-prompt or summary model, workspace policy, plan quota, or user favorite references it.