User: Browser tab content: # d-cu/raycast-ai-litellm-proxy: 在 Raycast AI 中无需订阅即可使用任意 LiteLLM 模型。 --- d-cu/raycast-ai-litellm-proxy: Use any LiteLLM model in Raycast AI without a subscription.

<body><p><strong><a href="/d-cu/raycast-ai-litellm-proxy">raycast-ai-litellm-proxy</a></strong> <span>Public</span></p> <p> Use any LiteLLM model in Raycast AI without a subscription.
</p><turbo-frame><div><a href="https://github.dev/">Open in github.dev</a> <a href="https://github.dev/">Open in a new github.dev tab</a> <a href="/codespaces/new/d-cu/raycast-ai-litellm-proxy?resume=1">Open in codespace</a> <react-partial><p><a type="button" href="/d-cu/raycast-ai-litellm-proxy/branches"><span><span><span><strong>1</strong> Branch</span></span></span></a> <a type="button" href="/d-cu/raycast-ai-litellm-proxy/tags"><span><span><span><strong>0</strong> Tags</span></span></span></a></p> <div><table><thead><tr><th colspan="2"><span>Name</span></th> <th colspan="1"><span>Name</span></th> <th><p><span>Last commit message</span></p></th> <th colspan="1"><p><span>Last commit date</span></p></th></tr></thead> <tbody><tr><td colspan="3"><p><span><a aria-label="Commit 6e1a204" href="/d-cu/raycast-ai-litellm-proxy/commit/6e1a204dea905ba2fc942c94a4e49ba1c9610b63">6e1a204</a> · </span></p> <p><a href="/d-cu/raycast-ai-litellm-proxy/commits/main/"><span><span><span>10 Commits</span></span></span></a></p></td></tr> <tr><td colspan="2"><p><a title="src" aria-label="src, (Directory)" href="/d-cu/raycast-ai-litellm-proxy/tree/main/src">src</a></p></td> <td colspan="1"><p><a title="src" aria-label="src, (Directory)" href="/d-cu/raycast-ai-litellm-proxy/tree/main/src">src</a></p></td> <td><p><a title="Major performance and reliability improvements

- Fix memory leak in ping interval cleanup
- Add race condition protection for model cache
- Implement O(1) model lookups with Map-based store
- Extract constants and split models.ts into focused modules
- Add custom error types with proper HTTP status codes
- Enhance error recovery with multiple fallback models
- Improve README for faster zero-to-one setup

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>>" href="/d-cu/raycast-ai-litellm-proxy/commit/ccf2c8f9c0654e1aa748aeadef5fb4d5c5c09c2e">Major performance and reliability improvements</a></p></td> <td></td></tr><tr><td colspan="2"><p><a title=".dockerignore" aria-label=".dockerignore, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.dockerignore">.dockerignore</a></p></td><td colspan="1"><p><a title=".dockerignore" aria-label=".dockerignore, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.dockerignore">.dockerignore</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr><tr><td colspan="2"><p><a title=".env.example" aria-label=".env.example, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.env.example">.env.example</a></p></td><td colspan="1"><p><a title=".env.example" aria-label=".env.example, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.env.example">.env.example</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr><tr><td colspan="2"><p><a title=".gitignore" aria-label=".gitignore, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.gitignore">.gitignore</a></p></td><td colspan="1"><p><a title=".gitignore" aria-label=".gitignore, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.gitignore">.gitignore</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr><tr><td colspan="2"><p><a title=".nvmrc" aria-label=".nvmrc, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.nvmrc">.nvmrc</a></p></td><td colspan="1"><p><a title=".nvmrc" aria-label=".nvmrc, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.nvmrc">.nvmrc</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr><tr><td colspan="2"><p><a title=".prettierignore" aria-label=".prettierignore, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.prettierignore">.prettierignore</a></p></td><td colspan="1"><p><a title=".prettierignore" aria-label=".prettierignore, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.prettierignore">.prettierignore</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr><tr><td colspan="2"><p><a title=".prettierrc" aria-label=".prettierrc, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.prettierrc">.prettierrc</a></p></td><td colspan="1"><p><a title=".prettierrc" aria-label=".prettierrc, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/.prettierrc">.prettierrc</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="Dockerfile" aria-label="Dockerfile, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/Dockerfile">Dockerfile</a></p></td> <td colspan="1"><p><a title="Dockerfile" aria-label="Dockerfile, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/Dockerfile">Dockerfile</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="README.md" aria-label="README.md, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/README.md">README.md</a></p></td> <td colspan="1"><p><a title="README.md" aria-label="README.md, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/README.md">README.md</a></p></td> <td><p><a title="Update README.md" href="/d-cu/raycast-ai-litellm-proxy/commit/6e1a204dea905ba2fc942c94a4e49ba1c9610b63">Update README.md</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="docker-compose.yml" aria-label="docker-compose.yml, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/docker-compose.yml">docker-compose.yml</a></p></td> <td colspan="1"><p><a title="docker-compose.yml" aria-label="docker-compose.yml, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/docker-compose.yml">docker-compose.yml</a></p></td> <td><p><a title="Fix config validation and improve user experience

