Setup CLI

Configure coding agents to use Sansa as the LLM provider in one command

Overview

@sansaai/setup stores your API key, writes a sansa-auto provider configuration for agents it can configure automatically, and installs a Sansa skill so supported agents know how to work with Sansa. Claude Code's Anthropic Messages gateway requires the short manual step documented below.

Quick Start

Run it with your Sansa API key (available in your dashboard):

SANSA_API_KEY=sk-... npx -y @sansaai/setup

Or pass the key directly:

npx -y @sansaai/setup --api-key sk-...

The key is read from --api-key or SANSA_API_KEY. Setup never prompts for the key itself — provide it up front with one of the two forms above.

Interactive vs. non-interactive

Run without the package's -y / --yes option in a terminal (a TTY) and setup asks which detected agents should use Sansa as the model provider and which should get the skill.

--yes skips every setup prompt. With an explicit -a, it configures those targets. Without -a, it installs the skill for detected agents but deliberately skips Codex/OpenCode provider rewrites.

This is the non-interactive form a coding agent can use to install detected skills:

npx -y @sansaai/setup --yes --api-key sk-...

Target a specific agent (or agents) with -a / --agent when provider configuration or an explicit install target is required:

npx -y @sansaai/setup --yes --api-key sk-... -a claude-code
npx -y @sansaai/setup --yes --api-key sk-... -a codex,cursor

Options

--api-key <key>     SANSA_API_KEY to store (overrides the env var)
-a, --agent <id>    Target a specific agent (repeatable). Valid: claude-code, codex, cursor, opencode
-y, --yes           Skip all confirmation prompts
--restore           Revert prior Codex and OpenCode provider settings from backups
-h, --help          Show this help

Supported agents

AgentProvider config written by setupSansa skill
Claude CodeNo — configure the Messages gateway manuallyYes
CodexYesYes
CursorNoYes
OpenCodeYesYes

Codex and OpenCode are OpenAI-compatible, so setup points them at Sansa directly. Claude Code uses Sansa's native Anthropic Messages endpoint rather than an OpenAI-compatible provider. The setup package currently installs the Sansa skill for Claude Code but does not write its gateway environment variables. Cursor receives the skill only.

Claude Code provider setup

To route Claude Code inference through Sansa, configure the Messages gateway after running setup:

export SANSA_API_KEY="sk-sansa-..."
export ANTHROPIC_BASE_URL="https://api.sansaml.com"
export ANTHROPIC_AUTH_TOKEN="$SANSA_API_KEY"
claude

Do not append /v1; Claude Code adds /v1/messages. If the API key has an endpoint allowlist, include the messages scope.

See Messages for persistent settings, model discovery, supported Claude capabilities, streaming, and troubleshooting.

What it writes

User-level credentials (mode 0600):

  • ~/.sansa/credentials — SANSA_API_KEY=...
  • ~/.sansa/api-key — the raw key, read by Codex and OpenCode

Provider config, with sansa-auto as the default model against https://api.sansaml.com/v1:

  • Codex: ~/.codex/config.toml
  • OpenCode: ~/.config/opencode/opencode.json

The bundled sansa skill is copied into each selected agent's skill directory (for example ~/.claude/skills/sansa, ~/.cursor/skills/sansa).

Restore

--restore reverts Codex and OpenCode provider files from the first backup setup made under ~/.sansa/backups, undoing the provider config changes:

npx -y @sansaai/setup --restore

Credentials, project env writes, and installed skills are left in place — restore only touches the provider files it edited.

Requirements

  • Node.js (run via npx, no install step needed)
  • A Sansa API key — create one at your dashboard

Source

Published as @sansaai/setup on npm.