Live OpenAI-compatible API · Self-hosted on your server

One Endpoint.
Every AI Model.

Unified API gateway for OpenAI, Anthropic, Claude. Sell AI access with credit billing, Telegram integration, and zero infrastructure headaches.

Python — OpenAI SDK
from openai import OpenAI
client = OpenAI(
  api_key="biran-your-api-key",
  base_url="
)
response = client.chat.completions.create(
  model="biran/smart",
  messages=[{"role":"user","content":"Hello!"}]
)
# Works with LangChain, LlamaIndex, Vercel AI, any SDK
5+
AI Providers
4
Plans: Free to $50
5h
Credit Reset Window
100%
Self-Hosted

Multi-Provider Routing

Automatically route to the cheapest or best provider. Switch providers without changing your code.

OpenAI
gpt-5.2, gpt-4o,
gpt-4o-mini
Anthropic
claude-opus-4,
claude-sonnet-4
Google
gemini-3.1-pro,
gemini-3-flash
DeepSeek
deepseek-v3.2,
deepseek-r1
+ More
easily extensible
biran/cheapCheapest
biran/smartBalanced
biran/bestTop quality
biran/autoSmart routing

Everything you need to sell AI API

Built for developers who want to monetize AI access. Full billing, no third-party payment required.

Credit-Based Billing

5-hour credit windows with automatic reset via Redis TTL. Zero cron jobs. Fair usage built in automatically.

Smart Model Routing

Aliases like biran/cheap auto-select the best provider. No code changes needed.

OpenAI Compatible

Drop-in replacement for OpenAI API. Works with LangChain, LlamaIndex, Vercel AI, any SDK — zero code changes.

Telegram Integration

User bot: /start, /buy, /apikey. Admin bot: /orders, /confirm. No web dashboard needed to manage users.

Streaming (SSE)

Full streaming support for chat completions. Real-time responses, fully compatible with OpenAI streaming spec.

Rate Limiting

Per-user, per-plan rate limits via Redis. Configurable per tier. Prevents abuse and ensures fair resource sharing.

From zero to API revenue

Three steps to start selling AI API access

1

User registers via Telegram

Send /start to the bot, choose a plan, make payment. Admin confirms via bot. Done in minutes.

2

API Key delivered instantly

Bot generates and sends the API key right away. Users can create multiple keys with custom names.

3

Start building immediately

Use with any OpenAI-compatible SDK. Credits reset every 5 hours. Monitor usage with /usage command.

Simple, transparent pricing

POST /v1/chat/completions
Chat completion
curl -X POST \
  -H "Authorization: Bearer biran-YOUR_KEY" \
  -H "Content-Type: application/json" \
a-i18n="pricing.sub">Start free, scale as you grow. No hidden fees.

Prices load from GET /public/plans on biran-web (WEB_PORT, default 8080). Set window.BIRAN_WEB_URL to override.

Loading plans…

API Reference

Fully OpenAI-compatible. Just change the base URL.

POST /v1/chat/completions
Chat completion (OpenAI format)
curl -X POST \
  -H "Authorization: Bearer biran-YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"biran/smart","messages":[{"role":"user","content":"Hello"}]}'
POST /v1/messages
Chat completion (Anthropic format)
curl -X POST \
  -H "x-api-key: biran-YOUR_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'
GET /v1/models
List available models
curl \
  -H "Authorization: Bearer biran-YOUR_KEY"

Connect with OpenClaw

Use Biran Gateway as your AI backend in OpenClaw — just point the base URL and you're set.

Provider config

Add Biran as a provider in ~/.openclaw/openclaw.json under models.providers.

"biran": { "baseUrl": "", "apiKey": "biran-YOUR_API_KEY", "api": "openai-completions", "models": [ { "id": "biran/smart", "name": "Biran Smart" }, { "id": "biran/best", "name": "Biran Best" }, { "id": "biran/cheap", "name": "Biran Cheap" } ] }

Enable in agent defaults

Add model aliases under agents.defaults so OpenClaw can use them.

"agents": { "defaults": { "models": { "biran/biran/smart": { "alias": "smart" }, "biran/biran/best": { "alias": "best" }, "biran/biran/cheap": { "alias": "cheap" } } } }

Frequently Asked Questions

Quick answers to common questions about Biran Gateway.

What is Biran Gateway?
Biran Gateway is a self-hosted AI API gateway that provides a unified OpenAI-compatible endpoint for multiple providers (OpenAI, Anthropic, Claude). It includes credit-based billing, Telegram integration, and a web dashboard.
Is it compatible with OpenAI SDK?
Yes. Just change the base_url to your Biran Gateway endpoint. It works with any OpenAI-compatible SDK including LangChain, LlamaIndex, Vercel AI, and the official OpenAI Python/Node libraries.
How does the credit system work?
Each plan has a credit allowance that resets every 5 hours automatically via Redis TTL. No cron jobs needed. Different models cost different amounts of credits per request based on token usage.
How do I get an API key?
Send /start to our Telegram bot, choose a plan, and complete payment. The bot will generate and send your API key instantly after admin confirmation.
What models are available?
We support OpenAI (GPT-5.2, GPT-4o, GPT-4o-mini), Anthropic (Claude Opus 4, Claude Sonnet 4), Google (Gemini 3.1 Pro, Gemini 3 Flash), DeepSeek (V3.2, R1), and more. You can also use smart aliases like biran/cheap, biran/smart, biran/best for automatic routing.
Is there a free plan?
Yes. The free plan gives you a limited number of credits per 5-hour window with basic rate limits. It's great for testing and small projects.