I have an Anthropic API key and i’ve configured it in the Cursor settings. This seems to work fine in Cursor UI. However, I want to use Cursor’s cli agent and this doesn’t see to pickup with API keys configured in Cursor.
Is there a way to configure provider API keys for Cursor cli agent?
Unfortunately, Cursor CLI doesn’t support BYOK with your own provider API keys yet. The CLI only uses authentication through your Cursor account.
The team is aware of this feature request. I added your report to increase visibility. I can’t promise when it’ll be added, but the request is being tracked.
Right now, the CLI only works with models through your Cursor subscription.
This is an important feature. This would be more widely used if you could use private models or your own keys. I love this tool, please make it more open.
hope can support this feature ASAP. We want to use cli headless mode to run periodlically tasks, in our organization such task cannot be bind on a personal account.
I think this feature can expand cli user case a lot.
Hey, thanks for following up. Nothing has changed yet: Cursor CLI doesn’t support BYOK with provider keys right now. You can only sign in with a Cursor account using agent login or CURSOR_API_KEY. The team already has a request for this, and I’ve added your vote. I can’t share a timeline.
If you need this for automation like headless runs, CI, or cron, there is a way to avoid tying it to a personal account. Service accounts work for that, and you can pass the key through CURSOR_API_KEY. More here: Service Accounts | Cursor Docs
If there are any updates on BYOK in the CLI, I’ll post here.