Docs
10M FREE CREDITS ON SIGNUPOne gateway, every frontier model. OpenAI & Anthropic compatible — keep your SDKs, change one URL. Works with the MarsCLI agent, IDE tools and anything that speaks OpenAI.
https://marsai.click/v1
Quick start
- Create an account — 10M Free Credits land instantly (valid 7 days).
- Get a key — Dashboard → API keys →
sk-mars-.... Free-credit accounts use MarsCLI instead; keys unlock every SDK. - Point your client at
https://marsai.click/v1and make a call:
curl https://marsai.click/v1/chat/completions \
-H "Authorization: Bearer sk-mars-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello, Mars"}]}'
MarsCLI — coding agent in your terminal
MarsCLI is our agentic coding CLI. Install it, run it, sign in once with the browser device-code flow — no key management. Accounts on Free Credits use MarsCLI for paid models.
npm i -g @mars_ai/marscli@latest
mars
First run opens the device-code sign-in (browser). Then mars is your TUI, mars --help lists everything. More in Apps.
Authentication
Bearer token (OpenAI style) or x-api-key (Anthropic style) — both accepted on every endpoint:
Authorization: Bearer sk-mars-YOUR_KEY
x-api-key: sk-mars-YOUR_KEY
Keys are created in the Dashboard. Treat them like passwords — they bill your credits.
Endpoints
Two native shapes, fully translated in both directions:
POST /chat/completions # OpenAI shape (tools, vision, JSON mode)
POST /messages # Anthropic shape (system, tools, vision)
GET /models # list your available models
POST /embeddings # embeddings
Streaming
Standard SSE. Add "stream": true — OpenAI clients get OpenAI chunks, Anthropic clients get message_start / content_block_delta events. Provider names are never exposed.
curl https://marsai.click/v1/chat/completions \
-H "Authorization: Bearer sk-mars-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","stream":true,"messages":[{"role":"user","content":"Count to 5"}]}'
List models
curl https://marsai.click/v1/models -H "Authorization: Bearer sk-mars-YOUR_KEY"
SDK examples
Python — OpenAI
pip install openai
from openai import OpenAI
client = OpenAI(
base_url="https://marsai.click/v1",
api_key="sk-mars-YOUR_KEY",
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello, Mars"}],
)
print(resp.choices[0].message.content)
Python — Anthropic
pip install anthropic
import anthropic
client = anthropic.Anthropic(
base_url="https://marsai.click/v1",
api_key="sk-mars-YOUR_KEY",
)
msg = client.messages.create(
model="claude-3-5-sonnet",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Mars"}],
)
print(msg.content[0].text)
Node — OpenAI
npm install openai
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://marsai.click/v1",
apiKey: "sk-mars-YOUR_KEY",
});
const resp = await client.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Hello, Mars" }],
});
console.log(resp.choices[0].message.content);
Node — Anthropic
npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://marsai.click/v1",
apiKey: "sk-mars-YOUR_KEY",
});
const msg = await client.messages.create({
model: "claude-3-5-sonnet",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Mars" }],
});
console.log(msg.content[0].text);
Connect your tools
Anything with an OpenAI- or Anthropic-compatible base URL plugs straight in. Paste, authenticate, go.
Claude Code
Point Claude Code at our Anthropic-compatible endpoint — no Anthropic login needed.
export ANTHROPIC_BASE_URL="https://marsai.click"
export ANTHROPIC_AUTH_TOKEN="sk-mars-YOUR_KEY"
claude
OpenCode
Run opencode auth login, choose "Other", paste your key and base URL — or set it in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"marsai": {
"npm": "@ai-sdk/openai-compatible",
"options": { "baseURL": "https://marsai.click/v1" },
"models": { "gpt-4o": {}, "claude-3-5-sonnet": {} }
}
}
}
Codex CLI
OpenAI-compatible provider in ~/.codex/config.toml, key from your environment:
model_provider = "marsai"
model = "gpt-4o"
[model_providers.marsai]
name = "MarsAI"
base_url = "https://marsai.click/v1"
env_key = "MARSAI_API_KEY"
export MARSAI_API_KEY="sk-mars-YOUR_KEY"
Cline / Kilo Code / Roo Code
In the VS Code extension, pick the OpenAI Compatible provider:
API Provider: OpenAI Compatible
Base URL: https://marsai.click/v1
API Key: sk-mars-YOUR_KEY
Cursor
Settings → Models → paste key, then override the base URL:
OpenAI API Key: sk-mars-YOUR_KEY
Override Base URL: https://marsai.click/v1
Zed
Set OPENAI_API_KEY=sk-mars-... in your environment, then in settings.json:
{
"language_models": {
"openai": {
"api_url": "https://marsai.click/v1",
"available_models": [
{ "name": "gpt-4o", "display_name": "GPT-4o via MarsAI", "max_tokens": 128000 }
]
}
}
}
Continue
Add a model block to ~/.continue/config.yaml:
models:
- model: gpt-4o
title: GPT-4o via MarsAI
provider: openai
apiBase: https://marsai.click/v1
apiKey: sk-mars-YOUR_KEY
roles: [chat, edit, apply]
Aider
Standard OpenAI env vars, then launch with your model:
export OPENAI_API_BASE=https://marsai.click/v1
export OPENAI_API_KEY=sk-mars-YOUR_KEY
aider --model openai/gpt-4o
Goose
Run goose configure, choose the OpenAI provider, paste base URL and key:
Provider: OpenAI
Base URL: https://marsai.click/v1
API Key: sk-mars-YOUR_KEY
Windsurf / any OpenAI client
Any tool with a custom OpenAI base URL works. In Windsurf: Settings → Models:
API Key: sk-mars-YOUR_KEY
Base URL: https://marsai.click/v1
Credits & billing
- Free Credits always burn first: new accounts get 10M credits valid 7 days. Redeem codes and referral rewards top them up.
- Premium Credits burn next — bought with credit plans (Wallet money never pays for API calls).
- Each model has a burn multiplier — billed credits = tokens × burn. See Models for per-model rates; multipliers under 1× burn slower.
- Free models cost nothing — they never touch either balance.
- HTTP 402 = out of credits. Redeem a code or buy a plan in Billing; remaining balances and invoices live there too.
- Free-credit accounts run paid models through MarsCLI only; API keys need any paid plan.
Errors & limits
| Code | Meaning |
|---|---|
| 400 | Bad request — check JSON body and model name |
| 401 | Missing or invalid key |
| 402 | Insufficient credits — top up in Billing |
| 403 | Model not available to your account tier |
| 429 | Rate limit (plan default 60 RPM) or upstream capacity — retry with backoff |
| 5xx | Upstream error, reason surfaced in the response body |
Errors pass through with their real reason so your retries are informed — no silent provider swapping. Questions? Contact or ask on Discord.