Claude Code
Nội dung tài liệu kỹ thuật hiện được cung cấp bằng tiếng Anh.
Use Uptech API with the Claude Code terminal CLI through Anthropic Messages. The base URL is https://api.uptech.vn; the client calls /v1/messages.
Copy from a model detail
- Create a key in Workspace → API Keys.
- Open a model in the Model Catalog.
- Choose Quick start → Claude Code, then choose Temporary command or Configuration file.
- Select macOS / Linux or PowerShell, set
APIGO_API_KEY, and follow the copied instructions.
Temporary command configures only the current terminal. Configuration file provides the user settings to keep and a separate command that reads your API key from the terminal. Quick start fills in the model ID and checks its published protocols. If Messages is absent, it explains why no CLI configuration is available. Protocol availability alone does not certify streaming, tool calling, or every coding feature.
Non-Claude models require gateway compatibility. Anthropic does not officially support using non-Claude models through Claude Code. Test the exact model and workflow before relying on it. See Anthropic's gateway guidance.
Install and configure manually
Install or update the CLI using the official installation guide. Confirm installation with claude --version.
Replace YOUR_MODEL_ID with the exact ID from Uptech API, including any prefix. Replace YOUR_APIGO_API_KEY with your key. Neither value is a runnable default.
Temporary command
Use this when you only need the setup in the current terminal session.
macOS / Linux
export APIGO_API_KEY='YOUR_APIGO_API_KEY'
export ANTHROPIC_BASE_URL='https://api.uptech.vn'
export ANTHROPIC_AUTH_TOKEN="$APIGO_API_KEY"
export ANTHROPIC_MODEL='YOUR_MODEL_ID'
export ANTHROPIC_DEFAULT_SONNET_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_OPUS_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$ANTHROPIC_MODEL"
claude --model "$ANTHROPIC_MODEL"
Windows PowerShell
$env:APIGO_API_KEY = 'YOUR_APIGO_API_KEY'
$env:ANTHROPIC_BASE_URL = 'https://api.uptech.vn'
$env:ANTHROPIC_AUTH_TOKEN = $env:APIGO_API_KEY
$env:ANTHROPIC_MODEL = 'YOUR_MODEL_ID'
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = $env:ANTHROPIC_MODEL
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = $env:ANTHROPIC_MODEL
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = $env:ANTHROPIC_MODEL
claude --model $env:ANTHROPIC_MODEL
ANTHROPIC_AUTH_TOKEN uses Bearer authentication. If you already have a working Uptech API setup with ANTHROPIC_API_KEY (the x-api-key header), keep that credential method and update the model. Avoid leaving conflicting credentials configured. Do not append /v1/messages to the base URL. Credential and URL reference.
Configuration file
Merge this into your user ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json). It deliberately has no API key; set APIGO_API_KEY in the terminal before starting Claude Code.
{
"model": "YOUR_MODEL_ID",
"env": {
"ANTHROPIC_BASE_URL": "https://api.uptech.vn",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "YOUR_MODEL_ID",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "YOUR_MODEL_ID"
}
}
Replace matching fields while preserving your other settings. Keep real keys out of shared project files. The settings-file env values take precedence over matching shell variables; remove stale values if changing the terminal environment seems ineffective.
Start each terminal session with the key, then pass it to Claude Code:
export APIGO_API_KEY='YOUR_APIGO_API_KEY'
export ANTHROPIC_AUTH_TOKEN="$APIGO_API_KEY"
claude --model 'YOUR_MODEL_ID'
$env:APIGO_API_KEY = 'YOUR_APIGO_API_KEY'
$env:ANTHROPIC_AUTH_TOKEN = $env:APIGO_API_KEY
claude --model 'YOUR_MODEL_ID'
For desktop-app routing, use the separate Claude Desktop guide.
Switch models and aliases
Start a new session with a different ID:
claude --model 'ANOTHER_MODEL_ID'
Or switch inside a session:
/model ANOTHER_MODEL_ID
The picker does not necessarily list every Uptech API model. A selectable name does not add a missing protocol. The configuration-file example maps sonnet, opus, and haiku to the current model so those aliases do not select a different default. For a temporary session, set them explicitly:
export ANTHROPIC_MODEL='YOUR_MODEL_ID'
export ANTHROPIC_DEFAULT_SONNET_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_OPUS_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$ANTHROPIC_MODEL"
$env:ANTHROPIC_MODEL = 'YOUR_MODEL_ID'
$env:ANTHROPIC_DEFAULT_SONNET_MODEL = $env:ANTHROPIC_MODEL
$env:ANTHROPIC_DEFAULT_OPUS_MODEL = $env:ANTHROPIC_MODEL
$env:ANTHROPIC_DEFAULT_HAIKU_MODEL = $env:ANTHROPIC_MODEL
You can assign different supported IDs to these roles. Explicit subagent model settings or organization policies may still affect selection; check those if a request uses an unexpected model. Do not assume that one main-model setting controls every background task. See model configuration.
Verify and troubleshoot
Run /status to confirm the Uptech API base URL and credential source. Ask the CLI to summarize the current directory without modifying files. Then check Nhật ký gọi API for the requested model, final outcome, and usage. In a disposable project, also check tool execution and a complete streamed answer.
| Symptom | Check |
|---|---|
| 401 | Key status and credential source in the terminal or user settings. Never paste a real key into a support message. |
| 404 | Base URL, exact model ID, and the model's Messages protocol. |
| Wrong model | --model, ANTHROPIC_MODEL, aliases, saved settings, subagent settings, and managed policy. |
| Plain text works, coding fails | Tool calls, tool results, streaming, and model-specific parameters. A normal chat response is not a complete coding test. |
| No Uptech API log | Check /status, restart from the configured terminal, and confirm the correct Workspace and time range. |
Related: Codex CLI · Claude Desktop · Usage and logs.