wess.devdocs

AI & the gateway

wess.dev is built for AI apps. Attach a model provider to your app and we inject a provider-agnostic gateway — your code calls one endpoint, and the owner can switch between Anthropic, OpenAI, Ollama (server or cloud), or any OpenAI-compatible endpoint without touching your app. Your app never holds a raw provider key.

Attach a provider

terminal
wess ai myapp anthropic            # or: openai, ollama, or any configured provider
wess deploy myapp --image ...      # redeploy to inject the gateway env

The owner configures providers once in the console (Settings → AI providers): an Anthropic or OpenAI key, or an Ollama base URL (local server or Ollama Cloud), or any OpenAI-compatible base URL (Groq, Together, OpenRouter, vLLM…).

Call the gateway from your app

Three env vars are injected when AI is attached: AI_GATEWAY_URL, AI_GATEWAY_KEY, AI_MODEL.

your app
const r = await fetch(process.env.AI_GATEWAY_URL + "/chat", {
  method: "POST",
  headers: { "content-type": "application/json", authorization: "Bearer " + process.env.AI_GATEWAY_KEY },
  body: JSON.stringify({ messages: [{ role: "user", content: "Summarize this." }] }),
})
const { content } = await r.json()

Pass "stream": true for a Server-Sent Events stream. Override the model per-call with "model". The same request shape works no matter which provider is behind the gateway.

Vectors are built in

Your app's database has pgvectorCREATE EXTENSION IF NOT EXISTS vector and store embeddings for RAG. Generate embeddings through the gateway, store them in your DB, done.

Scaffold an AI app

terminal
wess init myapp --template ai
The gateway keeps provider keys on the platform, not in your app or its environment dump — so a leaked app can't leak your Anthropic/OpenAI key.