← Back to list

CLI configuration guide

Point the two terminal-based assistants — Claude Code and OpenAI Codex — at Starsg so they share one gateway, one set of API keys and one usage view.

ImportantBefore you start, prepare an API Key created in the console. If you don't have one yet, follow the link to create it.

1. Environment check

Confirm Node.js is installed by running npm list -g --depth-0 in your terminal. If the shell reports "command not found", follow this guide to install the Node.js environment Claude Code / Codex need, then rerun the command.

bash
npm list -g --depth-0

Install both CLIs in one go:

bash
npm i -g @anthropic-ai/claude-code@latest
npm i -g @openai/codex@latest
Important: run each of the commands below once to verify the install. The first launch is also what generates each CLI's config directory under your home folder — every later step depends on those directories, so do not skip this.
bash
claude
codex

If the terminal opens a chat prompt, prints a welcome banner or shows a selection menu, that CLI is installed correctly.

Important: if running claude reports it cannot reach the Anthropic service, follow Claude Code cannot connect to Anthropic to run the extra setup commands first, then come back and continue with the per-CLI configuration sections below.

2. Claude Code

Open ~/.claude/settings.json (create the file if it does not exist) and write:

json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.starsg.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-abc...xyz",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-7",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5",
    "CLAUDE_CODE_ATTRIBUTION_HEADER": "0",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_DISABLE_TERMINAL_TITLE": "1"
  }
}

Replace sk-abc...xyz with a key created in the console. Run claude in your terminal — a successful chat reply confirms the wiring.

Note: if you still hit errors after configuring and the CLI prompts you to log in, follow Claude Code cannot connect to Anthropic to resolve it.

3. Codex

Edit ~/.codex/config.toml — this file holds the gateway endpoint, model defaults and reasoning effort:

toml
disable_response_storage = true
model = "gpt-5.5"
model_provider = "novamaas"
model_reasoning_effort = "high"
model_verbosity = "high"

[features]
web_search_request = true

[model_providers.novamaas]
base_url = "https://api.starsg.ai/v1"
name = "novamaas"
requires_openai_auth = true
wire_api = "responses"

Then write your API key into ~/.codex/auth.json:

json
{
  "OPENAI_API_KEY": "sk-abc...xyz"
}
Note: right after install these three files often don't exist — you need to create them manually and paste the content above.

4. Verify

Run claude or codex in a terminal — once you receive a chat reply, the integration is live.