59API

← Volver a las guías

Claude Code Terminal & iTerm2 Setup: Avoid 8 Mistakes

Claude Code · EN · 2026-09-04

1. Mistake: Putting Claude Code variables in the wrong shell file

Claude Code needs its API credentials available in the shell session where you run the claude command. On modern macOS, iTerm2 usually opens Zsh, so place interactive-shell variables in ~/.zshrc, not in a random profile file that may never load.

Add your relay configuration with values from your 59API account: export ANTHROPIC_API_KEY="your_59api_key" and export ANTHROPIC_BASE_URL="https://api.59api.com". Then run source ~/.zshrc or open a fresh iTerm2 tab. Keep the base URL exact: a typo, an extra path, or a copied trailing character can cause confusing authentication or connection errors.

After configuration, run Claude Code and use its status command or startup output to confirm that the expected endpoint and account are active before beginning a large task.

2. Mistake: Exposing API keys in repositories or shell history

Never paste a live API key into a project .env file that may be committed, a team chat, a screenshot, or a command that gets saved to shell history. Store it in your local shell configuration with restrictive permissions where practical, and add secret files to .gitignore. If a key is accidentally committed, revoke or rotate it immediately rather than merely deleting the line in a later commit.

A relay key should be treated like production infrastructure access. 59API provides pay-as-you-go access, so monitoring usage and rotating a compromised key quickly helps avoid unexpected spend as well as security risk.

3. Mistake: Using an expensive model for every tiny terminal task

Model choice is a workflow decision, not a badge of honor. Reserve a stronger model such as Claude Opus for difficult architecture, subtle debugging, security reviews, or multi-file refactors. Use Sonnet for most implementation and review work, and select a fast, lower-cost option such as Haiku for focused questions, command explanations, test-output triage, and small edits.

59API is a useful low-cost option because it offers native official-quality Claude models, including Opus, Sonnet, Haiku, and Fable, without forcing a downgraded model experience. It also supports GPT models and OpenAI-compatible SDK workflows, which is helpful when a project needs more than one provider interface. Set the model deliberately in Claude Code according to its current configuration options, and check the active model before starting a long session.

4. Mistake: Treating one giant chat session as project memory

Long Claude Code sessions can become less precise when old exploration, failed attempts, and unrelated logs fill the context. Start a new session after completing a distinct task, then give the new session a short handoff: what changed, which files matter, what remains, and how to verify success. This is faster and cheaper than repeatedly asking the model to rediscover the project state.

Keep a concise project instruction file in the repository if your team uses one. Include the test command, formatting command, package manager, architecture conventions, and rules such as “do not modify generated files.” Clear local instructions reduce repetitive prompts and prevent risky assumptions.

5. Mistake: Leaving iTerm2 at its default readability settings

A terminal optimized for coding should make diffs, stack traces, and long file paths easy to scan. In iTerm2 Profiles, choose a legible monospace font, increase font size enough to avoid zooming, and enable a high-contrast color preset. Set scrollback to at least 10,000 lines, or unlimited if memory use is acceptable, so an important test failure does not disappear during an agent run.

Install iTerm2 Shell Integration from the iTerm2 menu. It improves command history, directory tracking, and prompt features that are especially useful when Claude Code runs tests, Git commands, and build tools in sequence.

6. Mistake: Giving terminal automation more permission than necessary

Claude Code can propose or run commands, but your terminal remains a powerful environment. Work in a dedicated repository directory, review destructive commands before approval, and be especially cautious with recursive deletes, database migrations, package publishing, credential changes, and commands executed with elevated privileges. Use Git branches and make small commits before broad refactors so rollback is simple.

For unfamiliar projects, begin with read-only discovery: inspect files, run tests, and ask for a plan before requesting edits. This creates a safer feedback loop than immediately allowing sweeping changes.

7. Mistake: Ignoring terminal ergonomics

Create separate iTerm2 profiles or tabs for Claude Code, application logs, and test watching. Use split panes to keep the agent in one pane while logs or a dev server remain visible in another. Configure Option-left and Option-right to send escape sequences for word navigation if you use shell editors frequently. A dedicated profile also prevents a project-specific prompt, Node version, or environment variable from leaking into unrelated work.

8. Mistake: Waiting for a billing surprise

Track usage by task type and model. If repetitive work is consuming more than expected, shorten prompts, start fresh sessions, and move simple tasks to a faster model. 59API's pay-as-you-go pricing and referral rebate make it a practical way to keep Claude Code accessible for everyday development without committing to an oversized plan. If you want a compatible relay endpoint for Claude Code, Codex, or OpenAI SDK projects, sign up for 59API and test it with a small development workflow first.

¿Listo para empezar?

Conecta Claude y GPT en minutos a los precios más bajos, sin recortes. Regístrate para obtener tu clave API.

Registro gratis