---
title: "User Setup"
url: "/docs/auto_router/user_setup"
canonical_url: "https://docs.litellm.ai/docs/auto_router/user_setup"
type: "docs"
last_updated: "2026-10-08"
summary: "使用 lite configure 將 Claude Code 或 Codex 連接到您團隊的 Auto Router，並在 Claude Code 中查看即時工作階段節省。"
related:
  - "/docs/auto_router/decision_classifiers"
  - "/docs/auto_router/recommended_configurations"
---
# User Setup

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt

將您的程式撰寫代理程式連接到您團隊已部署的 Auto Router。請向管理員索取 LiteLLM 閘道 URL、具有該路由器存取權限的虛擬 API 金鑰，以及該路由器的模型名稱。若要先建立路由器，請參閱 [管理員設定](/docs/auto_router/setup)。

繼續之前，請先安裝 Claude Code 或 Codex。對於 Codex，請使用穩定版 0.129.0 或更新版本。

## 1. 安裝 LiteLLM CLI {#1-install-the-litellm-cli}

```bash
curl -fsSL https://raw.githubusercontent.com/BerriAI/litellm/main/scripts/install-cli.sh | sh
```

其他安裝選項請參閱 [LiteLLM Proxy CLI](/docs/proxy/management_cli#quick-start)。

## 2. 設定您的程式撰寫代理程式 {#2-configure-your-coding-agent}

將閘道 URL 和金鑰替換為管理員提供的值，然後執行：

```bash
export LITELLM_PROXY_API_KEY="sk-your-virtual-key"

lite configure \
  --gateway-url https://your-proxy.example.com \
  --api-key "$LITELLM_PROXY_API_KEY"
```

選擇 **Claude Code**、**Codex** 或兩者，然後在每個代理程式的模型選擇器中選取您團隊的 Auto Router。CLI 會在將連線儲存到代理程式設定之前檢查您的金鑰和可用模型。此設定請使用長效虛擬金鑰；`lite configure` 不使用來自 `lite login` 的暫時性憑證。

您也可以在命令中指定代理程式和路由器。請將 `smart-router` 替換為您路由器的模型名稱。

### Claude Code {#claude-code}

```bash
lite configure \
  --gateway-url https://your-proxy.example.com \
  claude \
  --api-key "$LITELLM_PROXY_API_KEY" \
  --model smart-router

claude
```

### Codex {#codex}

```bash
lite configure \
  --gateway-url https://your-proxy.example.com \
  codex \
  --api-key "$LITELLM_PROXY_API_KEY" \
  --model smart-router

codex
```

設定完成後，請在任何終端機中使用 `claude` 或 `codex` 啟動您的代理程式。您不需要每次都重複 `lite configure` 或匯出金鑰。

## 即時工作階段節省 {#live-session-savings}

在 Claude Code 中，`lite configure` 會新增一條狀態列，顯示處理您上一輪的模型，以及您的工作階段已路由支出相較於估計基準的節省情況。

[Image: Claude Code 狀態列顯示 gpt-5.6-luna、$3.03 的已路由支出，以及 $14.00 的估計基準，節省 78%]

此範例顯示的已路由支出為 $3.03，相較於 $14.00 的估計基準，節省 78%。基準使用的是您路由器中最高配置層級的最昂貴模型。您的節省金額會因工作階段而異；有關 LiteLLM 如何計算此估計，請參閱 [Reported savings](/docs/proxy/auto_routing#reported-savings)。

在閘道記錄使用量時，統計資訊可能會比已完成的輪次稍有延遲。如果您看到已路由模型但沒有顯示節省，請請管理員檢查閘道是否已設定資料庫並啟用支出記錄，以及您的金鑰是否可存取 `/auto_router/session`。受限於 `llm_api_routes` 的金鑰也需要存取此端點。節省金額需要可用的基準估計。

## 取消設定 {#undo-setup}

針對您要中斷連線的代理程式執行該命令：

```bash
lite unconfigure claude
# Or, for Codex:
lite unconfigure codex
```

CLI 會還原其所變更的設定，並保留您之後所做的編輯。

## Related pages

- [自架分類器](https://docs.litellm.ai/docs/auto_router/decision_classifiers.md)
- [推薦設定](https://docs.litellm.ai/docs/auto_router/recommended_configurations.md)