- Fix MODEL_REFRESH_INTERVAL config validation bug
- Add better error messages for LiteLLM connection failures
- Add format, typecheck scripts for better dev experience
- Simplify README: remove emojis, streamline setup instructions
- Remove specific provider/model references for neutrality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>>" href="/d-cu/raycast-ai-litellm-proxy/commit/7ccef952a3b989e73ae6e5f76dca59625a596cd9">Fix config validation and improve user experience</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="eslint.config.mjs" aria-label="eslint.config.mjs, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/eslint.config.mjs">eslint.config.mjs</a></p></td> <td colspan="1"><p><a title="eslint.config.mjs" aria-label="eslint.config.mjs, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/eslint.config.mjs">eslint.config.mjs</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="package-lock.json" aria-label="package-lock.json, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/package-lock.json">package-lock.json</a></p></td> <td colspan="1"><p><a title="package-lock.json" aria-label="package-lock.json, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/package-lock.json">package-lock.json</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="package.json" aria-label="package.json, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/package.json">package.json</a></p></td> <td colspan="1"><p><a title="package.json" aria-label="package.json, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/package.json">package.json</a></p></td> <td><p><a title="Fix config validation and improve user experience

- Fix MODEL_REFRESH_INTERVAL config validation bug
- Add better error messages for LiteLLM connection failures
- Add format, typecheck scripts for better dev experience
- Simplify README: remove emojis, streamline setup instructions
- Remove specific provider/model references for neutrality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <<PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>>" href="/d-cu/raycast-ai-litellm-proxy/commit/7ccef952a3b989e73ae6e5f76dca59625a596cd9">Fix config validation and improve user experience</a></p></td> <td></td></tr> <tr><td colspan="2"><p><a title="tsconfig.json" aria-label="tsconfig.json, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/tsconfig.json">tsconfig.json</a></p></td> <td colspan="1"><p><a title="tsconfig.json" aria-label="tsconfig.json, (File)" href="/d-cu/raycast-ai-litellm-proxy/blob/main/tsconfig.json">tsconfig.json</a></p></td> <td><p><a title="Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection

- Dynamic model discovery using LiteLLM's /model/info endpoint
- Automatic capability detection (tools, vision) from authoritative data
- Zero maintenance - no hardcoded model patterns
- Health monitoring endpoint for troubleshooting
- Configurable refresh intervals and connection settings
- Robust error handling with multiple fallback layers
- Full Raycast/Ollama API compatibility

