AI gateway
Your apps call OpenAI, Anthropic or any OpenAI-compatible model through Skiff, which keeps the keys and stops each app at a monthly token budget.
An app that calls a model usually holds the provider's key. If the app is an agent running code it wrote itself, that key is one print(os.environ) away from leaking, and nothing stops a loop from spending your month's credit in an afternoon. Skiff holds the keys instead. Each app gets its own token for Skiff, and Skiff adds the real key on the way out.
Add a provider
In the dashboard, open Settings → Integrations → AI providers and add a key. Pick OpenAI, Anthropic, or Other for anything that works like OpenAI's API (OpenRouter, Groq, Together, or a model running on your own server), with its address. Only a team owner can add or remove providers.
Give an app access
On the project's Settings tab, under AI access, set a monthly token budget (or leave it blank for no limit) and choose Give AI access. Redeploy, and the app has two new variables:
SKIFF_AI_URL: where Skiff's gateway is, from inside the app's container.SKIFF_AI_TOKEN: this app's token. It works only for your team's providers, and only from this server.
Previews use their project's access and count against its budget.
Point the SDK at Skiff
Each provider is at $SKIFF_AI_URL/<its name>, and the rest of the path is the provider's own.
import os
from openai import OpenAI
client = OpenAI(
base_url=os.environ["SKIFF_AI_URL"] + "/openai/v1",
api_key=os.environ["SKIFF_AI_TOKEN"],
)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: process.env.SKIFF_AI_URL + "/anthropic",
apiKey: process.env.SKIFF_AI_TOKEN,
});Budgets
Skiff counts the input and output tokens each provider reports, per app, per calendar month (UTC). The dashboard shows the month so far. Your team's alerts hear when an app passes 80% of its budget and when it reaches it. From then on Skiff answers that app's calls with 429 and a message saying why, until the month ends or you raise the budget. Raising it takes effect at once, with no redeploy.
The budget is checked before each call, so calls already running when it's reached finish, and the month can end slightly over.
Per run
A monthly budget won't stop one task that loops from using all of it. Under AI access, a per-run budget caps each run on its own. A run is the trace the call belongs to: an app using OpenTelemetry sends a traceparent header with every call, so its runs are found with no work. Otherwise, name the run yourself with an X-Skiff-Run header, such as the id of the job or message being handled:
client.chat.completions.create(model="gpt-4o-mini", messages=msgs,
extra_headers={"X-Skiff-Run": f"ticket-{ticket.id}"})When a run reaches its limit, Skiff answers its next calls with 429 and says why, and your team's alerts hear about it once. Other runs, and calls that name no run, carry on. Runs are forgotten a week after their last call.
Budgets are in tokens rather than money because prices differ by model and change often. A rough way to choose one: take what you're willing to spend in a month and divide by your model's price per token.
Good to know
- Streaming works. For OpenAI, Skiff asks the stream to include its token count, so streamed calls count too. Other OpenAI-compatible providers count streams only if they send usage in the stream.
- A provider's errors (a bad key, a rate limit, a model that doesn't exist) reach the app unchanged.
- Turning an app's access off cuts its token off at once. Turning it on again gives it a new token, so redeploy.
- The key is stored encrypted with the rest of Skiff's secrets. Removing a provider in Skiff doesn't revoke the key at the provider.
Email forwarding
Point your domain's mail at your server and Skiff hands every message straight on to the inbox you already use. No mailboxes to host, no IMAP, nothing to back up.
Run an agent
A long-running agent with no public address: its state survives restarts, it calls models within a budget, and work reaches it through an inbox.