Docs
5M FREE CREDITS — VERIFY & CLAIMMarsAI accepts OpenAI and Anthropic request formats through one base URL. It works with the desktop app, Mars CLI, IDE tools and compatible SDKs.
For complete worked examples, use the developer guides: OpenCode setup, Python and JavaScript, context continuity, tools, billing and failure handling.
https://marsai.click/v1
Quick start
- Create an account — free, no credits at signup.
- Verify & claim — verify Discord + Telegram in your dashboard and 5M Free Credits land instantly (valid 7 days). Verification also unlocks key creation.
- Get a key — Dashboard → API keys →
sk-mars-.... - 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":"marsai/auto-free","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 install -g @mars_ai/marscli@latest
mars
First run opens the device-code sign-in (browser). Then mars is your TUI, mars --help lists everything. Full manual on the Mars CLI page.
MarsAI Desktop — the agent as an app
The same coding agent as a native desktop app for Windows x64, macOS (Apple Silicon) and Linux (x64 & arm64). API-key-first: paste a sk-mars-... key and your MarsAI credits — including the 5M Free Credit verification bonus — work everywhere. Pick models per message. Your code stays on your machine.
mars-win-x64-<version>.exe # Windows installer
mars-mac-arm64-<version>.dmg # macOS (Apple Silicon)
mars-linux-amd64-<version>.deb # Debian / Ubuntu
mars-linux-x86_64-<version>.rpm # Fedora / RHEL / openSUSE
mars-linux-x64-<version>.pacman # Arch
mars-linux-x86_64-<version>.AppImage # any Linux
- Windows: SmartScreen shows "Unknown publisher" (not code-signed yet) — More info → Run anyway. Installs to
%LOCALAPPDATA%\Programs\MarsAI. - macOS: not notarized yet — right-click → Open, or System Settings → Privacy & Security → Open Anyway.
- Linux:
.deb/.rpm/.pacmaninstall dependencies; AppImage needslibgtk-3,libnss3,libatk-bridge,libasound2. - Self-updating on all three platforms — Settings → Updates.
- Sign in: create a key at Dashboard → API keys, paste it in the sidebar footer or Settings.
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 /responses # OpenAI Responses shape (Codex CLI, GPT-5 clients)
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, Responses clients get response.output_text.delta / response.completed 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":"marsai/auto-free","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="marsai/auto-free",
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="marsai/auto-free",
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: "marsai/auto-free",
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: "marsai/auto-free",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Mars" }],
});
console.log(msg.content[0].text);
Connect your tools
Clients with a custom OpenAI or Anthropic base URL can connect to MarsAI. Replace every example model with an exact public alias from the catalog.
OpenCode users should follow the current OpenCode V2 setup guide, including environment based key handling and the custom provider fields.
Claude Code
Point Claude Code at our Anthropic-compatible endpoint and map its model slots to your models:
export ANTHROPIC_BASE_URL="https://marsai.click"
export ANTHROPIC_AUTH_TOKEN="sk-mars-YOUR_KEY"
export ANTHROPIC_DEFAULT_OPUS_MODEL="marsai/auto-free"
export ANTHROPIC_DEFAULT_SONNET_MODEL="marsai/auto-free"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="marsai/auto-free"
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": { "marsai/auto-free": {} }
}
}
}
Codex CLI
Responses API works natively — set wire_api = "responses" in ~/.codex/config.toml:
model_provider = "marsai"
model = "marsai/auto-free"
[model_providers.marsai]
name = "MarsAI"
base_url = "https://marsai.click/v1"
wire_api = "responses"
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": "marsai/auto-free", "display_name": "MarsAI Auto", "max_tokens": 128000 }
]
}
}
}
Continue
Add a model block to ~/.continue/config.yaml:
models:
- model: marsai/auto-free
title: MarsAI Auto
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/marsai/auto-free
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 from the verification grant expire after seven days. A paid model uses them only when its billing settings allow it; eligible calls spend them before Premium Credits.
- Premium Credits come from one-time credit packs. Each pack has its own validity period; Wallet money buys packs but does not pay for API calls directly.
- Multiplier models charge billable tokens × the published ratio. Directional models charge input and output separately in Premium Credits per million tokens.
- Free models cost nothing — they never touch either balance.
- HTTP 402 means the eligible balance cannot cover the request. Review balances or buy a pack in Billing.
- Free accounts have an effective cap of 30 requests/min and 200 requests/day. Active paid packs can raise the applicable limits. HTTP 429 can also report temporary model capacity, so read the error body.
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 | Request limit or temporary model capacity; inspect the body before retrying |
| 5xx | Upstream error, reason surfaced in the response body |
Read the structured error before retrying, and do not replay a stream that already produced output without accounting for partial work. See the API error guide or contact support.