跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt

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

概述

Claude Code 是一个命令行 AI 助手,可帮助完成编码任务。通过与 Anyfast 集成,您可以直接从终端访问强大的 AI 模型进行代码生成、调试和分析。

前置条件

  • macOS 或 Linux 操作系统(或 Windows 上的 WSL)
  • 具有 bash shell 的终端访问权限
  • 有效的 Anyfast API 密钥
  • 互联网连接

方法一:手动配置(推荐)

环境变量设置

在您的 shell 配置文件(.bashrc.zshrc.profile)中配置所需的环境变量:
# Anyfast API 配置
export ANTHROPIC_BASE_URL="https://www.anyfast.ai/"
export ANTHROPIC_MODEL="claude-opus-4-7"
export ANTHROPIC_API_KEY="sk-your-api-key-here"

应用配置

# bash 用户
source ~/.bashrc

# zsh 用户
source ~/.zshrc

启动 Claude Code

claude

方法二:OpenAI 兼容模式

添加到 shell 配置文件:
export OPENAI_API_KEY="sk-your-api-key-here"
export OPENAI_BASE_URL="https://www.anyfast.ai/v1"

切换模型

要更改模型,更新环境变量:
export ANTHROPIC_MODEL="claude-sonnet-4-6"
source ~/.zshrc

使用技巧

  • 使用具体、详细的提示以获得更好的代码建议。
  • 将复杂任务分解为较小的、可管理的请求。
  • 在实施前审查生成的代码。
  • Anyfast 控制台 中监控您的使用情况。

故障排除

认证错误:
echo $ANTHROPIC_API_KEY
模型未找到:
echo $ANTHROPIC_MODEL
连接问题:
curl -H "Authorization: Bearer $ANTHROPIC_API_KEY" https://www.anyfast.ai/v1/models