User GuideAPI ReferenceAI Applications

Claude Code

Claude Code is an official intelligent coding assistant (CLI Agent) from Anthropic that runs directly in your terminal. It deeply understands large codebase structures, collaborates on edits across multiple files, and autonomously runs tests and terminal commands, providing developers with an immersive local AI coding workflow.

✨ AI One-Click Setup

Copy the prompt below and send it to your AI assistant to automatically detect your environment, install, and configure:

AI 配置提示词 (Prompt)
点击卡片任意位置复制
Please refer to the official OpenRely documentation (https://openrely.ai/en/docs/apps/claude-code) to help me configure Claude Code on this machine:
1. Obtain Key:If I haven't provided an API key yet, please remind me to go to the OpenRely Console (https://api.openrely.ai/keys) to create and enter one
2. Install Environment:Check if Claude Code is installed locally. If not, run npm install -g @anthropic-ai/claude-code
3. Configure Endpoint:Detect the current terminal environment (Zsh / Bash / PowerShell), set the service endpoint ANTHROPIC_BASE_URL to https://api.openrely.ai/v1, and persist ANTHROPIC_API_KEY into the configuration file (such as ~/.zshrc, ~/.bashrc, or system environment variables)
4. Verify Readiness:Run claude --version to check installation status, and prompt me to enter claude directly to start a coding session

🔑 Prerequisites


🚀 Steps

Install CLI Globally

Claude Code is an intelligent coding assistant that runs directly in your terminal. Install the official CLI package globally via npm, after which you can invoke the claude command in any terminal:

npm install -g @anthropic-ai/claude-code

Configure Environment Variables

Claude Code connects to the official interface by default. To connect to OpenRely, you need to replace the request URL with the OpenRely endpoint and configure your API key:

Temporarily export environment variables in the current terminal session:

export ANTHROPIC_BASE_URL="https://api.openrely.ai/v1"
export ANTHROPIC_API_KEY="sk-your-openrely-api-key"

Set environment variables for the current session in a PowerShell window:

$env:ANTHROPIC_BASE_URL = "https://api.openrely.ai/v1"
$env:ANTHROPIC_API_KEY = "sk-your-openrely-api-key"

[!TIP] To make them persistent in Windows, you can run:
[Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://api.openrely.ai/v1", "User")
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "sk-your-openrely-api-key", "User")

Append the environment variables to your Shell configuration file so they automatically apply to all future terminal sessions:

# macOS (zsh)
echo 'export ANTHROPIC_BASE_URL="https://api.openrely.ai/v1"' >> ~/.zshrc
echo 'export ANTHROPIC_API_KEY="sk-your-openrely-api-key"' >> ~/.zshrc
source ~/.zshrc

# Linux (bash)
echo 'export ANTHROPIC_BASE_URL="https://api.openrely.ai/v1"' >> ~/.bashrc
echo 'export ANTHROPIC_API_KEY="sk-your-openrely-api-key"' >> ~/.bashrc
source ~/.bashrc

Start and Verify

Navigate to your code project's root directory and run claude to start an interactive session:

claude

After launching successfully for the first time, send a test prompt to verify API communication:

> Analyze the overall architecture of this project

If a streamed response is returned properly, OpenRely has been successfully integrated.


💡 Common Commands

Common built-in shortcut commands in Claude Code interactive sessions:

CommandDescription
/helpView all built-in commands and configuration options
/costView real-time Token consumption statistics for the current task and session
/compactCompact current long context history to free memory and save quota
/clearClear current conversation context and start a new task

❓ FAQ

Encountering other API errors or billing questions? Please refer to the complete FAQ and Troubleshooting Guide.

Was this page helpful?

Claude Code | OpenRely Docs