Setup CLI

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

Overview

@sansaai/setup is a single command that configures coding agents to use Sansa as the LLM provider with model sansa-auto. It stores your API key, writes OpenAI-compatible provider settings for agents that support them, and installs a Sansa skill so the agent knows how to work with Sansa.

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 -y in a terminal (a TTY) and setup asks which detected agents should use Sansa as the model provider and which should get the skill.

-y skips every prompt and targets whatever agents it detects. This is the path a coding agent uses when it runs the command itself from an onboarding prompt:

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

Target a specific agent (or agents) with -a / --agent instead of relying on detection:

npx -y @sansaai/setup --api-key sk-... -a claude-code
npx -y @sansaai/setup --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 (base URL + sansa-auto)Sansa skill
Claude CodeNoYes
CodexYesYes
CursorNoYes
OpenCodeYesYes

Codex and OpenCode are OpenAI-compatible, so setup points them at Sansa directly. Claude Code and Cursor don't take an OpenAI-compatible provider config, so they receive the sansa skill only, which teaches the agent how to call Sansa.

What it writes

User-level credentials (mode 0600):

  • ~/.sansa/credentialsSANSA_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.