🤖 Generated with Claude Code" href="/d-cu/raycast-ai-litellm-proxy/commit/0500f26bd605fadec0fe8ae80ee3907544b1bb6a">Initial commit: Raycast AI LiteLLM Proxy with dynamic model detection</a></p></td> <td></td></tr> <tr><td colspan="3"></td></tr></tbody></table></div> <article><p dir="auto">Use any LiteLLM model in Raycast AI without a subscription.</p><h2 dir="auto">Quick Start</h2> <p dir="auto"><strong>Prerequisites</strong>: Docker + running LiteLLM server</p> <ol dir="auto"><li><p dir="auto"><strong>Clone and setup</strong>:</p><pre><code>git clone https://github.com/d-cu/raycast-ai-litellm-proxy.git
cd raycast-ai-litellm-proxy
cp .env.example .env</code></pre></li> <li><p dir="auto"><strong>Configure</strong> (edit <code>.env</code>):</p><pre><code>API_KEY=your-litellm-api-key
BASE_URL=http://host.docker.internal:4000/v1</code></pre> <blockquote><p dir="auto"><strong>Common fix</strong>: If <code>host.docker.internal</code> doesn't work, use your IP:</p><pre><code>BASE_URL=http://192.168.1.X:4000/v1  # Replace X with your IP</code></pre></blockquote></li> <li><p dir="auto"><strong>Start proxy</strong>:</p><pre><code>docker compose up -d</code></pre></li> <li><p dir="auto"><strong>Configure Raycast</strong>:</p><p dir="auto">In Raycast Settings → <strong>AI</strong>:</p><p dir="auto"><strong>Local Models section:</strong></p><ul dir="auto"><li>Set <strong>Ollama Host</strong>: <code>localhost:11435</code></li> <li>Click <strong>Sync Models</strong> to discover your LiteLLM models</li></ul> <p dir="auto"><strong>Experiments section:</strong></p><ul dir="auto"><li>Scroll down and enable <strong>AI Extensions for Ollama Models</strong></li></ul></li></ol> <p dir="auto"><strong>Done!</strong> Your LiteLLM models now appear in Raycast AI.</p><h2 dir="auto">Troubleshooting</h2> <markdown-accessiblity-table><table><thead><tr><th>Issue</th> <th>Solution</th></tr></thead> <tbody><tr><td>Only see fallback models</td> <td>Replace <code>host.docker.internal</code> with your IP in <code>.env</code></td></tr> <tr><td>Connection refused</td> <td>Use <code>BASE_URL=http://192.168.1.X:4000/v1</code></td></tr> <tr><td>No models appear</td> <td>Verify <code>API_KEY</code> and restart: <code>docker compose restart</code></td></tr></tbody></table></markdown-accessiblity-table> <h2 dir="auto">Configuration</h2> <p dir="auto">Optional <code>.env</code> settings:</p><pre><code>PORT=3000                        # Proxy port (default: 3000)
MODEL_REFRESH_INTERVAL=300000    # Model refresh interval (default: 5 min)
PING_INTERVAL=10000              # Connection keepalive (default: 10 sec)</code></pre> <hr> <blockquote><p dir="auto"><strong>Built on</strong>: <a href="https://github.com/miikkaylisiurunen">@miikkaylisiurunen</a> 's excellent <a href="https://github.com/miikkaylisiurunen/raycast-ai-openrouter-proxy">raycast-ai-openrouter-proxy</a> — Thank you for the foundation! Enhanced for LiteLLM with performance and reliability improvements.</p></blockquote></article></react-partial><h2>About</h2> <p> Use any LiteLLM model in Raycast AI without a subscription.
</p><p><a href="#readme-ov-file"> Readme</a></p> <p><a href="/d-cu/raycast-ai-litellm-proxy/activity"><span>Activity</span></a></p> <p><a href="/d-cu/raycast-ai-litellm-proxy/stargazers"><strong>1</strong> star</a></p> <p><a href="/d-cu/raycast-ai-litellm-proxy/watchers"><strong>0</strong> watching</a></p> <p><a href="/d-cu/raycast-ai-litellm-proxy/forks"><strong>0</strong> forks</a></p> <p><a href="/contact/report-content?content_url=https%3A%2F%2Fgithub.com%2Fd-cu%2Fraycast-ai-litellm-proxy&amp;report=d-cu+%28user%29"> Report repository</a></p> <h2>Packages</h2> <p> No packages published <br></p> <div><h2>Languages</h2> <ul><li><a href="/d-cu/raycast-ai-litellm-proxy/search?l=typescript"><span>TypeScript</span> <span>97.5%</span></a></li> <li><a href="/d-cu/raycast-ai-litellm-proxy/search?l=javascript"><span>JavaScript</span> <span>1.8%</span></a></li> <li><a href="/d-cu/raycast-ai-litellm-proxy/search?l=dockerfile"><span>Dockerfile</span> <span>0.7%</span></a></li></ul></div></div></turbo-frame></body>

