@rayu-dev/rayu-cli

中文文档
2.4.4发布于 2026/11/02ES Module零依赖

Rayu-CLI — a multi-provider AI coding CLI

原始使用文档
文档目录20 节
  1. Installation
  2. Via npm (needs Node >= 18)
  3. Package managers
  4. Studio Remote
  5. Update
  6. Automatic updates (opt-in)
  7. Uninstall
  8. Quick start
  9. Interactive session
  10. Headless mode
  11. Providers
  12. Tools
  13. MCP (Model Context Protocol)
  14. Skills
  15. Autonomous mode
  16. Configuration
  17. Architecture overview
  18. Documentation
  19. Issues & feedback
  20. Development

Rayu CLI

Rayu CLI is a terminal-based AI coding agent. Bring your own API key and connect to any provider — Anthropic, OpenAI, NVIDIA, DeepSeek, Kimi/Moonshot, OpenRouter, Google Gemini, AWS Bedrock, local servers, or any OpenAI-compatible endpoint — with free model switching, full MCP support, and a complete built-in tool suite.

Website: https://rayucode.com
Docs: https://rayucode.com/docs
Changelog: https://rayucode.com/changelog


Installation

One command, any machine. The installer downloads the pre-bundled CLI (and a private Node runtime if the machine has none), so it does not depend on your Node/npm version or on write access to a global npm prefix:

# macOS / Linux
curl -fsSL https://rayucode.com/install | bash
# Windows (PowerShell)
irm https://rayucode.com/install.ps1 | iex

Then start:

rayu

Read the script first if you prefer: https://rayucode.com/install.sh. Full details, flags and uninstall instructions: https://rayucode.com/docs/01-installation.

Via npm (needs Node >= 18)

npm install -g @rayu-dev/rayu-cli

Or run instantly without installing:

npx @rayu-dev/rayu-cli

Package managers

bun install -g @rayu-dev/rayu-cli
pnpm add -g @rayu-dev/rayu-cli
yarn global add @rayu-dev/rayu-cli

Studio Remote

Control a running CLI session from Rayu Studio. There are two connection options:

  • QR code: run /web-bridge pair in the CLI, scan the QR code with your phone camera (or open its link), sign in to Studio, and choose Approve machine. This also works when the CLI is signed in. The QR code expires after five minutes.
  • Rayu account: sign in to the same Rayu account in the CLI and Studio, then run /web-bridge to connect directly.

Select the machine on Studio's Remote page to send prompts, approve tool calls, and interrupt turns. QR pairing grants control of that running worker; it does not sign the worker into Rayu or provide credentials for hosted models.

Use /web-bridge status to check the connection and /web-bridge off to cancel pairing or disconnect. If already connected, disconnect before starting QR pairing. Closing the CLI also ends remote control for that session.


Update

rayu update

This works for both install methods: an installer-managed install re-runs the installer, an npm install reinstalls from npm.

Or reinstall the latest directly:

curl -fsSL https://rayucode.com/install | bash    # installer-managed
npm install -g @rayu-dev/rayu-cli                 # npm-managed

Prefer rayu update: it resolves the latest version once, installs that exact version, and then verifies what actually landed on disk. A plain npm install -g @rayu-dev/rayu-cli@latest resolves the mutable latest tag a second time and can silently reinstall the version you already have when npm serves cached registry metadata (packuments are cached for 5 minutes), which looks like a successful update that changed nothing.

When a newer version is published, Rayu shows a one-line notice above the prompt and in the welcome box at launch, with a link to the changelog. Nothing is installed until you run rayu update yourself.

Automatic updates (opt-in)

Auto-updates are off by default. Rayu tells you an update exists but never replaces your install behind your back. To turn them on, set autoUpdates in ~/.rayu/config.json:

{
  "autoUpdates": true
}

To silence update checks and notices entirely:

export DISABLE_AUTOUPDATER=1

Two things to know before enabling automatic updates:

  • Node version. Rayu requires Node.js 18 or newer. npm only warns when a package's engines requirement isn't met, so if a future release raises that floor, an automatic update could replace a working install with one that refuses to start until you upgrade Node. rayu update has the same constraint, but you choose when it happens.
  • Duplicate installs. If Rayu is installed under two different npm prefixes (for example once with sudo, landing in /usr/local, and once without, landing in ~/.npm-global), an update writes to whichever prefix npm is configured for — which may not be the copy your shell actually runs. The result is a "successful" update where rayu --version never changes. rayu update detects this and tells you which copy is shadowing which; the automatic updater does not. Run which -a rayu to check, and remove the copy you don't want.

Uninstall

rayu uninstall

Quick start

