📖 AIbun.xyz Documentation

Everything you need to set up and use the AIbun.xyz AI Gateway. Access 20+ AI models through a single API key.

🚀 Quick Start

Get started in 3 simple steps:

Step 1 — Get your API Key

Choose a plan (or start with the free tier), and get your API key. All keys start with the toc- prefix.

Step 2 — Choose the right Base URL

Depending on your tool, use one of these endpoints:

Compatibility Base URL
OpenAI compatible https://api.aibun.xyz/v1
Anthropic compatible https://api.aibun.xyz

Step 3 — Configure your tool

Set the Base URL and API key as environment variables, or use the one-line installer for Claude Code:

bash
curl -fsSL "https://api.aibun.xyz/claude-install.sh?key=YOUR_KEY" | sh

For specific tools, see the Agent Setup guides below.

🔗 Endpoints

Endpoint URL Use for
Chat Completions (OpenAI) https://api.aibun.xyz/v1/chat/completions GPT, Gemini models
Messages (Anthropic) https://api.aibun.xyz/v1/messages Claude models

🔐 Authentication

Your API key (starting with toc-) can be sent in two ways:

Header Option 1
Authorization: Bearer toc-your-api-key-here
Header Option 2
X-API-Key: toc-your-api-key-here
â„šī¸ Both methods work identically. Use whichever your tool supports.

🤖 Claude Code Recommended

Option A: One-line installer

bash
curl -fsSL "https://api.aibun.xyz/claude-install.sh?key=YOUR_KEY" | sh

Option B: Manual setup

Set these environment variables:

bash
export ANTHROPIC_BASE_URL="https://api.aibun.xyz"
export ANTHROPIC_API_KEY="toc-your-api-key-here"

For Windows (PowerShell):

powershell
$env:ANTHROPIC_BASE_URL = "https://api.aibun.xyz"
$env:ANTHROPIC_API_KEY = "toc-your-api-key-here"
💡 After setting env vars, just run claude in your terminal and it will use the AIbun.xyz gateway automatically.

📝 Cursor

Open Cursor settings and configure:

  1. Go to Settings → Models → OpenAI API Key
  2. Set API key: toc-your-api-key-here
  3. Set Base URL: https://api.aibun.xyz/v1
  4. Select your preferred model and start coding
â„šī¸ Cursor uses OpenAI-compatible endpoints. Make sure to include /v1 in the Base URL.

🌊 Windsurf

Configure Windsurf with environment variables:

bash
export OPENAI_BASE_URL="https://api.aibun.xyz/v1"
export OPENAI_API_KEY="toc-your-api-key-here"

🔌 Cline

In VS Code with Cline extension:

  1. Open Cline settings
  2. Select API Provider: OpenAI Compatible or Anthropic
  3. Set Base URL: https://api.aibun.xyz/v1 (OpenAI) or https://api.aibun.xyz (Anthropic)
  4. Set API key: toc-your-api-key-here

📂 OpenCode

bash
export OPENAI_BASE_URL="https://api.aibun.xyz/v1"
export OPENAI_API_KEY="toc-your-api-key-here"

⚡ Other Agents

For any tool that supports OpenAI or Anthropic compatible APIs:

Tool Config
Continue Set OPENAI_BASE_URL + OPENAI_API_KEY
Aider Set OPENAI_BASE_URL + OPENAI_API_KEY
Amp Code Set ANTHROPIC_BASE_URL + ANTHROPIC_API_KEY
Roo Code Set OPENAI_BASE_URL + OPENAI_API_KEY
Codex CLI Set OPENAI_BASE_URL + OPENAI_API_KEY
Gemini CLI Set OPENAI_BASE_URL + OPENAI_API_KEY
💡 General rule: If the tool uses Anthropic SDK → use https://api.aibun.xyz. If it uses OpenAI SDK → use https://api.aibun.xyz/v1.

📡 API Reference

Chat Completions (OpenAI compatible)

curl
curl https://api.aibun.xyz/v1/chat/completions \
  -H "Authorization: Bearer toc-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Messages (Anthropic compatible)

curl
curl https://api.aibun.xyz/v1/messages \
  -H "x-api-key: toc-your-api-key" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

🧠 Supported Models

20+ models available through the gateway:

Provider Models
Anthropic Claude Opus 4, Claude Sonnet 4, Claude Haiku 3.5, Claude Sonnet 3.5
OpenAI GPT-4o, GPT-4o-mini, GPT-4 Turbo, o1, o1-mini, o3-mini
Google Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.0 Flash
â„šī¸ Model list is updated regularly. Use the dashboard to see all currently available models.

💰 Pricing & Limits

Plan Price ($AIBUN) Reset Cycle Best for
Free 0 24 hours Testing, 1/5 of trial quota
Lite 150K 5 hours Learning & light tasks
Plus 310K 2 hours Daily coding
Pro ⭐ 550K 2 hours Active builders
Max 1.1M 2 hours High-volume usage

Rolling Window: Instead of one big quota dump, your limit refreshes on a rolling cycle (2h or 5h). This prevents burning all quota in one session.

🤖 Telegram Bot

Try AI models instantly without any setup:

  • Open @AIBUN_xyz_bot on Telegram
  • Send a message — Claude, GPT, and Gemini are integrated
  • No API key needed, no wallet needed
  • Great for quick tests and casual AI conversations
💡 The Telegram bot is a great way to experience the AI models before committing to an API plan.

🔧 Troubleshooting

Error: 401 Unauthorized

Your API key is invalid or missing. Make sure:

  • API key starts with toc-
  • Key is set in the correct env var (ANTHROPIC_API_KEY or OPENAI_API_KEY)
  • No extra spaces or line breaks in the key

Error: 429 Rate Limited

You've hit your plan's quota limit. Options:

  • Wait for the Rolling Window to reset (2h or 5h)
  • Upgrade to a higher plan
  • Purchase top-up credits

Error: Connection refused / timeout

  • Check your internet connection
  • Verify the Base URL is correct (with or without /v1)
  • Make sure there's no proxy/VPN blocking the request

Model not found

Make sure you're using the correct model ID. Check the Supported Models section for available models.

❓ FAQ

Can I use multiple tools at the same time?

Yes! Your API key works across all tools simultaneously. The quota is shared across all requests.

Do top-up credits expire?

No. Top-up credits are permanent and carry over across billing cycles.

Can I switch plans?

Yes, you can upgrade or downgrade at any time. The change takes effect immediately.

Is the gateway down for maintenance?

The gateway runs 24/7 with 99.9% uptime. Check our Telegram group for status updates.