SDKs and clients
Point the Vercel AI SDK, the official OpenAI SDKs or Claude Code at Faucet — there is no Faucet SDK to install.
There is no Faucet SDK. The endpoint speaks the OpenAI wire format, so the client you already use already speaks to Faucet: change the base URL and the key, and nothing else in your code moves.
All three examples below assume FAUCET_API_KEY is set — see
Getting started.
Vercel AI SDK
The recommended path in TypeScript. includeUsage is worth setting: it is what
puts token counts on the streamed response you receive.
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { streamText } from 'ai';
const faucet = createOpenAICompatible({
name: 'faucet',
baseURL: 'https://api.intfaucet.com/v1',
apiKey: process.env.FAUCET_API_KEY,
includeUsage: true,
});
const result = streamText({
model: faucet('anthropic/claude-opus-5'),
prompt: 'Explain a leaky bucket rate limiter in two sentences.',
});
for await (const chunk of result.textStream) process.stdout.write(chunk);
console.log(await result.usage);The same faucet handle reaches the other endpoints:
faucet.embeddingModel(…) for embeddings and
faucet.imageModel(…) for images.
OpenAI SDK
Point the official client at Faucet. Nothing else in your code changes.
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.intfaucet.com/v1",
api_key=os.environ["FAUCET_API_KEY"],
)
completion = client.chat.completions.create(
model="google/gemini-3.5-flash",
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(completion.choices[0].message.content)The same client handles transcription, which is the one Faucet request whose body is not JSON.
Claude Code
Claude Code appends /v1/messages itself, so its base URL is the Faucet origin
without a trailing /v1. Use ANTHROPIC_AUTH_TOKEN, not ANTHROPIC_API_KEY:
export ANTHROPIC_BASE_URL="https://api.intfaucet.com"
export ANTHROPIC_AUTH_TOKEN="$FAUCET_API_KEY"
export ANTHROPIC_MODEL="anthropic/claude-opus-5"
claudeThe token variable sends Authorization: Bearer, which is Faucet's client-auth
scheme. The API-key variable sends x-api-key; Faucet reserves that shape for
the credential it selects on the upstream Anthropic leg.
Keep the namespaced provider/model spelling shown above in Claude Code. Bare
aliases resolve today, but the canonical slug is the stable Faucet contract and
is what GET /v1/models returns.
`/v1/messages` is Anthropic models only
It currently accepts anthropic/* chat models. Use /v1/chat/completions for
OpenAI, Google or other providers — see
Choosing a model.