在Mac上怎么完成安装


Assistant: 在Mac上安装并使用这个raycast-ai-litellm-proxy，可以按照以下步骤操作：

---

# Mac上安装 raycast-ai-litellm-proxy 的步骤

### 前置条件
- 安装Docker Desktop（Mac版），确保Docker能正常运行。
- 你已有运行中的 LiteLLM 服务（或在局域网中可访问的LiteLLM服务）。
- 基本命令行操作能力。

---

### 1. 克隆项目到本地

打开终端，执行：

```bash
git clone https://github.com/d-cu/raycast-ai-litellm-proxy.git
cd raycast-ai-litellm-proxy
cp .env.example .env
```

---

### 2. 配置 `.env` 文件

用文本编辑器打开 `.env` 文件，修改以下配置：

```env
API_KEY=你的LiteLLM API密钥（如果有）
BASE_URL=http://host.docker.internal:4000/v1
```

> 说明：
> - `API_KEY` 根据你自己的LiteLLM服务填写。
> - `BASE_URL` 指向你的LiteLLM服务地址，默认是Docker提供的 `host.docker.internal`。  
> - 如果遇到 `host.docker.internal` 在Mac上无法访问LiteLLM服务器，建议换成本机局域网IP，比如：
> 
> ```env
> BASE_URL=http://192.168.x.x:4000/v1
> ```
> 其中 `192.168.x.x` 替换成你Mac的局域网IP地址。

---

### 3. 启动proxy服务（用docker compose）

确保你在项目目录下，运行：

```bash
docker compose up -d
```

这将后台启动proxy。

---

### 4. 配置Raycast

打开Raycast应用，依次进入：

- 设置(Settings) → AI
- 在“Local Models”部分：
  - 设置 `Ollama Host` 为：`localhost:11435`
  - 点击 `Sync Models` 以同步并发现你的LiteLLM模型。
- 在“Experiments”部分：
  - 启用 “AI Extensions for Ollama Models”。

---

### 5. 验证

- 你的LiteLLM模型应该出现在Raycast AI中。
- 如果遇到“只看到fallback模型”、“连接失败”之类问题，回头检查 `.env` 的 `BASE_URL` 及`API_KEY` 配置，确认LiteLLM服务可达。
- 可以用命令重启proxy服务：

```bash
docker compose restart
```

---

### 其它可选配置

你也可以根据需要调整 `.env` 里的以下参数：

```env
PORT=3000                         # 代理服务端口，默认3000
MODEL_REFRESH_INTERVAL=300000     # 模型刷新间隔，默认5分钟
PING_INTERVAL=10000               # 心跳间隔，默认10秒
```

---

# 总结

1. 准备Docker和LiteLLM服务  
2. 克隆仓库，复制并配置`.env`  
3. 运行`docker compose up -d`启动proxy  
4. Raycast设置中配置本地代理  
5. 同步模型，开始使用无订阅的LiteLLM模型  

---

如果还需要，我可以帮你写详细的 `.env` 示例和检查命令。你可以告诉我是否需要。
User: 第二部具体怎么完成,怎么打开.env并编辑
Assistant: