59API

← Retour aux guides

Best Terminal & iTerm2 Setup for Claude Code

Claude Code · EN · 2026-09-07

Start with a dedicated iTerm2 profile

A reliable Claude Code workflow begins with a terminal profile that is visually and operationally separate from everyday shell work. In iTerm2, open Settings, Profiles, and create a profile named Claude Code. Use a dark background, a readable monospace font such as JetBrains Mono or SF Mono, and a distinct accent color. A different tab color makes it harder to paste a destructive command into the wrong project.

Enable unlimited scrollback or choose a large buffer, then turn on the status bar. Useful components include the current directory, Git branch, battery level, and session name. Avoid excessively small fonts: Claude Code output often includes diffs, tool calls, and long file paths, so readability is more valuable than fitting extra lines on screen.

Configure a clean shell environment

Use a modern shell with predictable startup files. For Zsh, keep interactive aliases in ~/.zshrc, while machine-specific secrets belong in a password manager, a protected environment file, or a tool such as direnv. Do not place API tokens directly in a committed project file.

Create a short project launcher so every session starts in the intended repository:

cproj() { cd ~/Code/$1 && claude; }

For projects with different credentials or settings, add a .envrc file and allow it only after reviewing its contents. Restrict local secret files with chmod 600 ~/.config/claude.env, and add them to global Git ignores.

Route Claude Code through 59API

59API provides pay-as-you-go access to Claude Opus, Sonnet, Haiku, and Fable, as well as GPT models, through an API relay compatible with Claude Code. Its base URL is https://api.59api.com. This can be a practical way to control spending without switching tools or accepting downgraded model quality.

In your shell configuration, use the variables supported by your Claude Code installation. A common setup is:

export ANTHROPIC_BASE_URL="https://api.59api.com"
export ANTHROPIC_AUTH_TOKEN="your-59api-key"

Reload the shell with source ~/.zshrc, then run Claude Code from a test repository. If your account or client expects an API-key header instead, use the authentication variable documented by your 59API dashboard. Never print the token in diagnostic output, commit it, or paste it into a public issue.

Choose models deliberately

Do not use the largest model for every task. Use Sonnet for general implementation, refactoring, and code review; Haiku for quick explanations, small edits, and repetitive transformations; and Opus for difficult architecture, debugging, or cross-file reasoning. Claude Code model selection can vary by version, so confirm the current command or settings syntax with claude --help and the provider’s model list.

Set a lightweight default for routine work and switch upward only when the problem justifies it. This simple habit usually reduces cost more effectively than restricting every prompt. Also keep requests bounded: ask Claude to inspect specific directories, summarize before editing, and avoid repeatedly loading generated files, build artifacts, or vendor folders.

Improve safety and observability

Run Claude Code inside a Git worktree or a clean feature branch. Before granting permission for shell commands, check the working directory and inspect the proposed command, especially anything involving rm, package scripts, migrations, credentials, or network access. A useful shell prompt includes the active Git branch and whether the tree is dirty.

For long sessions, use tmux inside iTerm2. Start with tmux new -s claude, detach with Ctrl-b d, and reattach with tmux attach -t claude. This preserves context when Wi-Fi drops or the terminal window closes. Keep one pane for Claude Code, one for tests, and one for Git status.

Keep costs predictable

Track token usage and review your 59API account dashboard regularly. Add project instructions that tell Claude to prefer targeted searches, avoid rereading unchanged files, and run focused tests before full suites. If you want a low-cost, official-quality model relay with flexible pay-as-you-go billing and a referral rebate, you can sign up for 59API and connect the key to the environment above.

Prêt à commencer ?

Connectez Claude et GPT en quelques minutes aux prix les plus bas, sans bridage. Inscrivez-vous pour votre clé API.

Inscription gratuite