Skip to main content
varg uses a single API key (VARG_API_KEY) for all AI generation. This key authenticates you with the varg gateway, which routes requests to the right AI provider (Fal, ElevenLabs, Higgsfield, Replicate) and handles billing.

Get your API key

Option 1: Sign up on the web

  1. Go to app.varg.ai
  2. Sign up with your email
  3. Copy your API key from the dashboard

Option 2: Log in from the CLI

bunx vargai login
This gives you two choices:
  • Email login — enter your email, receive a 6-digit code, verify it. Creates an account and API key automatically.
  • Paste API key — if you already have one from the dashboard.
Your credentials are saved to ~/.varg/credentials (permissions 0600).

Option 3: Agent-driven login (for AI agents)

AI agents can drive the login flow using curl — no interactive CLI needed:
# 1. Send OTP to user's email
curl -s -X POST https://app.varg.ai/api/auth/cli/send-otp \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]"}'

# 2. User checks inbox for 6-digit code

# 3. Verify OTP (creates account + API key if needed)
curl -s -X POST https://app.varg.ai/api/auth/cli/verify-otp \
  -H "Content-Type: application/json" \
  -d '{"email":"[email protected]","code":"123456"}'

# Response: {"api_key":"varg_xxx","email":"...","balance_cents":0,"access_token":"..."}

Using your API key

VARG_API_KEY=varg_xxx
Bun auto-loads .env — no dotenv needed.

As an environment variable

export VARG_API_KEY=varg_xxx

In global credentials

The CLI saves credentials to ~/.varg/credentials:
{
  "api_key": "varg_xxx",
  "email": "[email protected]",
  "created_at": "2026-01-15T10:00:00Z"
}
The SDK automatically checks this file if VARG_API_KEY is not set in the environment.

In code

import { createVarg } from "vargai/ai"

const varg = createVarg({ apiKey: process.env.VARG_API_KEY! })
Or with the REST API:
curl -H "Authorization: Bearer varg_xxx" https://api.varg.ai/v1/balance

Credits and billing

Check your balance

bunx vargai balance
Or via API:
curl -s -H "Authorization: Bearer $VARG_API_KEY" https://api.varg.ai/v1/balance
# {"balance_cents": 10000}
1 credit = 1 cent. balance_cents: 10000 means 10,000 credits ($100).

Add credits

bunx vargai topup
This opens the billing page in your browser. Or go directly to app.varg.ai. Available packages:
PackageCreditsPrice
Starter2,000$20
Basic5,000$50
Popular10,000$100
Pro20,000$200
Business50,000$500
Enterprise100,000$1,000

Pricing

ActionModelCreditsCost
Imagenano-banana-pro5$0.05
Imageflux-pro25$0.25
Video (5s)kling-v3150$1.50
Video (5s)seedance-2-preview250$2.50
Video (5s)wan-2.575$0.75
Speecheleven_v325$0.25
Musicmusic_v125$0.25
Cache hits are always free. Same prompt + params = $0 instant result.

CLI commands

CommandDescription
bunx vargai loginSign in or paste API key
bunx vargai logoutClear saved credentials
bunx vargai balanceCheck credit balance
bunx vargai topupOpen billing page in browser

Bring Your Own Keys (BYOK)

If you have your own provider API keys (fal, ElevenLabs, etc.), you can use them through the varg gateway at $0 varg cost. See the BYOK guide for details.