Using OpenRouter.ai
OpenRouter.ai is a SaaS that provides an API mimicking the OpenAI API, but allows users to choose from a large list of models, including open-source models, proprietary models like OpenAI’s GPT models, and Anthropic’s Claude 3 models.
By using OpenRouter, we can use Claude 3 Opus (or any other supported model) in Cursor.
Here’s a step-by-step guide:
- Create an account on OpenRouter.ai.
- Go to Account → Settings, save your payment details, and add credits (set up auto-top up if desired).
- Go to Account → API Keys and create a new API key (you can set a credit limit).
- Open Cursor.
- Hit
Ctrl+Shift+J
to enter Cursor settings. - Scroll to “OpenAI API”.
- Enter the OpenRouter key you generated where it says “Enter your OpenAI API Key”.
- Click on “Configure models” below the API key field.
- Click on “+ Add model” (below the model names).
- Enter “anthropic/claude-3-opus” as the model name.
- Click on the “+” next to the field.
- There’s a small text with an arrow that says “Override OpenAI Base URL (when using key)”. Click on this.
- Enter “https://openrouter.ai/api/v1” into this field (as the API base URL).
- Important: Click on the tiny arrow to the right of the OpenAI API key field above.
- Wait (there’s no indication of wait time).
- A small switch/checkbox “Using key” should appear below the OpenAI API key field. Ensure it’s green/checked.
- (Optional) You can disable all models except the new anthropic/claude-3-opus. Alternatively, you can have multiple models active and choose when using
Ctrl+K
or chat. - Use Cursor as before with the new Claude 3 Opus model.
Other Models
With this setup, you’re not limited to using Claude 3 Opus. You can use any of the models supported by OpenRouter. Check out the list of supported models for more options.
References: https://www.vincentschmalbach.com/adding-models-to-cursor/
Leave a Reply