Claude Code is a command-line coding agent from Anthropic that reads your codebase, edits files, runs commands, and connects to LLM APIs in the backend. This guide covers the full CLI documentation: how to set it up, which flags and slash commands are available, how to write custom slash commands, and how to route its API calls to Novita AI instead of the default Anthropic endpoint.
What is Claude Code?
Claude Code is an agentic coding tool available as a CLI, a VS Code extension, a JetBrains plugin, a desktop app, and a browser interface. All surfaces share the same underlying engine: Claude Code connects to an LLM API backend, reads your project, and runs multi-step tasks like writing tests, refactoring across files, creating pull requests, and managing git.
The CLI is the most flexible surface. It follows Unix conventions — you can pipe logs into it, run it in CI with the -p flag, or chain it with other tools. Configuration lives in files (CLAUDE.md, .claude/settings.json, environment variables), so it behaves predictably in automated contexts.
Under the hood, Claude Code sends every request to an Anthropic-compatible API endpoint. By default that endpoint is api.anthropic.com, but you can redirect it to any Anthropic-compatible provider — including Novita AI — with a single environment variable.
Claude Code Setup
Installation
The recommended method on macOS, Linux, and WSL is the native installer:
curl -fsSL https://claude.ai/install.sh | bash
On Windows PowerShell:
irm https://claude.ai/install.ps1 | iex
Native installs update automatically in the background.
If you prefer npm, Node.js 18 or higher is required:
node --version # must be 18 or higher
npm install -g @anthropic-ai/claude-code
Homebrew (macOS) tracks the stable release channel:
brew install --cask claude-code
Homebrew does not auto-update. Run brew upgrade claude-code when you want the latest version.
First run
Navigate to a project directory and launch the interactive session:
cd your-project
claude
On first use, Claude Code prompts you to log in. After authentication, it reads your project and waits for instructions.
Project setup
Run /init in any new repository to generate a starter CLAUDE.md file. Claude Code reads CLAUDE.md at the start of every session, so it’s the right place for coding standards, preferred libraries, architecture notes, and review checklists.
/init
After /init, use /memory to edit the file or enable auto-memory, which saves observations Claude makes about your project across sessions.
CLI Commands Reference
Claude Code’s top-level shell commands start sessions, manage authentication, and handle background work. A partial list of the most useful ones:
| Command | Description |
|---|---|
claude | Start an interactive session in the current directory |
claude "query" | Start a session with an initial prompt |
claude -p "query" | Run a query and exit (non-interactive / SDK mode) |
cat file | claude -p "query" | Pipe content into a query |
claude -c | Continue the most recent session in the current directory |
claude -r "name" "query" | Resume a session by name or ID |
claude update | Update to the latest version |
claude install stable | Install or reinstall a specific version |
claude auth login | Sign in to your Anthropic account |
claude auth login --console | Sign in with API key billing instead of a subscription |
claude auth status | Show authentication status |
claude agents --json | Open agent view, print active sessions as JSON |
claude mcp | Configure MCP servers |
claude daemon status | Check the background-session supervisor state |
If you mistype a subcommand, Claude Code suggests the closest match: claude udpate prints Did you mean claude update?.
CLI Flags Reference
Flags modify how Claude Code behaves for a session. Pass them after claude on any invocation. A selection of the most commonly needed flags:
| Flag | What it does |
|---|---|
-p, --print | Non-interactive mode; print response and exit |
-c, --continue | Load the most recent conversation |
-r, --resume | Resume a session by ID or name |
--model | Set the model for this session (sonnet, opus, haiku, or a full model ID) |
--permission-mode | Start in a permission mode: default, plan, auto, acceptEdits, bypassPermissions |
--add-dir | Grant file access to an additional directory |
--system-prompt | Replace the system prompt entirely |
--append-system-prompt | Append to the default system prompt |
--max-turns | Limit agentic turns in -p mode |
--max-budget-usd | Cap API spend in -p mode |
--output-format | Output format for -p mode: text, json, stream-json |
--bg | Start as a background agent, return immediately |
--worktree, -w | Start in an isolated git worktree |
--bare | Skip auto-discovery of hooks, skills, plugins, MCP for faster scripted calls |
--verbose | Show full turn-by-turn output |
--mcp-config | Load MCP servers from a JSON file |
--effort | Set reasoning effort: low, medium, high, xhigh, max |
The --print + --output-format json combination is the standard pattern for scripting. For CI pipelines with budget constraints, combine it with --max-budget-usd and --max-turns.
Slash Commands Documentation
Slash commands run inside an active session. Type / to see everything available, or / followed by letters to filter. Commands only work at the start of a message.
Session and context management
| Command | Purpose |
|---|---|
/clear | Start a new conversation; previous session stays in /resume |
/compact | Summarize the conversation to free context window space |
/context | Visualize context usage and see optimization suggestions |
/resume | Reopen a previous session by name or from a picker |
/branch | Fork the conversation to try a different direction |
/rewind | Roll code and conversation back to a checkpoint |
Project setup
| Command | Purpose |
|---|---|
/init | Generate a starter CLAUDE.md for the project |
/memory | Edit CLAUDE.md files and manage auto-memory |
/mcp | Manage MCP server connections interactively |
/agents | Configure subagent settings |
/permissions | Set allow, ask, and deny rules for tools |
/hooks | View hook configurations |
Development workflow
| Command | Purpose |
|---|---|
/plan | Enter plan mode before a large change |
/model | Switch the active model |
/effort | Adjust reasoning effort level |
/diff | Open the interactive diff viewer |
/code-review [--fix] | Review the current diff; --fix applies findings |
/security-review | Deep security pass on pending changes |
/batch <instruction> | Decompose a large change and run it in parallel worktrees |
/background | Detach the session to run as a background agent |
Utilities
| Command | Purpose |
|---|---|
/help | Show available commands |
/doctor | Diagnose install and settings issues |
/usage | Show session cost and plan usage |
/export | Export the conversation as plain text |
/config | Open settings or set a value directly: /config thinking=false |
/skills | List available skills |
Custom Slash Commands
Custom slash commands — now called skills — let you package repeatable procedures your team can share.
How to create a custom command
Create a directory under .claude/skills/ (project-level) or ~/.claude/skills/ (personal, available across all projects):
mkdir -p .claude/skills/review-pr
Create a SKILL.md file inside that directory:
---
description: Review an open GitHub PR for security issues and test coverage gaps. Use when the user asks to review a PR or check pull request quality.
---
## Instructions
Review the pull request with these priorities:
1. Identify any security vulnerabilities: injection risks, auth gaps, data exposure.
2. Check test coverage for new code paths.
3. Flag any missing error handling at system boundaries.
Summarize findings in three sections: Security, Coverage, Other. Use ✓ for passing checks and ⚠ for issues.
This creates a /review-pr command you can invoke directly:
/review-pr
Claude also loads the skill automatically when you ask something that matches the description.
Skill locations and priority
Skills follow a priority order: enterprise overrides personal, personal overrides project. Project skills are in .claude/skills/. Personal skills (available in all your projects) go in ~/.claude/skills/.
~/.claude/skills/ → personal, all projects
.claude/skills/ → this project only
Custom commands in .claude/commands/ still work. A file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy and behave the same way.
Dynamic context injection
Skills can inject live data before Claude sees the prompt. The ! prefix runs a shell command and inlines its output:
---
description: Summarize uncommitted changes and flag risks.
---
## Current diff
!`git diff HEAD`
## Instructions
Summarize the changes in bullet points. Flag any risks: missing error handling, hardcoded values, untested paths.
When you run this skill, Claude Code executes git diff HEAD and replaces that line with the actual diff output. Claude sees the real working-tree state rather than having to request it through tool calls.
Using Novita AI as the LLM Backend
Claude Code routes all API traffic through the ANTHROPIC_BASE_URL environment variable. Setting it to Novita AI’s Anthropic-compatible endpoint gives you access to a wide range of models — including DeepSeek, Kimi, Qwen, and GLM variants — at substantially lower per-token cost than the default Anthropic endpoint.
Get your Novita AI API key
Sign up for a Novita AI account to receive free trial credits. Navigate to the Key Management page, click Create New Key, and copy the key immediately.
Set environment variables
On Mac and Linux:
export ANTHROPIC_BASE_URL="https://api.novita.ai/anthropic"
export ANTHROPIC_AUTH_TOKEN="<Your Novita API Key>"
export ANTHROPIC_MODEL="deepseek/deepseek-v4-flash"
export ANTHROPIC_SMALL_FAST_MODEL="deepseek/deepseek-v4-flash"
On Windows (Command Prompt):
set ANTHROPIC_BASE_URL=https://api.novita.ai/anthropic
set ANTHROPIC_AUTH_TOKEN=<Your Novita API Key>
set ANTHROPIC_MODEL=deepseek/deepseek-v4-flash
set ANTHROPIC_SMALL_FAST_MODEL=deepseek/deepseek-v4-flash
To persist these on Mac/Linux, add the export lines to ~/.bashrc or ~/.zshrc.
ANTHROPIC_SMALL_FAST_MODEL controls the lightweight model Claude Code uses for fast internal tasks like file lookups and quick summaries. Setting it to the same model ID keeps all traffic on one billing account.
Start Claude Code
With environment variables in place, launch Claude Code normally:
cd your-project
claude
Claude Code connects to Novita AI’s endpoint with the model you specified. The interactive session works identically — all CLI flags, slash commands, and custom skills behave the same way regardless of which backend is in use.
For scripting and CI, the same approach applies:
cat logs.txt | claude -p "find any error patterns" --output-format json
Novita AI’s LLM API supports the full Anthropic messages format, including tool use, structured outputs, and streaming, so every Claude Code feature works without modification.
Agent Sandbox for isolated execution
If you’re building automated pipelines on top of Claude Code, Novita AI’s Agent Sandbox provides isolated, firecracker-backed execution environments for running agents programmatically. This is relevant for CI workflows, background agents, and any multi-agent setup where you need execution isolation rather than running directly on your development machine.
Claude Code as an IDE Tool
Claude Code integrates with editors directly, which is what people mean when they say “claude code is an ide” — it’s not a standalone IDE but a coding agent that embeds into your existing environment.
VS Code and Cursor
Install the Claude Code extension from the VS Code Marketplace (search “Claude Code”) or from the Cursor marketplace. After installing, open the Command Palette (Cmd+Shift+P / Ctrl+Shift+P), type “Claude Code”, and select Open in New Tab.
The VS Code integration adds inline diff review, @-file mentions, plan review before edits, and conversation history directly in the editor panel. You can also use Claude Code in the integrated terminal alongside the extension.
JetBrains
Install the Claude Code plugin from the JetBrains Marketplace and restart your IDE. The plugin requires the CLI installed separately. It provides interactive diff viewing and selection context sharing in IntelliJ IDEA, PyCharm, WebStorm, and other JetBrains IDEs.
Desktop app and web
The Claude Code desktop app (macOS and Windows) lets you review diffs visually, run multiple sessions side by side, and schedule recurring tasks. The web interface at claude.ai/code runs sessions in the browser with no local setup, useful for repos you don’t have locally or for kicking off long-running tasks you can monitor remotely.
FAQ
What is ANTHROPIC_BASE_URL and why does it matter?
ANTHROPIC_BASE_URL tells Claude Code which API endpoint to send requests to. The default is api.anthropic.com. Setting it to https://api.novita.ai/anthropic routes all traffic to Novita AI’s Anthropic-compatible endpoint, where you can use alternative models at different price points. No code changes or plugins are required — just the environment variable.
What is the difference between CLI flags and slash commands?
CLI flags (like --model, --permission-mode, --max-turns) are set when you launch the claude binary from your shell. They configure the session before it starts. Slash commands (like /model, /plan, /compact) run inside an active session and change behavior mid-conversation.
Can I use Claude Code without a Claude subscription?
Yes. claude auth login --console signs you in with Anthropic Console API key billing, which uses pay-per-token pricing rather than a subscription. If you route to Novita AI via ANTHROPIC_BASE_URL, you only need a Novita AI account — your Anthropic account is not billed.
How do custom slash commands differ from CLAUDE.md?
CLAUDE.md content loads at the start of every session and stays in context throughout. Skills (custom commands) load only when invoked, so long reference material adds no token cost until you actually need it. Use CLAUDE.md for project facts Claude should always know — coding standards, build commands, architecture notes. Use skills for procedures you run on demand — PR review checklists, deployment steps, test generation workflows.
Does Claude Code work in CI?
Yes. Use claude -p "query" --output-format json for non-interactive mode with structured output. Add --max-budget-usd to cap spend and --max-turns to bound execution time. The --bare flag skips auto-discovery of hooks, skills, and plugins for faster startup in scripted contexts. Claude Code also integrates with GitHub Actions and GitLab CI/CD through official workflow templates.
Novita AI is an AI cloud platform that offers developers an easy way to deploy AI models using our simple API, while also providing affordable and reliable GPU cloud for building and scaling.