On first launch, Rayu will ask you to connect a provider and enter your API key.

rayu                      # start an interactive TUI session
rayu --print "fix the bug in X"   # one-shot prompt, non-interactive
rayu --help               # all CLI flags, subcommands, and options

Interactive session

Inside a session, type / to see all slash commands:

CommandWhat it does
/connectAdd or switch providers (type → key → model)
/modelSearch and switch models across all providers
/subagent_models [AGENT]Set the model for all spawned agents or one named agent (/model_subagent remains an alias)
/helpList all slash commands with descriptions
/configView and edit configuration
/brandmarkCustomize the brand glyph and spinner style
/effortSet the effort level for responses
/fastToggle fast mode for quicker responses
/pluginManage plugins and browse the marketplace
/mcpManage MCP server connections
/skillManage and run installed skills
/contextMonitor context window usage and token count
/costDisplay cumulative token usage and costs
/compactManually compact conversation history
/clearClear conversation and start fresh
/diffReview file changes made this session
/planCreate and execute implementation plans
/swarmOrchestrate multi-agent teams
/memoryView and manage persistent memory
/thinkToggle extended thinking mode
/doctorRun diagnostics and health checks
/exitExit the session

Headless mode

For automation and CI/CD pipelines:

rayu --print --model meta/llama-3.3-70b-instruct "summarize this repo"

Pass credentials via environment variables (no saved config needed):

RAYU_OPENAI_COMPATIBLE=1 \
RAYU_OPENAI_BASE_URL=https://integrate.api.nvidia.com/v1 \
RAYU_OPENAI_API_KEY=nvapi-xxxxx \
rayu --print "list top-level folders"

JSON output for pipelines:

rayu --print --output-format json "list top-level folders" | jq .result

Providers

Rayu speaks four wire formats, so one provider entry can serve models that use different protocols. Which format a request uses is decided per model, not per provider:

ProviderModels it servesWire format(s)Auth
AnthropicClaudeAnthropic MessagesANTHROPIC_API_KEY
AWS BedrockClaude and gpt-oss / qwen / deepseek / mistral / …Anthropic Messages for Claude, OpenAI Chat for the restAWS_BEARER_TOKEN_BEDROCK (Bedrock API key)
Microsoft AzureClaude and GPT deploymentsAnthropic Messages for Claude, OpenAI Responses for the restANTHROPIC_FOUNDRY_API_KEY / AZURE_OPENAI_API_KEY
Google Vertex AIGemini, Claude, and Llama / Mistral / Qwen (MaaS)GenAI, Anthropic Messages, OpenAI ChatGoogle OAuth / ADC
OpenAI-compatibleNVIDIA, DeepSeek, Kimi, OpenRouter, GLM, Ollama, LM Studio, …OpenAI ChatRAYU_OPENAI_API_KEY or per-provider key
Anthropic-compatibleLongCat, Ollama CloudAnthropic MessagesBearer key
GitHub CopilotCopilot modelsOpenAI ChatGitHub OAuth device flow
KiroClaude via AWS CodeWhispererCodeWhisperer event-streamAPI key or kiro-cli login
Rayu (hosted)Curated hosted modelsAnthropic MessagesYour Rayu account (JWT)
CustomAnything you declareyou pick: OpenAI Chat, OpenAI Responses, or Anthropic Messagesyour key

Custom providers need no code change. Run /connect → Custom provider, give it a name, pick the API format its endpoint speaks, enter the base URL, the model ids and your key. Declare whether it supports reasoning and images so Rayu never sends a parameter your endpoint would reject.

Google Gemini is available three ways:

  1. Gemini API key (GEMINI_API_KEY) via the OpenAI-compatible endpoint
  2. Vertex AI with OAuth/ADC — project + region scoped
  3. Login with Gemini — interactive Google sign-in, free, no GCP project

The Vertex/OAuth credentials also power Imagen 4 image generation and Veo 3.1 video generation.

Example — headless run with NVIDIA:

RAYU_OPENAI_COMPATIBLE=1 \
RAYU_OPENAI_BASE_URL=https://integrate.api.nvidia.com/v1 \
RAYU_OPENAI_API_KEY=nvapi-xxxxx \
rayu --print --model meta/llama-3.3-70b-instruct "summarize this repo"

Tools

Rayu ships with a comprehensive built-in tool suite:

CategoryTools
File opsRead, Write, Edit, Glob, Grep, NotebookEdit
ExecutionBash, PowerShell, Agent (sub-agents)
WebWebFetch, WebSearch
MediaGenerateImage, GenerateVideo
MCPMCPTool, ListMcpResources, ReadMcpResource
TasksTaskCreate, TaskGet, TaskUpdate, TaskList, TaskStop, TaskOutput
PlanningEnterPlanMode, ExitPlanMode, EnterWorktree, ExitWorktree, Brief
CodeLSP (language server queries), Config, ToolSearch
SkillsSkillTool, InstallSkillTool
CommunicationAskUserQuestion, SendMessage (teammates)
TodoTodoWrite

