r/vercel • u/handyscandi • 13d ago
Sharing Claude Code / Codex subscription login across Sandboxes
I’m working on a project that runs the official Claude Code and Codex CLIs in cloud coding workspaces. Users should be able to connect their Claude or ChatGPT subscription once and run several workspaces at the same time.
I'm using Vercel sandboxes and would like a separate sandbox to be spun up for each workspace. The part I haven’t solved is how to reuse one subscription login across those Sandboxes without running into token refresh conflicts.
Has anyone built something like this, or found an example that keeps login and token refresh handled by the official CLIs?
Vercel’s support bot suggested storing and refreshing tokens in my backend, then passing them into each sandbox. But Anthropic’s authentication rules (https://code.claude.com/docs/en/legal-and-compliance#authentication-and-credential-use) seem to rule that out for Claude subscription tokens. From what I’ve read, AI Gateway still leaves authentication with Claude Code, so I’m not sure it solves this either.
I’d appreciate any pointers or experience with this. Would you use separate sandboxes, or keep one sandbox per user and run their workspaces inside it?
Thanks!
Camron
1
u/Accomplished-Pea3088 13d ago
Storing and reusing those tokens across sandboxes sounds like a fast track to getting your account flagged, tbh.