跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.llmeasy.ru/llms.txt

Use this file to discover all available pages before exploring further.

接入地址

LLMEasy 现在按协议区分两个地址:
场景Base URL协议
Claude Code / ANTHROPIC_BASE_URLhttps://www.llmeasy.ruAnthropic
Codex / OPENAI_BASE_URL / 其他外部工具https://www.llmeasy.ru/v1OpenAI 类协议 / OpenAI Responses
不要继续使用“一个地址适配所有协议”的旧写法。

认证与示例

在请求中传入你的 LLMEasy API Key:
import anthropic

client = anthropic.Anthropic(
    base_url="https://www.llmeasy.ru",
    api_key="YOUR_API_KEY",
)

message = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "你好"}],
)
curl https://www.llmeasy.ru/messages       -H "x-api-key: YOUR_API_KEY"       -H "anthropic-version: 2023-06-01"       -H "content-type: application/json"       -d '{ ... }'

模型选择规则

  • Claude Code + Claude_* 分组:不要手动设置模型变量,只配置 ANTHROPIC_BASE_URLANTHROPIC_AUTH_TOKEN
  • Claude Code + Codex_* 分组:通过 ANTHROPIC_DEFAULT_HAIKU_MODELANTHROPIC_DEFAULT_SONNET_MODELANTHROPIC_DEFAULT_OPUS_MODEL 配置模型映射
  • Codex:在配置里填入从模型广场 (https://www.llmeasy.ru/pricing)复制的 Codex 分组模型 ID
  • 其他外部工具:同样统一使用 Codex 分组模型 ID,不再沿用 Claude 系列固定模型名
对于外部工具,通常只需要按该工具官方文档填写 Base URL、API Key 和模型。只有当工具本身或你接入的上游网关明确要求额外 headers 时,再单独配置。

环境变量速查

变量用途
ANTHROPIC_BASE_URLhttps://www.llmeasy.ruClaude Code
ANTHROPIC_AUTH_TOKEN你的 API KeyClaude Code 认证
OPENAI_BASE_URLhttps://www.llmeasy.ru/v1Codex 与其他 OpenAI 类协议工具
OPENAI_API_KEY你的 API KeyOpenAI 类协议工具认证
API_TIMEOUT_MS3000000建议设置,防止长任务超时
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC1Claude Code 专用,减少后台请求