API Overview

Access all Gab AI capabilities through a unified, OpenAI-compatible API. Generate text, images, videos, audio, and embeddings with a single integration.

Introduction

The Gab AI API provides programmatic access to all our AI models through a single, unified endpoint. Our API is OpenAI-compatible, making it easy to migrate existing applications or use familiar libraries. 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.

Plus Required

API access requires a Plus subscription. API usage consumes credits from your account based on the model and operation used — including the default Arya model (minimum 1 credit per request). Free default model messages in Plus apply to in-app chat only; {DEFAULT_MODEL_FREE_API_NOTE.toLowerCase()}.

API Capabilities

The Gab AI API supports a wide range of AI capabilities:

Chat Completions

/v1/chat/completions

Generate text responses with GPT-5.5, Claude, Gemini, and more

OpenAI Responses

/v1/responses

Responses API compatibility for Codex-style agent clients and function-call loops

Claude Code

/v1/messages

Anthropic-compatible Messages API for Claude Code and Anthropic SDK clients

Vision / Image Input

/v1/chat/completions

Send images to vision-capable models via URL, base64, or file_id

File Uploads

/v1/files

Upload images and files once, reuse by file_id across requests

Image Generation

/v1/images/generations

Create images with GPT Image, Nano Banana, Seedream, and more

Video Generation

/v1/videos/generations

Generate videos from text or images with Veo, Kling, Hailuo, Wan, and Seedance

Text-to-Speech

/v1/audio/speech

Convert text to natural speech in multiple voices

Embeddings

/v1/embeddings

Convert text to vector embeddings for search, RAG, and clustering

Credit Balance

/v1/credits

Check your available credits and usage

API Key Management

/v1/api-keys

Create, list, and revoke API keys programmatically

Key Features

Pi CLI

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.

Install the Gab AI Pi package

Inside Pi

First-use setup

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.

Quick Start

Get started with the Gab AI API in minutes:

cURL Example

Node.js Example

Python Example

Available Models

We frequently add and update models. To get the current list of all available models along with their capabilities, context windows, and credit costs, call the /v1/models endpoint: The response includes text, image, video, audio, and embedding models with their IDs, providers, and per-request credit costs. Use the model ID from the response when making chat or generation requests.

Base URL

All API requests should be made to this base URL. The API follows RESTful conventions and returns JSON responses (except for audio which returns raw audio data).

Response Format

All successful responses include usage information with token counts and credits used: Errors follow a consistent format for easy handling:

Usage Object

Error Format

Timeouts & Long-Running Requests

Reasoning / "thinking" models (e.g. MiniMax M3, DeepSeek V4 Flash, Qwen 3.5 397B Thinking) can take well over a minute to produce a full response. To avoid edge timeouts on long, silent non-streaming requests, follow these guidelines:

Python: streaming with a generous timeout

You are not charged for undelivered responses

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.

Next Steps

Plus Required

API access requires a Plus subscription. API usage consumes credits from your account based on the model and operation used — including the default Arya model (minimum 1 credit per request). Free default model messages in Plus apply to in-app chat only; {DEFAULT_MODEL_FREE_API_NOTE.toLowerCase()}.

pi install npm:@gabai/pi-gab-ai
pi --models "gab/*"
/gab
/gab arya
/gab gpt-5-5
/gab status

First-use setup

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 \\
  -H "Authorization: Bearer YOUR_API_KEY"
{
  "usage": {
    "prompt_tokens": 25,
    "completion_tokens": 150,
    "total_tokens": 175,
    "credits_used": 2
  }
}
{
  "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="")

You are not charged for undelivered responses

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.