Quatarly API
A unified, OpenAI-compatible API that gives you access to Claude, Gemini, and GPT models through a single key. Drop-in replacement for any OpenAI SDK, Cursor, Factory AI, Claude Code, OpenCode, and more.
Overview
Quatarly provides a unified REST API that proxies requests to Anthropic (Claude), Google (Gemini), and OpenAI (GPT) through
a single endpoint and a single API key. All responses conform to the OpenAI Chat Completions schema, making it a
true drop-in replacement anywhere you currently use api.openai.com.
https://api.quatarly.cloud/v1, swap the key, and everything works — streaming, tool calling, system prompts, and all.Authentication
Every request must include your Quatarly API key as a Bearer token in the Authorization header.
Authorization: Bearer your-api-key-here
Get your free key at api.quatarly.cloud/api-key.
Base URL
All endpoints live under /v1. The difference is just what base URL you give each client — the client appends the rest automatically.
OpenAI SDK / curl / OpenCode — you set
base_url = "https://api.quatarly.cloud/v1" and the SDK appends /chat/completions. Works for all models (Claude, Gemini, GPT).Claude Code / Anthropic SDK — you set
ANTHROPIC_BASE_URL = "https://api.quatarly.cloud/" (root) and Claude Code appends /v1/messages itself, reaching /v1/messages which uses the Anthropic Messages API format. Claude models only.
| Endpoint | Method | Format | Models |
|---|---|---|---|
| /v1/chat/completions | POST | OpenAI | All (Claude, Gemini, GPT) |
| /v1/messages | POST | Anthropic | Claude only — if /v1/chat/completions doesn't work for you with a Claude model, use this |
Rate Limits
Rate limits are enforced per API key. Limits vary by key tier and model. A 429 Too Many Requests response is returned when exceeded.
| Limit Type | Trial Key | Full Key |
|---|---|---|
| Requests / minute (RPM) | 70 | Custom (per plan) |
| Monthly credits | Limited | Plan-based |
| Concurrent requests | 5 | Unlimited |
All Models
All models below are accessible via the standard OpenAI Chat Completions API format using your Quatarly key.
Claude (Anthropic)
Gemini (Google)
GPT (OpenAI)
Factory AI Droid
Connect Factory AI Droid to Quatarly to access all models with a single API key. The setup script patches ~/.factory/settings.json automatically with all model entries.
-
Install Factory AI
powershellirm https://app.factory.ai/cli/windows | iex
bashcurl -fsSL https://app.factory.ai/cli | sh -
Create a Factory Account & Login
Go to app.factory.ai and create a free account. Then run
droidin your terminal and log in to create~/.factory/settings.json. -
Run the Setup Script
You need your Quatarly API key (
qua_trail_...orqua_...).powershellirm https://raw.githubusercontent.com/himanshu91081/Quatarly-setup/main/add-quatarly-models.ps1 -OutFile add-quatarly-models.ps1; .\add-quatarly-models.ps1
bashcurl -fsSL https://raw.githubusercontent.com/himanshu91081/Quatarly-setup/main/add-quatarly-models.sh -o add-quatarly-models.sh && bash add-quatarly-models.sh
The script will prompt for your key and update
settings.jsonwith all 11 model entries. Running it again with a new key safely updates existing entries without creating duplicates.
Verify Setup
Select-String "customModels" -Path "$env:USERPROFILE\.factory\settings.json" -A 5
grep -A 5 "customModels" ~/.factory/settings.jsonExpected snippet in settings.json:
"customModels": [ { "model": "claude-sonnet-4-6-thinking", "id": "custom:claude-sonnet-4-6-thinking-0", "baseUrl": "https://api.quatarly.cloud/", "apiKey": "your-api-key", "provider": "anthropic", "displayName": "claude-sonnet-4-6-thinking" }, { "model": "gpt-5.1", "id": "custom:gpt-5.1-5", "baseUrl": "https://api.quatarly.cloud/v1", "apiKey": "your-api-key", "provider": "openai", "displayName": "gpt-5.1" } ]
settings.json is saved as settings.json.backup before any changes. The script requires Python 3.Claude Code
Use Claude Code as a CLI coding agent routed through Quatarly. No Anthropic account needed — just your Quatarly key.
-
Install Claude Code
bashnpm install -g @anthropic-ai/claude-code
-
Set Environment Variables
Option A — Setup script (recommended, persists across restarts):
powershellirm https://raw.githubusercontent.com/himanshu91081/Quatarly-setup/main/set-claude-env.ps1 -OutFile set-claude-env.ps1; .\set-claude-env.ps1 -ApiKey "your-api-key-here"
bashcurl -fsSL https://raw.githubusercontent.com/himanshu91081/Quatarly-setup/main/set-claude-env.sh -o set-claude-env.sh && bash set-claude-env.sh your-api-key-here
Option B — Set manually for current session only:
bashexport ANTHROPIC_BASE_URL="https://api.quatarly.cloud/" export ANTHROPIC_AUTH_TOKEN="your-api-key-here" export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5-20251001" export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6-thinking" export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6-thinking"
powershell$env:ANTHROPIC_BASE_URL = "https://api.quatarly.cloud/" $env:ANTHROPIC_AUTH_TOKEN = "your-api-key-here" $env:ANTHROPIC_DEFAULT_HAIKU_MODEL = "claude-haiku-4-5-20251001" $env:ANTHROPIC_DEFAULT_SONNET_MODEL = "claude-sonnet-4-6-thinking" $env:ANTHROPIC_DEFAULT_OPUS_MODEL = "claude-opus-4-6-thinking"
Variable Value ANTHROPIC_BASE_URL https://api.quatarly.cloud/ANTHROPIC_AUTH_TOKEN Your Quatarly API key ANTHROPIC_DEFAULT_HAIKU_MODEL claude-haiku-4-5-20251001ANTHROPIC_DEFAULT_SONNET_MODEL claude-sonnet-4-6-thinkingANTHROPIC_DEFAULT_OPUS_MODEL claude-opus-4-6-thinkingWatch: Claude Code Setup GuideAfter using the setup script, runsource ~/.zshrc(macOS) orsource ~/.bashrc(Linux) to pick up the changes in the current terminal. GUI apps require a full logout/restart. -
Launch Claude Code
bashclaude
Claude Code will route all requests through Quatarly using your key and credit balance.
OpenCode
Use OpenCode as a terminal AI coding assistant routed through Quatarly. No OpenAI account needed — just your Quatarly key.
-
Install OpenCode
bashnpm install -g opencode-ai
-
Create the Config File
Edit or create
~/.config/opencode/opencode.json:json (~/.config/opencode/opencode.json){ "$schema": "https://opencode.ai/config.json", "provider": { "openai": { "options": { "baseURL": "https://api.quatarly.cloud/v1", "apiKey": "your-api-key-here" } } }, "model": "openai/gpt-5.3-codex" }Create it automatically from the terminal:
powershell$dir = "$env:USERPROFILE\.config\opencode" if (!(Test-Path $dir)) { New-Item -ItemType Directory -Force -Path $dir } @' { "$schema": "https://opencode.ai/config.json", "provider": { "openai": { "options": { "baseURL": "https://api.quatarly.cloud/v1", "apiKey": "your-api-key-here" } } }, "model": "openai/gpt-5.3-codex" } '@ | Set-Content "$dir\opencode.json"
bashmkdir -p ~/.config/opencode cat > ~/.config/opencode/opencode.json << 'EOF' { "$schema": "https://opencode.ai/config.json", "provider": { "openai": { "options": { "baseURL": "https://api.quatarly.cloud/v1", "apiKey": "qua_trail_your-key-here" } } }, "model": "openai/gpt-5.3-codex" } EOF
-
Launch OpenCode
bashopencode
OpenCode routes all requests through Quatarly. Switch models with
/modelinside the session — all Quatarly GPT, Gemini, and Claude models appear under theopenaiprovider.
Chat Completions
Send a chat message to any model. The request and response format is identical to the OpenAI Chat Completions API.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | required | Model ID from the models list (e.g. gpt-5.3-codex) |
| messages | array | required | Array of message objects with role and content |
| stream | boolean | optional | Stream tokens via SSE. Default: false |
| max_tokens | integer | optional | Max output tokens. Model default if omitted |
| temperature | number | optional | Sampling temperature 0–2. Default: 1 |
| top_p | number | optional | Nucleus sampling. Default: 1 |
| system | string | optional | System prompt (alternative to messages array system role) |
| tools | array | optional | Tool definitions for function calling |
Example Request
{
"model": "claude-sonnet-4-6-thinking",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Explain quantum entanglement simply." }
],
"stream": false,
"max_tokens": 1024
}
Response Format
{
"id": "chatcmpl-xyz123",
"object": "chat.completion",
"created": 1750000000,
"model": "claude-sonnet-4-6-thinking",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Quantum entanglement is when two particles..."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 32,
"completion_tokens": 118,
"total_tokens": 150
}
}
Parameters Reference
Common parameters across all models. Provider-specific parameters are passed through transparently.
| Parameter | Type | Default | Notes |
|---|---|---|---|
| temperature | float | 1.0 | 0 = deterministic, 2 = very random |
| max_tokens | int | model max | Hard cap on output length |
| stream | bool | false | SSE streaming. Use -N flag with curl |
| top_p | float | 1.0 | Nucleus sampling probability cutoff |
| stop | string[] | — | Stop sequences (up to 4) |
| presence_penalty | float | 0 | GPT models only |
| frequency_penalty | float | 0 | GPT models only |
| tools | array | — | Function calling tool definitions |
| tool_choice | string/object | "auto" | Tool selection mode |
cURL Examples
Basic Chat
curl -X POST "https://api.quatarly.cloud/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key-here" \ -d '{ "model": "gpt-5.3-codex", "messages": [{"role": "user", "content": "Hello!"}] }'
Streaming Response
curl -X POST "https://api.quatarly.cloud/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key-here" \ -N \ -d '{ "model": "claude-sonnet-4-6-thinking", "stream": true, "messages": [{"role": "user", "content": "Write a poem about the ocean."}] }'
Claude with System Prompt
curl -X POST "https://api.quatarly.cloud/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key-here" \ -d '{ "model": "claude-opus-4-6-thinking", "messages": [ {"role": "system", "content": "You are an expert Python developer."}, {"role": "user", "content": "Refactor this function for readability."} ], "max_tokens": 2048 }'
Gemini with High Temperature
curl -X POST "https://api.quatarly.cloud/v1/chat/completions" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key-here" \ -d '{ "model": "gemini-3.1-pro", "messages": [{"role": "user", "content": "Brainstorm 10 startup ideas."}], "temperature": 1.4, "max_tokens": 1024 }'
Claude via /v1/messages (Anthropic format)
If /v1/chat/completions isn't working with a Claude-only tool, try the Anthropic Messages endpoint instead. Note max_tokens is required and the system prompt is a top-level field.
curl -X POST "https://api.quatarly.cloud/v1/messages" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-api-key-here" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "claude-sonnet-4-6-thinking", "max_tokens": 1024, "system": "You are a helpful assistant.", "messages": [ {"role": "user", "content": "Explain transformers in ML simply."} ] }'
Python (OpenAI SDK)
Install the official OpenAI library and point it at Quatarly — no other changes needed.
pip install openai
Basic Usage
from openai import OpenAI client = OpenAI( api_key="your-api-key-here", base_url="https://api.quatarly.cloud/v1", ) response = client.chat.completions.create( model="claude-sonnet-4-6-thinking", messages=[ {"role": "user", "content": "Summarise the last decade of AI progress."} ], max_tokens=1024, ) print(response.choices[0].message.content)
Streaming
with client.chat.completions.stream( model="gpt-5.3-codex", messages=[{"role": "user", "content": "Write a sorting algorithm."}], ) as stream: for text in stream.text_stream: print(text, end="", flush=True)
Node.js (OpenAI SDK)
npm install openai
Basic Usage
import OpenAI from "openai"; const client = new OpenAI({ apiKey: "your-api-key-here", baseURL: "https://api.quatarly.cloud/v1", }); const response = await client.chat.completions.create({ model: "gemini-3.1-pro", messages: [{ role: "user", content: "What is the capital of France?" }], }); console.log(response.choices[0].message.content);
Streaming
const stream = await client.chat.completions.create({ model: "claude-haiku-4-5-20251001", messages: [{ role: "user", content: "Tell me a short story." }], stream: true, }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); }
Models Table
| Model ID | Family | Provider | Base URL |
|---|---|---|---|
| claude-sonnet-4-6-thinking | Claude | anthropic | ...quatarly.cloud/ |
| claude-opus-4-6-thinking | Claude | anthropic | ...quatarly.cloud/ |
| claude-haiku-4-5-20251001 | Claude | anthropic | ...quatarly.cloud/ |
| gemini-3.1-pro | Gemini | openai compat | ...quatarly.cloud/v1 |
| gemini-3-flash | Gemini | openai compat | ...quatarly.cloud/v1 |
| gpt-5.1 | GPT | openai | ...quatarly.cloud/v1 |
| gpt-5.1-codex | GPT | openai | ...quatarly.cloud/v1 |
| gpt-5.1-codex-max | GPT | openai | ...quatarly.cloud/v1 |
| gpt-5.2 | GPT | openai | ...quatarly.cloud/v1 |
| gpt-5.2-codex | GPT | openai | ...quatarly.cloud/v1 |
| gpt-5.3-codex | GPT | openai | ...quatarly.cloud/v1 |
| gpt-5.4 | GPT | openai | ...quatarly.cloud/v1 |
Error Codes
All errors follow the OpenAI error response format with an additional code field.
| HTTP Status | Meaning | Common Cause |
|---|---|---|
| 400 | Bad Request | Missing required field, invalid model name, malformed JSON |
| 401 | Unauthorized | Missing or invalid API key |
| 402 | Payment Required | Monthly credits exhausted for your key |
| 429 | Too Many Requests | Rate limit exceeded — wait and retry |
| 500 | Internal Server Error | Upstream provider error; retry with backoff |
| 503 | Service Unavailable | Provider temporarily unreachable |
{
"error": {
"message": "Rate limit exceeded. Please retry after 60 seconds.",
"type": "rate_limit_error",
"code": "rate_limit_exceeded"
}
}
Script Files
| File | Platform | Purpose |
|---|---|---|
| Windows (PowerShell) | Add all models to Factory AI Droid | |
| macOS / Linux (Bash) | Add all models to Factory AI Droid | |
| Windows (PowerShell) | Set Claude Code environment variables globally | |
| macOS / Linux (Bash) | Set Claude Code environment variables globally |
.backup copy of your original config is saved automatically. Python 3 is required for the Factory scripts.