MCP (Model Context Protocol)

Rayu supports the Model Context Protocol for connecting to external tools and data sources:

# Configure MCP servers interactively
/mcp

# Or add an MCP server in settings

MCP servers are configured in ~/.rayu/settings.json and can expose tools, resources, and prompts to the AI agent during sessions.


Skills

Rayu has a skill system for packaged, reusable procedures:

/install-skill <source>   # Install a skill from GitHub/URL/path
/skill <name> <args>      # Run an installed skill

Skills can be shared as GitHub repos and installed from URLs.


Autonomous mode

Rayu supports running autonomously with automatic approval of operations:

rayu --print --permission-mode bypassPermissions "Refactor the project"

Permission modes: default, bypassPermissions, acceptEdits, bypassReadonly, bypassReadonlyAndApis, and planMode.


Configuration

Config is stored in ~/.rayu by default. Key files:

FilePurpose
~/.rayu/settings.jsonAll user settings, themes, MCP configs
~/.rayu/rayu-auth.jsonRAYU-hosted auth tokens
~/.rayu/diagnostics.jsonlRuntime diagnostics log
~/.rayu/sessions/Session transcripts and state
~/.rayu/skills/Installed skills

All settings are preserved across updates and uninstalls.


Architecture overview

User input → Ink TUI (React renderer)
  → Slash command dispatch (/connect, /model, etc.)
  → Query engine (message history, context, tool dispatch)
  → Provider adapter (Anthropic/Bedrock/OpenAI/Vertex/Rayu-hosted)
  → Streaming response → Tool execution → Response rendered in TUI

The terminal UI uses a custom React renderer (src/ink/) built on react-reconciler with efficient frame diffing — cells are packed as Int32 pairs in an ArrayBuffer for zero-GC rendering of 200×120 terminals.


Documentation

#DocumentContents
1InstallationRequirements, install, the rayu binary
2QuickstartFirst run, first conversation
3ProvidersConnecting providers, /connect, API keys
4ModelsModel picker, context windows
5ConfigurationConfig files, environment variables
6CLI ReferenceCommands, flags, interactive vs print mode
7Slash CommandsIn-session commands
8MCPModel Context Protocol server management
9Diagnostics & PrivacyLogging, telemetry, network posture
10TroubleshootingCommon errors and fixes
11Codebase Knowledge GraphLocal indexing, querying, and tracing using /graphify
12Image & Video GenerationBuilt-in media generation tools
13Building binariesCross-platform standalone executables

Issues & feedback

https://github.com/Choeng-Rayu/rayu-cli/issues


Development

git clone https://github.com/Choeng-Rayu/rayu-cli.git
cd rayu-cli/rayu
bun install
bun run dev             # run from source
bun run build           # bundle CLI to dist/rayu.js (alias for build:cli)
bun run build:cli       # build standalone CLI bundle (dist/rayu.js)
bun run build:vscode    # build Rayucode VS Code extension (.vsix)
bun test                # run tests
bun run typecheck       # TypeScript type checking

Built with Bun, TypeScript, React/Ink, and a custom terminal renderer.

版本与发布记录

@rayu-dev/rayu-cli 共发布 112 个版本,首次发布于 2026/06/03;过去 12 个月发布了 112 个版本。

版本发布日期距今
2.4.4latest2026/11/021 天前
2.4.32026/11/021 天前
2.4.22026/10/313 天前
2.4.12026/10/304 天前
2.3.02026/10/295 天前
2.2.192026/10/2113 天前

关于 @rayu-dev/rayu-cli 的常见问题

@rayu-dev/rayu-cli 是什么?

Rayu-CLI -一个多提供商AI编码CLI

如何安装 @rayu-dev/rayu-cli?

在项目目录运行 npm install @rayu-dev/rayu-cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 rayu,可以用 npx rayu 直接运行。

@rayu-dev/rayu-cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/rayu-dev__rayu-cli 是否存在。

@rayu-dev/rayu-cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@rayu-dev/rayu-cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@rayu-dev/rayu-cli 可以商用吗?

@rayu-dev/rayu-cli 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@rayu-dev/rayu-cli 还在维护吗?

最新版本 2.4.4 发布于 2026/11/02(1 天前);至今共发布 112 个版本,其中过去 12 个月发布了 112 个;首次发布于 2026/06/03。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。