🚀 龙虾新手指南

Claude中文版国内稳定使用指南:本地代理+可信中转解决加载失败与中文截断问题

发布时间:2026-08-06 分类: 龙虾新手指南
摘要:Claude ??????????2026?????? + ??????? claude.ai ??????????????????????Anthropic ????????? CDN ??????????????? ISP ? TLS ??????????????????? 5%?????? 12%?????????????????????——????“????????”??????“?...

Claude??????????????

Claude ??????????2026?????? + ????

??? claude.ai ????????

??????????????Anthropic ????????? CDN ??????????????? ISP ? TLS ??????????????????? 5%?????? 12%?????????????????????——????“????????”??????“??…”?????????????????

????????????????

?????? claude-cn.net???????? + ???????????

  • ? ?????????????????????????
  • ? ???? 800ms RTT ??
  • ? ??? claude-3.7-sonnet ????????? API?

??????????????????????——?????macOS ? Windows ????? TLS ???????????????

3 ?????? Claude ????

1. ????????????

?????????????24 ?/???Ubuntu 22.04 ???

sudo apt update && sudo apt install -y python3-pip nginx
pip3 install httpx uvicorn fastapi
? ? FastAPI ???????????? 128MB ????????? HTTP/2?Claude ??????event-stream??????

2. ?????????? claude-proxy.py?

from fastapi import FastAPI, Request, Response
import httpx
import os

app = FastAPI()
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY")  # ?? Claude API Key

@app.api_route("/{path:path}", methods=["GET", "POST", "PUT", "DELETE"])
async def proxy(path: str, request: Request):
    url = f"https://api.anthropic.com/{path}"
    headers = dict(request.headers)
    # ??????????????????
    headers["Accept-Language"] = "zh-CN,zh;q=0.9"
    headers["Content-Type"] = "application/json"
    
    async with httpx.AsyncClient() as client:
        resp = await client.request(
            method=request.method,
            url=url,
            headers=headers,
            content=await request.body(),
            timeout=60.0
        )
        return Response(
            content=resp.content,
            status_code=resp.status_code,
            headers=dict(resp.headers)
        )

3. ??????????

# ???? API Key?? Anthropic ??????
export ANTHROPIC_API_KEY="sk-ant-api03-xxxxxxxxxxxxxx"
# ????????? 8000 ???
nohup uvicorn claude-proxy:app --host 0.0.0.0 --port 8000 --workers 2 > proxy.log 2>&1 &

4. ?????????? VS Code + Copilot ???

? .env ????

ANTHROPIC_BASE_URL=http://your-server-ip:8000/v1
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxxxx

???????????

import anthropic
client = anthropic.Anthropic(base_url="http://your-server-ip:8000/v1")
message = client.messages.create(
    model="claude-3-7-sonnet-20260701",
    max_tokens=1024,
    messages=[{"role": "user", "content": "? Python ????? JSON ?????"}]
)
print(message.content[0].text)  # ? ??????????

????????

  1. curl -X POST http://your-server-ip:8000/v1/messages -H "x-api-key: sk-..." -d '{"model":"claude-3-haiku-20240307","messages":[{"role":"user","content":"hi"}]}' ? ?? {"id":"msg_..."} ??
  2. ? Claude Web UI ?? F12 ? Network ? ??????? URL ????????? IP
  3. ?????????????“????????????”?? ????????????

? Binance · OKX · Gate.io · HTX · Bitget

????

  • Q????? Anthropic ???
    A???????????Key ??????Anthropic ?????????? IP?????? IP????????? SDK ???
  • Q??? App ????
    A???????App ???????????? iOS Shortcuts ??? Termux ?? API??????
  • Q???????
    A???????????????????????????????????????

?????

? ????????

????? 37 ?????????????????? 1.2s??????? 0s????????? yitb/claudelocal???? Issue?
返回首页