返回首页
最新
我非常喜欢HN的noprocrast功能,因此我想为YouTube和Reddit开发类似的功能,于是我快速使用Claude Code构建了这个Firefox扩展。<p>GitHub: <a href="https://github.com/pganguli/NoProcrast" rel="nofollow">https://github.com/pganguli/NoProcrast</a>
我创建了一个名为 [`sandbox-policy-builder`](<a href="https://github.com/giselles-ai/sandbox-policy-builder" rel="nofollow">https://github.com/giselles-ai/sandbox-policy-builder</a>) 的小型库,用于 `@vercel/sandbox`。
问题很简单:在 Vercel Sandbox 中构建编码代理或 AI 应用时,我通常会考虑像 `OpenAI`、`Claude`、`GitHub` 或 `AI Gateway` 这样的服务。但原始的 `networkPolicy` API 是面向域的,因此凭证代理规则变得重复且比实际意图更难以理解。
我想写的是:
```ts
networkPolicy: allow({
codex: { apiKey: process.env.OPENAI_API_KEY! },
openai: { apiKey: process.env.OPENAI_API_KEY! },
gemini: { apiKey: process.env.GEMINI_API_KEY! },
claude: { apiKey: process.env.ANTHROPIC_API_KEY! },
github: { apiKey: process.env.GITHUB_TOKEN! },
aiGateway: { apiKey: process.env.AI_GATEWAY_TOKEN! },
})
```
而不是手动维护原始域和头部转换。
这个库将服务名称扩展为 Vercel Sandbox 所需的域级 `NetworkPolicy` 结构。目前它支持 `codex`、`openai`、`gemini`、`claude`、`github` 和 `aiGateway`。
仓库链接:<a href="https://github.com/giselles-ai/sandbox-policy-builder" rel="nofollow">https://github.com/giselles-ai/sandbox-policy-builder</a>