Skip to main content

Apps

Integrate the Bankr LLM Gateway into your own applications. The gateway exposes two standard API formats — you can call them directly or use an SDK.

Looking for coding agent setup?

This page is for building your own apps. To configure Claude Code, Cursor, or OpenCode, see Coding Agents.

Integration Options​

ApproachFormatBest For
OpenAI Chat Completions (/v1/chat/completions)OpenAI formatDirect HTTP calls, any OpenAI-compatible SDK or client
Anthropic Messages (/v1/messages)Anthropic formatDirect HTTP calls, Anthropic SDK, Claude-specific features
Vercel AI SDKEither format via provider packagesTypeScript apps using generateText, streamText, tool calling

Both API formats work with all models — the gateway translates automatically. See the API Reference for full endpoint details.

Direct API Usage​

If you're making HTTP requests directly (or using a lightweight HTTP client), point at the gateway's base URL and pass your API key:

OpenAI Chat Completions Format​

const response = await fetch("https://llm.bankr.bot/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": process.env.BANKR_API_KEY!,
},
body: JSON.stringify({
model: "claude-sonnet-4.6",
messages: [{ role: "user", content: "Explain ERC-20 tokens." }],
}),
});

const data = await response.json();
console.log(data.choices[0].message.content);

Anthropic Messages Format​

const response = await fetch("https://llm.bankr.bot/v1/messages", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": process.env.BANKR_API_KEY!,
},
body: JSON.stringify({
model: "claude-opus-4.8",
max_tokens: 1024,
messages: [{ role: "user", content: "Explain ERC-20 tokens." }],
}),
});

const data = await response.json();
console.log(data.content[0].text);

Vercel AI SDK​

The Vercel AI SDK provides a higher-level TypeScript interface with generateText, streamText, tool calling, and streaming helpers.

Installation​

bun add ai @ai-sdk/openai-compatible
# or, for Claude-specific features (prompt caching):
bun add ai @ai-sdk/anthropic

Provider Setup​

The gateway supports two AI SDK provider packages. Choose based on your needs:

ProviderPackageBest For
OpenAI-Compatible@ai-sdk/openai-compatibleAll models (Claude, Gemini, GPT, Kimi, Qwen)
Anthropic@ai-sdk/anthropicClaude models with native features (prompt caching)
Do not use @ai-sdk/openai

The @ai-sdk/openai package defaults to the new OpenAI Responses API format, which the gateway does not support. Use @ai-sdk/openai-compatible instead — it uses the standard /v1/chat/completions format that works with all gateway models.

OpenAI-Compatible (All Models)​

Use this when you want access to every model the gateway offers through a single provider.

import { createOpenAICompatible } from "@ai-sdk/openai-compatible";

const llm = createOpenAICompatible({
name: "bankr",
baseURL: "https://llm.bankr.bot/v1",
headers: { "X-API-Key": process.env.BANKR_API_KEY! },
});

// Use any supported model
const claude = llm("claude-opus-4.8");
const gemini = llm("gemini-3.1-pro");
const gpt = llm("gpt-5.4");

Anthropic (Claude Models)​

Use this when you're exclusively using Claude models and want native Anthropic features like prompt caching.

import { createAnthropic } from "@ai-sdk/anthropic";

const anthropic = createAnthropic({
baseURL: "https://llm.bankr.bot/v1",
apiKey: process.env.BANKR_API_KEY!,
});

const claude = anthropic("claude-opus-4.8");

Generate Text​

import { generateText } from "ai";

const { text, usage } = await generateText({
model: llm("claude-sonnet-4.6"),
prompt: "Explain ERC-20 tokens in one paragraph.",
});

console.log(text);
console.log(`Tokens: ${usage.inputTokens} in, ${usage.outputTokens} out`);

Stream Text​

import { streamText } from "ai";

const result = streamText({
model: llm("gemini-3-flash"),
prompt: "List the top 5 DeFi protocols by TVL.",
});

for await (const chunk of result.textStream) {
process.stdout.write(chunk);
}

const usage = await result.usage;
console.log(`\nTokens: ${usage.inputTokens} in, ${usage.outputTokens} out`);

Tool Calling​

import { generateText, tool } from "ai";
import { z } from "zod";

const { text, toolResults } = await generateText({
model: llm("claude-opus-4.8"),
tools: {
getTokenPrice: tool({
description: "Get the current price of a token",
inputSchema: z.object({
symbol: z.string().describe("Token symbol, e.g. ETH"),
}),
execute: async ({ symbol }) => {
// Your price-fetching logic here
return { symbol, price: 3450.12, currency: "USD" };
},
}),
},
prompt: "What is the current price of ETH?",
});

console.log(text);

Multi-Model Routing​

One advantage of the gateway is switching models without changing your code or provider config — the gateway picks each model's provider (routing):

// Same provider, different models — the gateway handles routing
const result = await generateText({
model: llm(process.env.MODEL ?? "claude-sonnet-4.6"),
prompt: "Summarize this transaction.",
});

Quick Reference​

SettingValue
Base URLhttps://llm.bankr.bot/v1
Auth HeaderX-API-Key: bk_... or Authorization: Bearer bk_...
OpenAI-compatible package@ai-sdk/openai-compatible
Anthropic package@ai-sdk/anthropic

See Supported Models for the full model list and API Reference for raw endpoint details.