Runbook: Authoring an LLM-Gateway connector
SWAO's LLM connectivity is file-based: one YAML connector per platform. This runbook shows how to connect any LLM platform to SWAO without a code change or rebuild.
1. The three-step flow
- Copy
wsp/inputs/llm-gateway/_template.yaml(created byswao init/ setup) or any bundled connector towsp/inputs/llm-gateway/<your-id>.yaml. - Amend
id,name,protocol,base_url,auth, andmodels.default. - Re-run
swao setup(or useswao assess --llm <your-id>directly). The connector is discovered automatically;swao health-checkconfirms it is valid.
2. Choosing the protocol
| Your platform speaks | protocol value |
|---|---|
OpenAI Chat Completions (/v1/chat/completions): vLLM, internal GenAI hubs, OpenRouter, LLMGateway, most aggregators | openai-chat |
Anthropic Messages (/v1/messages) | anthropic-messages |
| Amazon Bedrock Gateway (Bedrock API via AWS SDK) | bedrock-gateway |
| Local Ollama daemon | ollama |
| Amazon Bedrock (Bedrock Converse API via AWS SDK) | bedrock |
3. Worked example: internal GenAI hub
A company hub exposing several models behind one OpenAI-compatible endpoint with per-environment URLs:
yaml
schema_version: "1.0"
connector:
id: genai-hub
name: Internal GenAI Hub
protocol: openai-chat
base_url: https://genai-hub.example.internal
auth:
credential_key: genai-hub-api-key # stored via `swao credential`
env_var: SWAO_GENAI_HUB_API_KEY # fallback
models:
default: Mistral-Small-24B-Instruct
catalogue:
- id: Mistral-Small-24B-Instruct
- id: Llama-3.3-70B-Instruct
environments:
prod: {}
dev:
base_url: https://genai-hub-dev.example.internal
defaults:
temperature: 0
cost_per_token: { input_per_million: 0, output_per_million: 0 }
sovereignty:
data_residency: self-hosted
zero_retention: trueSelect the environment with SWAO_LLM_ENV=dev or env: in .swao.yml.
4. Aggregators (one key, many vendors)
OpenRouter, a self-hosted LLMGateway, or any multi-vendor gateway is just a connector whose catalogue spans vendors. The bundled openrouter seed shows the pattern, including:
- Live model discovery is on for every connector: when a model picker opens (Setup, LLM Assessment) and on
swao llm models --connector <id>, SWAO sends one GET with the connector credential to the list route of the protocol (/v1/models; Anthropic/v1/models; Ollama/api/tags; Bedrock ListFoundationModels and ListInferenceProfiles), through the same proxy and TLS settings as the calls, with a 5 second timeout. The served models are merged into your workspace copy withmodels.discovered_at, catalogue entries the platform no longer serves are markedserved: false, and prices are captured where the platform publishes them; bundled seeds are never modified.models.discovery_endpointsets another route. For an air-gapped platform, or one without a list route, setmodels.discovery: false: SWAO then sends no list request and the catalogue stays the only source.SWAO_LLM_DISCOVERY=offin the environment does the same for every connector on the machine. Batch-only ids (OpenRouter:batch) are never listed: the chat route SWAO calls does not serve them. The Setup LLM step sends one test call to the chosen model before it writes it (skipped without a stored key);SWAO_LLM_MODEL_CHECK=offturns that test off on the machine. headers:for static attribution or routing headers.request_overrides:for vendor extensions such asreasoning: {enabled: true}(reserved keys model/messages/stream are protected).
5. Selecting a connector
.swao.yml:providers.llm.primary: { connector: genai-hub, model: Llama-3.3-70B-Instruct }- CLI:
swao assess --app <app> --llm genai-hub:Llama-3.3-70B-Instruct - Env:
SWAO_LLM_CONNECTOR=genai-hub
Every run records the connector id, file hash, and model in run-manifest.json (llm.gateway) for provenance.
6. Rules and safety
- NEVER put key material in a connector file.
authnames WHERE the key lives; SWAO refuses files containing secret-shaped values. - Legacy
type: anthropic|openai|ollama|open-llm-providerconfigurations keep working unchanged; migration is opt-in. - Sovereignty facts in the connector are facts, not verdicts: they feed the provider eligibility checks of the LLM benchmark.
