> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ruapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude 报错「Request not allowed」（403）和「not allowed from unsupported countries」：什么意思、怎么解决

> Claude API 和 Claude Code 报错「403 Request not allowed」和「Access to Anthropic models is not allowed from unsupported countries, regions, or territories」：为什么 Anthropic 会拒绝请求，什么时候是 VPN 和代理的问题，以及怎么接入 Claude 不再报这些错——换密钥和地址就行。

**先说结论**：这两个错误都是 Anthropic 自己返回的。最常见的原因是请求发出的地方：Anthropic 只在它名单上的国家提供服务。换新密钥、重新订阅在这里都没用。要不再报错，请求就不能从你的地址发到 Anthropic。用 RuAPI 的密钥正是这样：你换掉密钥和地址（在代码里或 Claude Code 的设置里），Claude 模型还是原来那些。不用 VPN。

## 报错长什么样

在 Claude Code 和 API 里，是状态码为 **403** 的响应：

```text theme={null}
API Error: 403 {"error":{"type":"forbidden","message":"Request not allowed"}}
```

通过 Amazon Bedrock（包括接了 Bedrock 的 Claude Code），如果设置里选的是位于不支持国家的 AWS 地域，会返回状态码为 **400** 的响应（[GitHub 上的例子](https://github.com/anthropics/claude-code/issues/2656)）：

```text theme={null}
API Error: 400 Access to Anthropic models is not allowed from unsupported countries, regions, or territories.
Please refer to https://www.anthropic.com/supported-countries for more information.
```

## 为什么会这样

* **请求来自不支持的地区**。名单见 [Supported Regions Policy](https://www.anthropic.com/supported-countries) 页面。上面还写明，人在名单以外的地方使用，也属于不支持的情况。
* **VPN 或代理**。Anthropic 看到的不是你的地址，而是 VPN 或代理的出口地址。如果出口在不支持的地区，或者用着用着变了，也会报同样的错。
* **少数情况是订阅或权限问题**。如果你在支持的国家、没开 VPN，检查一下订阅是否有效，以及密钥或 Anthropic 控制台里的角色有没有访问权限。

## 可以怎么办

| 情况 | 怎么办 |
| - | - |
| 你在支持的国家，VPN 已关，还是报错 | 检查订阅、Anthropic 控制台里的角色和出网地址（`curl ipinfo.io`） |
| 你所在的地区不在 Anthropic 的名单里 | 通过 RuAPI 接入 Claude，步骤见下。不需要 Anthropic 账号和订阅 |
| 报错的是 Claude Code | 在 Claude Code 的设置里填上 RuAPI 的密钥和地址，示例见下 |

## 通过 RuAPI 接入 Claude

**1. 注册**

在 [www.ruapi.ai](https://www.ruapi.ai/?lng=zh-CN\&utm_source=docs\&utm_campaign=zh-claude-request-not-allowed) 注册，邮箱、Google 或 Yandex 都行。

**2. 充值**

控制台 →「**钱包管理**」：USDT 或 USDC（TRC20 / BEP20 / Polygon；USDT 还可以走 TON），5 USDT 起。还没有 USDT 的话，[用 SBP 拿卢布买](https://docs.ruapi.ai/zh/buy-usdt.md)。外国银行的卡（Visa / Mastercard）也收。

**3. 密钥**

控制台 →「**令牌管理**」→「**添加令牌**」，拿到一串 `sk-...`。

**4. 换密钥和地址**

在 Claude Code 或你自己的代码里换，示例见下。

```json Claude Code (~/.claude/settings.json) theme={null}
{
  "model": "claude-sonnet-5-5",
  "env": {
    "ANTHROPIC_BASE_URL": "https://www.ruapi.ai",
    "ANTHROPIC_AUTH_TOKEN": "sk-你的RuAPI密钥",
    "CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY": "1",
    "CLAUDE_CODE_GATEWAY_MODEL_DISCOVERY_TIMEOUT_MS": "10000"
  }
}
```

```python Anthropic SDK theme={null}
import anthropic

client = anthropic.Anthropic(
    api_key="sk-你的RuAPI密钥",
    base_url="https://www.ruapi.ai",  # 不要加 /v1
)

message = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "你好！"}],
)
print(message.content[0].text)
```

```python OpenAI SDK theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="sk-你的RuAPI密钥",
    base_url="https://www.ruapi.ai/v1",
)

resp = client.chat.completions.create(
    model="claude-sonnet-5-5",
    messages=[{"role": "user", "content": "你好！"}],
)
print(resp.choices[0].message.content)
```

Claude Code 的完整教程（安装、选模型、不用 Anthropic 账号登录）见[在俄罗斯用 Claude Code](https://docs.ruapi.ai/zh/claude-code-russia.md)页面。

## 常见问题

> [accordion] 换新的 Claude 账号或重新订阅有用吗？
>
> 如果原因是地区，没用：Anthropic 检查的是请求从哪里来，而不是你用的哪个账号。从同一个地址，新账号也会报同样的错，封号风险也一样。

> [accordion] 通过 RuAPI 用，需要 Anthropic 账号吗？
>
> 不需要。有 RuAPI 密钥就够了：在 Claude Code 里把它填进设置，不用登录 Anthropic 账号。

> [accordion] 需要 VPN 吗？
>
> 不需要。RuAPI 的网站和 API 可以直接访问。

> [accordion] 是原版 Claude 吗？
>
> 是。都是 Anthropic 的原版模型，比如 claude-opus-5-5、claude-sonnet-5-5、claude-haiku-5-5，不掉包，不降质量。

## 接下来

> [card] [在俄罗斯用 Claude Code](https://docs.ruapi.ai/zh/claude-code-russia.md)
>
> 不用 Anthropic 账号，怎么安装和接入。

> [card] [Claude API 密钥](https://docs.ruapi.ai/zh/claude-api-key-russia.md)
>
> 去哪拿密钥、怎么付款。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.