AI编码
vercel.com ·
@Vercel News
Vercel AI SDK harness 层支持原生订阅认证
Vercel 在 changelog 中宣布 AI SDK harness 层支持通过原生订阅认证 harness。direct 模式优先使用显式 provider 环境凭据,否则使用宿主机上的原生订阅;auto 模式在未配置 AI Gateway 凭据时行为相同;ai-gateway 模式不读取原生订阅。凭据在宿主机边界解析,OAuth token 在宿主机刷新,沙箱支持时向 harness 注入占位凭据。该能力覆盖 Claude Code、Cline、Codex、Cursor、GitHub Copilot、OpenCode 等适配器,无需修改代码或新增设置。
AI推荐理由 Vercel 官方 changelog 明确说明 AI SDK harness 层新增原生订阅认证:direct 模式优先使用显式 provider 环境凭据,否则回退到宿主机上的原生订阅;auto 模式在未设置 AI Gateway 凭据时行为相同;ai-gateway 模式不读取原生订阅。凭据保留在宿主机边界解析,OAuth token 在宿主机刷新,沙箱支持时向 harness 注入占位凭据。支持 Claude Code、Cline、Codex、Cursor、GitHub Copilot、OpenCode 等适配器。信息具体、可验证,对使用多编码 Agent 的开发者有实际价值;但属于增量功能更新,影响范围有限。
72
正文
The [AI SDK harness layer](https://vercel.com/changelog/program-agent-harnesses-with-ai-sdk) now supports authenticating harnesses through their native subscriptions, where the underlying harness supports them. The harness layer runs different coding agents through the same `HarnessAgent` interface, so you can switch agents without changing your application code.
No code changes or new settings are required. The `direct` authentication mode uses explicit provider environment credentials when they are present, and otherwise a native subscription found on the host. The default `auto` mode does the same when no AI Gateway credentials are set. The `ai-gateway` mode never reads native subscriptions.
Native subscription credentials stay on the host. Just like with API keys, credentials are resolved at the host boundary. OAuth access tokens are refreshed there as needed. Where the sandbox supports it, the harness receives placeholder credentials and the real token is injected into outbound requests on the host.
Native subscriptions work across harness adapters wherever the harness itself supports subscription login. These include Claude Code, Cline, Codex, Cursor, fx, GitHub Copilot, Grok Build, OpenCode, and Pi.
Read the [harness documentation](https://ai-sdk.dev/v7/providers/ai-sdk-harnesses) to learn more.
[Read more](https://vercel.com/changelog/ai-sdk-harness-native-subscription-authentication)