MarsAI
Sign in Get Started

Docs

10M FREE CREDITS ON SIGNUP

One 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.

Base URL
https://marsai.click/v1
# Quick start# MarsCLI# Authentication# Endpoints# SDK examples# Connect your tools# Credits & billing# Errors

Quick start

  1. Create an account — 10M Free Credits land instantly (valid 7 days).
  2. Get a key — Dashboard → API keys → sk-mars-.... Free-credit accounts use MarsCLI instead; keys unlock every SDK.
  3. Point your client at https://marsai.click/v1 and make a call:
curl
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.

shell
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:

header
Authorization: Bearer sk-mars-YOUR_KEY
header
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:

routes
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
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
curl https://marsai.click/v1/models -H "Authorization: Bearer sk-mars-YOUR_KEY"

SDK examples

Python — OpenAI

python
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

python
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

javascript
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

javascript
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.

bash
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:

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:

toml
model_provider = "marsai"
model = "gpt-4o"

[model_providers.marsai]
name = "MarsAI"
base_url = "https://marsai.click/v1"
env_key = "MARSAI_API_KEY"
bash
export MARSAI_API_KEY="sk-mars-YOUR_KEY"

Cline / Kilo Code / Roo Code

In the VS Code extension, pick the OpenAI Compatible provider:

ini
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:

ini
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:

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:

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:

bash
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:

ini
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:

ini
API Key:   sk-mars-YOUR_KEY
Base URL:  https://marsai.click/v1

Credits & billing

Errors & limits

CodeMeaning
400Bad request — check JSON body and model name
401Missing or invalid key
402Insufficient credits — top up in Billing
403Model not available to your account tier
429Rate limit (plan default 60 RPM) or upstream capacity — retry with backoff
5xxUpstream 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.