Access all Gab AI capabilities through a unified, OpenAI-compatible API. Generate text, images, videos, audio, and embeddings with a single integration.
The Gab AI API is an OpenAI-compatible router: one key reaches every live model through a single endpoint. Point the SDK you already use at https://gab.ai/v1, pin a model by slug, or pass model="auto" and the same Intent Engine as the Gab AI app classifies the prompt and picks the model. With a single API key, you can access chat completions (including vision / image input), upload files to reference by id, generate images, create videos, convert text to speech, generate embeddings, and more—all with credit-based pricing and no per-model API keys to manage.
Set model to "auto" on /v1/chat/completions, /v1/responses, or /v1/messages. The Intent Engine classifies the kickoff: coding work is quick, standard, or hard; hard reasoning goes to a reasoner; live-fact questions to Arya with web search; political or theological questions to Arya. In Cursor, Claude Code, Codex, or OpenCode the selected model sticks for the tool loop — mid-loop tool results do not re-run the classifier, and Gab does not inject search or political tools when you already sent tools[]. The response model field is the slug that actually ran. Inspect X-Gab-Selected-Model, X-Gab-Routed-Model, X-Gab-Router-Intent, and X-Gab-Router-Coding-Tier. Those headers are the live source of truth: the slug mapped to each coding tier is configurable and can change, so do not hard-code Auto's destination models. Optional routing.coding_tier / routing.session_id (or X-Gab-Coding-Tier / X-Gab-Session-Id) apply at kickoff only. You are billed for the resolved model, not for a synthetic "auto" price. Each turn in a 40-turn loop still counts as one request against the daily X-RateLimit budget. Omit model or pass a specific slug when you want a pinned engine — omitting model still defaults to Arya. Do not send auto to /v1/images, /v1/audio, /v1/embeddings, or /v1/videos. POST /v1/messages/count_tokens accepts auto without creating route state.
API access requires a Plus subscription. API usage consumes credits from your account based on the model and operation used. Arya (free in-app for Plus) costs 1 credit per 32,000 input tokens on the API, with a minimum of 1 credit per request. Paid models use their listed credit costs. Free default model messages in Plus apply to in-app chat only — not included in API.
The Gab AI API supports a wide range of AI capabilities:
/v1/chat/completions
Generate text responses with GPT-5.5, Claude, Gemini, and more
/v1/responses
Responses API compatibility for Codex-style agent clients and function-call loops
/v1/messages
Anthropic-compatible Messages API for Claude Code and Anthropic SDK clients
/v1/chat/completions
Send images to vision-capable models via URL, base64, or file_id
/v1/files
Upload images and files once, reuse by file_id across requests
/v1/images/generations
Create images with GPT Image, Nano Banana, Seedream, and more
/v1/images/edit
Pass reference images to flux-2-pro and other image models (character consistency, restyles, compositing)
/v1/videos/generations
Generate videos from text or images with Veo, Kling, Hailuo, Wan, and Seedance
/v1/audio/speech
Convert text to natural speech in multiple voices
/v1/embeddings
Convert text to vector embeddings for search, RAG, and clustering
/v1/credits
Check your available credits and usage
/v1/api-keys
Create, list, and revoke API keys programmatically
/v1/agent-setup
Generated Cursor, OpenCode, OpenClaw, and Claude Code configs from the live catalog
Gab AI also ships an official Pi package for developers who want Gab models and Gab API tools directly inside Pi. The package adds Gab as a model provider, prompts for your API key on first use, lets you switch between Gab models, and exposes Gab tools for images, videos, speech, files, usage, credits, API keys, and account export.
Run /gab inside Pi to enter your Gab AI API key once. You can also set GAB_API_KEY or GAB_AI_API_KEY for scripted sessions.
Get started with the Gab AI API in minutes:
We frequently add and update models. GET /v1/models is public (no key required) and returns aliases, context_window, max_output_tokens, capabilities, and recommended_for tags for coding agents. Use the model id or any listed alias when making chat or generation requests. GET /v1/agent-setup?client=cursor|opencode|openclaw|claude-code writes a generated config from the same catalog. OpenAPI is at /openapi.json; a plain-text catalog is at /llms-full.txt.
Use https://gab.ai/v1 as the base_url / baseURL in OpenAI-compatible SDKs. Individual requests append an endpoint such as /chat/completions. GET https://gab.ai/v1/models lists current model IDs and aliases (authentication optional). The API follows RESTful conventions and returns JSON responses (except for audio, which returns raw audio data). Request bodies up to 32 MB are accepted so coding agents can send large system prompts and file contents.
All successful responses include usage information with token counts and credits used: Errors follow a consistent format for easy handling:
Reasoning / "thinking" models (e.g. Qwen 3.7/3.8 Max, MiniMax M3, DeepSeek V4 Flash) can take well over a minute to produce a full response. Gab keeps long requests alive at the HTTP layer, but you should still follow these guidelines:
If your client (or an intermediate proxy/CDN) disconnects before we can deliver the completion — for example after a gateway timeout — the request is not billed. Credits are only committed for responses that are actually returned to you.
API access requires a Plus subscription. API usage consumes credits from your account based on the model and operation used. Arya (free in-app for Plus) costs 1 credit per 32,000 input tokens on the API, with a minimum of 1 credit per request. Paid models use their listed credit costs. Free default model messages in Plus apply to in-app chat only — not included in API.
pi install npm:@gabai/pi-gab-ai
pi --models "gab/*"
/gab
/gab arya
/gab gpt-5-5
/gab status
Run /gab inside Pi to enter your Gab AI API key once. You can also set GAB_API_KEY or GAB_AI_API_KEY for scripted sessions.
curl https://gab.ai/v1/chat/completions \\
-H "Content-Type: application/json" \\
-H "Authorization: Bearer YOUR_API_KEY" \\
-d '{
"model": "arya",
"messages": [
{"role": "user", "content": "Hello, Gab AI!"}
]
}'
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://gab.ai/v1'
});
const response = await client.chat.completions.create({
model: 'arya',
messages: [
{ role: 'user', content: 'Hello, Gab AI!' }
]
});
console.log(response.choices[0].message.content);
// Check credits used
console.log('Credits used:', response.usage.credits_used);
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://gab.ai/v1"
)
response = client.chat.completions.create(
model="arya",
messages=[
{"role": "user", "content": "Hello, Gab AI!"}
]
)
print(response.choices[0].message.content)
# Check credits used
print(f"Credits used: {response.usage.credits_used}")
curl https://gab.ai/v1/models
{
"usage": {
"prompt_tokens": 10000,
"completion_tokens": 150,
"total_tokens": 10150,
"credits_used": 2,
"prompt_tokens_details": {
"cached_tokens": 8000
}
}
}
{
"error": {
"message": "Description of what went wrong",
"type": "error_type",
"code": "error_code",
"param": null
}
}
from openai import OpenAI
client = OpenAI(
base_url="https://gab.ai/v1",
api_key="YOUR_API_KEY",
timeout=210, # seconds — generous for reasoning models
max_retries=2,
)
stream = client.chat.completions.create(
model="minimax-m3",
messages=[{"role": "user", "content": "..."}],
max_tokens=8000,
stream=True, # recommended for reasoning models
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")
If your client (or an intermediate proxy/CDN) disconnects before we can deliver the completion — for example after a gateway timeout — the request is not billed. Credits are only committed for responses that are actually returned to you.