Claude Code CLI
Connect Claude Code CLI to APIKO
Overview
Claude Code CLI is the official command-line tool from Anthropic for interacting with Claude models in the terminal. By integrating Claude Code CLI with APIKO API, you can directly access Claude model capabilities through APIKO.
Prerequisites
Before configuring, make sure you have:
Get APIKO API Key
- Log in to APIKO Dashboard
- Open API Keys in the dashboard, click "Create Key", then copy the generated Key
- API Key usually starts with
sk-
Step 1: Install Claude Code CLI
1. One-Command Installation
curl -fsSL https://claude.ai/install.sh | bashExpected result: You'll see download and installation info, ending with a success message.
If error occurs: the script installs into your home directory, so do not add sudo. If you see permission denied, check that ~/.local/bin is writable.
Note: macOS/Linux uses one-command installation script, Windows uses npm installation.
2. Verify Installation
claude --versionSuccess indicator: Shows a version number followed by (Claude Code).
Step 2: Configure APIKO API
Claude Code CLI is configured via settings.json.
CC Switch is a desktop GUI tool for managing Claude Code provider configurations through a graphical interface, without manually editing config files.
1. Install CC Switch
Download the installer for your platform from the CC Switch download page.
2. Configure APIKO
- Open CC Switch and select the Claude Code tab
- Click the + button in the top-right corner to add a provider
- Fill in the fields:
| Field | Value |
|---|---|
| Provider Name | APIKO |
| API Key | Your APIKO API Key |
| API Endpoint | https://api.apiko.app (no trailing slash) |
- Click Save, then select the APIKO provider to enable it
CC Switch will automatically write the configuration to settings.json, no manual operation needed.
Step 3: Start Using Claude Code CLI
1. Enter a safe working directory
cd your-working-directoryNote: Replace your-working-directory with actual path
2. Interactive mode
claude3. Verify configuration
claude "Who are you"Success indicators:
- See AI response text (several lines)
- No errors like
401,403,API Key invalid
If you see errors:
401 Unauthorized: API Key not set or invalid → Check settings.json403 Forbidden: usually insufficient balance (insufficient_user_quota) → top up in Console → Billing. A wrong or expired key returns 401, not 403.Network error: Network issue → Check connection
FAQ
1. What is Claude Code CLI and what is it used for?
Claude Code CLI is the official command-line tool from Anthropic that allows users to interact with Claude models in the terminal. It's primarily used for code assistance, text generation, Q&A conversations, and file analysis—especially suited for developers who need quick AI capabilities in a command-line environment.
2. How do I verify installation and configuration on first use?
Run these commands in sequence:
claude --version: Confirm Claude Code CLI is installedclaude "Who are you": Confirm API configuration is correct
3. What's the difference between interactive mode and single command mode?
- Interactive mode: Run
claudeto enter continuous conversation for multi-turn interactions, ideal for complex tasks - Single command mode: Run
claude "question"to get a single response and exit, ideal for quick queries
4. Will Claude Code CLI automatically read or upload my local files and code?
No. Claude Code CLI only reads file content when you explicitly reference or authorize it, and will request confirmation before performing sensitive operations. It's recommended to use it in a dedicated project folder.
5. How do I use Claude Code CLI to analyze or process local file content?
In interactive mode, you can reference files by:
- Typing the file path for Claude to read
- Dragging files into the terminal window
- Copy and pasting file content
6. Does Claude Code CLI support Chinese input and output?
Yes, fully supported. Claude Code CLI supports Chinese input and output—you can ask questions in Chinese and receive Chinese responses.
7. No output after execution—what could be the cause?
Common causes include:
- Network connection issues preventing API server access
- Invalid API Key or insufficient balance
- Incorrect
ANTHROPIC_BASE_URLconfiguration - Firewall or proxy blocking requests
8. Why don't my config file or environment variable changes take effect?
- Restart your terminal or command line window
- Check that
settings.jsonhas valid JSON syntax - Verify the config file path: Windows:
C:\Users\{username}\.claude\settings.json; macOS / Linux:~/.claude/settings.json
9. What causes 401/403 errors?
- 401 error:
ANTHROPIC_AUTH_TOKENnot set, or the API Key is wrong or expired - 403 error: usually insufficient balance (
insufficient_user_quota); top up in Console → Billing - Verify
ANTHROPIC_BASE_URLis set tohttps://api.apiko.app
10. What scenarios is Claude Code CLI suited for? What is it not suited for?
Suited for:
- Code writing, debugging, and refactoring
- Quick Q&A in command-line environments
- File content analysis and processing
- Automation script integration
Not suited for:
- Complex interactions requiring a graphical interface
- Real-time collaborative editing
- Large-scale batch file processing
11. How do I switch models?
Type /model in interactive mode to switch models. Its Sonnet, Opus and Haiku choices use the ANTHROPIC_DEFAULT_*_MODEL values from Step 2; without them Claude Code may request a model id APIKO does not serve and fail with a 503 error.
12. What Claude models does APIKO support?
APIKO supports the following Claude models (updated in real time from the live catalog):
Loading models… The full list of Claude model ids is also on the Claude API page.
13. How do I upload images?
- Option 1: Reference the image path
- Option 2: Drag and drop an image into the terminal
- Option 3: Paste an image directly
All methods require user action—Claude Code CLI will not automatically read or upload local images.
14. How to open command line terminal?
- Method 1: Press
Win + R, typecmdorpowershell, then press Enter - Method 2: Search for "Command Prompt" or "PowerShell" in the Start menu
- Method 3: Hold Shift and right-click in a folder, select "Open PowerShell window here"