---
title: 在 VS Code 中使用 Claude API（Cline、Continue）
description: "使用 apitoken.sale 密钥，通过 Cline 或 Continue 在 VS Code 中运行 Claude。把 Anthropic Base URL 设为 api.apitoken.sale，即可按 token 折扣付费。"
url: https://apitoken.sale/zh/docs/learn/claude-api-for-vs-code
language: zh-CN
---

# 在 VS Code 中使用 Claude API

Cline、Continue 等免费的 VS Code 智能体接受任何兼容 Anthropic 的端点，因此你可以用折扣余额在 VS Code 里用 Claude 编码。

## Cline

```
# Cline → Settings
API Provider : Anthropic
Base URL     : https://api.apitoken.sale
API Key      : sk-pool-•••
Model        : claude-opus-4-8
```

## Continue

```
// ~/.continue/config.json
{
  "models": [{
    "title": "Claude via apiToken.sale",
    "provider": "anthropic",
    "apiBase": "https://api.apitoken.sale",
    "apiKey": "sk-pool-•••",
    "model": "claude-opus-4-8"
  }]
}
```

## 选哪个扩展与故障排查

Cline 适合作为自主编辑的默认之选；Continue 更轻量，适合内联对话和补全。两者都免费，且都使用你的预付余额。

- 401 Unauthorized：API 密钥或 Base URL 有误。
- 找不到模型：使用当前的模型 ID，例如 claude-sonnet-5 或 claude-opus-4-8。
- 缓慢或 429：降低并发并遵守 Retry-After。

## 常见问题

### 哪些 VS Code 扩展可以用？

任何支持兼容 Anthropic 端点的扩展都可以，包括 Cline 和 Continue，均可搭配 apitoken.sale 密钥使用。

### 需要付费扩展吗？

不需要。Cline 和 Continue 都是免费的；你只为消耗预付余额的 Claude API 用量付费。

---
Get a key: https://apitoken.sale/register
More guides: https://apitoken.sale/zh/docs/learn
