AI / User guide
AI gateway and models
Route AI requests through configured providers, models, application keys, and organization policies.
On this page
Before you begin
Connect an AI provider, configure allowed models, and have credentials with permission to manage gateway routes and application keys.
Get started
- Add or select a provider and validate its credentials.
- Choose a model and configure the intended route.
- Create a scoped application key and apply applicable guardrails and budget settings.
- Send a test request through the gateway and inspect route/model evidence and usage.
Operate the service
Review usage attribution and failures by route and model. Rotate application keys independently of provider credentials. Test a replacement route before directing production applications to it. Configure policy before granting applications access.
Connect Tailscale Aperture
Choose Tailscale Aperture (under *On your tailnet*) when adding a gateway provider, or use the CLI below. The form lists your tailnet's nodes from the tailnet provider connection and you pick the Aperture node; the base URL is derived from its MagicDNS name. anchras ai providers aperture-nodes prints the same listing. Keep the provider slug tailscale-aperture; it selects Tailscale identity authentication and the transport restricted to tailnet addresses. The base URL can be the Aperture origin or end in /v1.
Aperture is reached through the same dial path as a local inference server (ADR-058). Which path applies depends on where the control plane runs and who owns the tailnet:
- A self-hosted control plane that is a member of the tailnet (including a
Headscale network) connects directly with its own Tailscale identity.
- On the hosted service, an Anchras-managed tailnet is reached through an
egress agent, as described for a customer-owned tailnet below. Each organization gets its own managed tailnet and the hosted control plane is not a member of it; tailnet addresses are unique only within one tailnet, so Anchras does not connect directly.
- On a customer-owned tailnet the hosted server is not a member. Anchras
then opens a reverse tunnel through one of your enrolled Anchras host agents on the same tailnet — the *egress agent* — which connects to Aperture from its own Tailscale node. The newest heartbeating agent on that tailnet is chosen per connection. It must run a release that supports peer tunnels; an older agent rejects the command and the request fails with that reason.
This integration does not enroll the server, configure Aperture, or provision a per-organization Tailscale node. Saving the provider runs a reachability check: an endpoint with no inventoried device, or no egress agent on a tailnet the control plane is not a member of, is refused with the named reason instead of failing on first use.
Configure your models and provider credentials in Aperture, and grant access to the Tailscale identity Aperture will see: the server's node when a self-hosted control plane connects directly, or the egress agent's node (or its tag) when the connection goes through the egress-agent tunnel. Anchras sends no provider bearer token or API key to Aperture, even if a legacy credential binding exists. New credential bindings are rejected for this provider. Applications still authenticate to Anchras using their scoped application keys. Aperture identifies the connecting node, not the individual Anchras user; application attribution stays in Anchras.
# Which node, which reach path, and the URL each node would use.
anchras ai providers aperture-nodes
anchras ai providers create \
--slug tailscale-aperture \
--name 'Tailscale Aperture' \
--base-url 'http://aperture.your-tailnet.ts.net/v1'
# Replace PROVIDER_ID with the ID returned above.
anchras ai providers discover --id PROVIDER_ID
# Replace MODEL_SLUG with a model configured in Aperture for OpenAI Chat.
anchras ai models create --provider PROVIDER_ID \
--slug MODEL_SLUG --name 'Aperture model' --capabilities-json '{"chat":true}'
# Replace MODEL_ID with the ID returned by models create.
anchras ai gateway create --scope-kind org \
--match-model MODEL_SLUG --primary-target MODEL_ID
anchras ai gateway smoke --kind chat --model MODEL_SLUGThe API equivalents are AIProviderService/CreateProvider, AIProviderService/ListProviderModels, AIModelService/CreateModel, and AIGatewayService/CreateRoutingPolicy. Discovery lists available models without registering them; the dashboard also offers optional automatic import.
For Chat Completions, choose Aperture models supporting openai_chat. The Anchras Messages adapter also translates requests into that upstream format. Discovery alone does not guarantee that a model supports every gateway operation. Embedding support through Aperture must be verified separately. The gateway does not expose Responses or native Anthropic, Gemini, or Bedrock forwarding through this integration. MCP connectors and Aperture administration are not added. The gateway's existing buffering behavior remains in effect.
The Aperture node must be in your organization's tailnet device inventory. Saving the provider imports it for you: Anchras looks the hostname up in your tailnet through the Tailscale provider connection and records the node (TailnetService/ImportDevice). If your tailnet record has no MagicDNS suffix yet, the import learns it from the node's name, so the MagicDNS URL resolves through the inventory afterwards. Discovery only reads the inventory; if the node's address changes later, re-run the import to refresh it. Importing by hand is also the path when the hostname is ambiguous:
anchras networks devices import --hostname aperture
# or, when two nodes share a hostname
anchras networks devices import --provider-device-id <id>Only resolved addresses that match that inventory are eligible for dialing; other Tailscale addresses are excluded, including uninventoried secondary addresses of dual-stack devices. Requests to another organization's device are rejected, even when the server can reach it. DNS answers containing any address outside Tailscale's IPv4 or IPv6 ranges are rejected entirely.
DNS and current ownership are checked on every direct connection. Over the egress-agent tunnel the destination is fixed server-side to the inventoried Tailscale address of the Aperture device, the agent accepts only a peer node of its own tailnet reached by that node's host route (never itself, never a subnet route), and the dial goes through the agent's tsnet node so it cannot fall back to the host network. Connections are not reused across requests; environment HTTP proxies are bypassed and redirects are rejected. Public URLs, loopback bridges, subnet-routed private addresses, and cloud metadata endpoints are not supported by this provider. HTTP within the tailnet uses Tailscale's encrypted connection; HTTPS is also accepted and stays end-to-end through the tunnel.
Check Aperture's own retention and model-provider settings separately. The Anchras payload-retention setting does not configure Aperture. Using a tailnet does not determine where an upstream model processes data or its sovereignty preference. If Aperture must enforce every request, do not configure a direct provider fallback that bypasses it.
See Tailscale's getting-started guide, identity and routing explanation, and provider compatibility reference.
Availability and limits
Model availability, context limits, latency, and cost depend on the provider. A catalog model entry does not guarantee that credentials can invoke it. Budget and policy configuration must match the intended organization and applications.
Troubleshooting
For a rejected request, distinguish authentication, guardrail denial, budget policy, and provider errors. For a missing model, inspect provider availability and the selected route.
Next steps
Use the CLI guide to automate repeatable work, or the API guide to integrate Anchras with your own tools.
CLI commands
Install and authenticate using the CLI guide. The table describes command families; required arguments are shown in their usage output.
| Command | Purpose |
|---|---|
ai providers list / get / create / update / delete / discover / aperture-nodes / credentials | AI provider registry and BYO credential references via AIProviderService. discover --id lists the provider's models; aperture-nodes lists the organization's tailnet nodes as Tailscale Aperture candidates with the base URL each would use, and states the reach path (direct, or a peer tunnel through an egress host agent) before you save. Credential verbs are credentials list, credentials create, and credentials delete; omitted update flags preserve the current provider fields. |
ai models list / get / create / update / delete | AI model registry via AIModelService; use --provider to bind/filter models, and omitted update flags preserve the current model fields. |
ai gateway list / get / create / update / delete / payload | AI routing policies and retained gateway payload inspection via AIGatewayService. Omitted update flags preserve current routing fields. payload --payload-ref ai-gateway-payload:<id> reveals the redacted retained request/response body while recording a payload-read audit event. Routing policies are organization configuration; a project-scoped policy names a project of the organization (--scope-kind project --scope-id <id or slug>, an unknown or foreign project is not_found), and list --project shows only the policies scoped to that project (only when named: never the profile's saved project). A gateway request's x-anchras-project header must name a project of your organization you can reach; an unknown or foreign id is a 400. |
ai guardrails list / get / create / update / delete / evaluate | Guardrail policy CRUD and DSL evaluation via AIGuardrailService; omitted update flags preserve the current policy fields. |
ai usage query / export / signals / budget-get / budget-set | Usage aggregation, CSV/JSON export, live spend pacing/anomaly signals, and budget CRUD via AIUsageService; supports --dimension, --filter-kind, --filter-id, --start, and --end. --project (id or slug; only when named, never the profile's saved project) narrows query, events, export and signals to usage attributed to that project. On budget-get, budget-set and signals, --project P with no other scope is the project budget (--scope-kind project --scope-id P); a project budget names a project of the organization, an unknown or foreign one is not_found. |
ai settings get / update | Org AI defaults and payload-retention settings via AISettingsService; enabling payload persistence requires --confirmation PERSIST, while omitted update flags preserve current settings. |
API reference
Browse procedures, request and response types, and download the complete OpenAPI contract.
