Claude Code CLI Documentation: Setup, Slash Commands, and LLM API Integration

Claude Code CLI Documentation: Setup, Slash Commands, and LLM API Integration

Claude Code is a terminal-first coding agent from Anthropic. It reads your codebase, edits files, runs commands, and can connect to Anthropic-compatible backends instead of only using Anthropic’s default API. This guide covers Claude Code CLI setup, slash commands, custom skills, and how to route requests through Novita AI.

If you need databases, browsers, or other external tools, pair this with the Claude MCP configuration guide.

Key Takeaways

  • Claude Code is a command-line agent, not just a prompt box.
  • /compact, /resume, /permissions, and /model are session commands, while -p and --resume are CLI flags.
  • Custom slash commands now live as skills, so .claude/skills/ and .claude/commands/ both matter.
  • Novita AI can serve as the Anthropic-compatible backend through ANTHROPIC_BASE_URL.
  • Claude Code fits both IDE-style workflows and automated agent runs.

What is Claude Code?

Claude Code is Anthropic’s agentic coding tool. The CLI runs in your terminal, but the same agent also appears in the desktop app, browser interface, and editor integrations.

The CLI is the most flexible surface. It follows Unix conventions, so you can pipe files into it, run it non-interactively with -p, and wire it into scripts or CI. Configuration lives in CLAUDE.md, .claude/settings.json, and environment variables, which makes it a strong fit for repeatable coding workflows.

Under the hood, Claude Code sends requests to an Anthropic-compatible API endpoint. By default that endpoint is Anthropic’s own service, but you can redirect it to Novita AI’s LLM API with a single environment variable.

Claude Code Setup

Installation

Install the CLI with Node.js 18 or later:

npm install -g @anthropic-ai/claude-code

First Run

Launch Claude Code in a project directory:

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

CommandDescription
claudeStart an interactive session in the current directory
claude "query"Start a session with an initial prompt
claude -p "query"Run a query and exit
cat file | claude -p "query"Pipe content into a query
claude -cContinue the most recent session in the current directory
claude -r "name" "query"Resume a session by name or ID
claude updateUpdate to the latest version
claude install stableInstall or reinstall the stable binary
claude auth loginSign in to your Anthropic account
claude auth login --consoleSign in with API key billing instead of a subscription
claude auth statusShow authentication status
claude mcpConfigure MCP servers
claude doctorShow install and settings diagnostics

CLI Flags Reference

FlagWhat it does
-p, --printNon-interactive mode; print response and exit
-c, --continueLoad the most recent conversation
-r, --resumeResume a session by ID or name
--modelSet the model for this session
--permission-modeStart in a permission mode
--add-dirGrant file access to an additional directory
--system-promptReplace the system prompt entirely
--append-system-promptAppend to the default system prompt
--max-turnsLimit agentic turns in -p mode
--max-budget-usdCap API spend in -p mode
--output-formatOutput format for -p mode: text, json, stream-json
--bgStart as a background agent, return immediately
--worktree, -wStart in an isolated git worktree
--bareSkip auto-discovery of hooks, skills, plugins, and MCP for faster scripted calls
--verboseShow full turn-by-turn output
--mcp-configLoad MCP servers from a JSON file
--effortSet reasoning effort

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

CommandPurpose
/clearStart a new conversation; previous session stays in /resume
/compactSummarize the conversation to free context window space
/contextVisualize context usage and see optimization suggestions
/resumeReopen a previous session by name or from a picker
/branchFork the conversation to try a different direction
/rewindRoll code and conversation back to a checkpoint

Project Setup

CommandPurpose
/initGenerate a starter CLAUDE.md for the project
/memoryEdit CLAUDE.md files and manage auto-memory
/mcpManage MCP server connections interactively
/agentsConfigure subagent settings
/permissionsSet allow, ask, and deny rules for tools
/hooksView hook configurations

Development Workflow

CommandPurpose
/planEnter plan mode before a large change
/modelSwitch the active model
/effortAdjust reasoning effort level
/diffOpen the interactive diff viewer
/code-review [--fix]Review the current diff; --fix applies findings
/security-reviewDeep security pass on pending changes
/batch <instruction>Decompose a large change and run it in parallel worktrees
/backgroundDetach the session to run as a background agent

Utilities

CommandPurpose
/helpShow available commands
/doctorDiagnose install and settings issues
/usageShow session cost and plan usage
/exportExport the conversation as plain text
/configOpen settings or set a value directly
/skillsList available skills

Custom Slash Commands

Custom slash commands now live as skills. Existing .claude/commands/ files still work, but .claude/skills/ is the preferred format.

How to Create a Custom Command

Create a directory under .claude/skills/ (project-level) or ~/.claude/skills/ (personal):

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

## Instructions

Review the pull request with these priorities:
1. Identify security vulnerabilities.
2. Check test coverage for new code paths.
3. Flag missing error handling at system boundaries.

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

~/.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.

Using Novita AI as the LLM Backend

Claude Code routes API traffic through ANTHROPIC_BASE_URL. Setting it to Novita AI’s Anthropic-compatible endpoint gives you access to Novita models without changing the Claude Code workflow.

Get Your Novita AI API Key

Sign up for a Novita AI account to receive free trial credits. Then open 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="moonshotai/kimi-k2-instruct"
export ANTHROPIC_SMALL_FAST_MODEL="moonshotai/kimi-k2-instruct"

On Windows (Command Prompt):

set ANTHROPIC_BASE_URL=https://api.novita.ai/anthropic
set ANTHROPIC_AUTH_TOKEN=<Your Novita API Key>
set ANTHROPIC_MODEL=moonshotai/kimi-k2-instruct
set ANTHROPIC_SMALL_FAST_MODEL=moonshotai/kimi-k2-instruct

ANTHROPIC_SMALL_FAST_MODEL controls the lightweight model Claude Code uses for fast internal tasks like file lookups and quick summaries.

Start Claude Code

cd your-project
claude

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 Anthropic messages format, including tool use, structured outputs, and streaming, so Claude Code works without modification.

Agent Sandbox for Isolated Execution

If you’re building automated pipelines on top of Claude Code, Novita AI’s Agent Sandbox gives you isolated execution for agent runs, which is useful for CI workflows and multi-step coding jobs.

Claude Code as an IDE Tool

Claude Code is often described as “an IDE” because it sits inside your existing workflow instead of replacing it. More precisely, it is an agent layer that works with your terminal, editor, and project context.

VS Code and Cursor

Install the Claude Code extension from the VS Code Marketplace or from the Cursor marketplace. After installing, open the Command Palette, 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. 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 lets you review diffs visually and run multiple sessions side by side. The web interface at claude.ai/code runs sessions in the browser with no local setup.

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 Anthropic’s API. Setting it to https://api.novita.ai/anthropic routes traffic to Novita AI’s Anthropic-compatible endpoint.

What is the difference between CLI flags and slash commands?

CLI flags are set when you launch claude from your shell. Slash commands 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. If you route to Novita AI via ANTHROPIC_BASE_URL, you only need a Novita AI account.

How do custom slash commands differ from CLAUDE.md?

CLAUDE.md loads at the start of every session and stays in context. Skills load only when invoked, so use CLAUDE.md for always-on project facts and skills for repeatable procedures.

Does Claude Code work in CI?

Yes. Use claude -p "query" --output-format json for non-interactive mode. Add --max-budget-usd to cap spend and --max-turns to bound execution time.

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.