cursor icon indicating copy to clipboard operation
cursor copied to clipboard

Can't use claude 3.5 sonnet with openrouter, seems like a cursor issue

Open Patryz opened this issue 1 year ago • 19 comments

Using cursor on windows 11. Was working till very recently, at leas until last friday.

If I use anthropic/claude-3.5-sonnet i get error Invalid API key.

On verify API key in the model preferences, I pass the tests. I can leave only anthropic/claude-3.5-sonnet, and it works, but if I add an error like anthropic/claude-3.5-sonnetasdadd, verify will fail.

I'm using the same setup in other custom clients and it's working.

Patryz avatar Jun 26 '24 09:06 Patryz

does not work for me at all anymore, can get it to work now and then when i try to use it with pro (once in a while) - i just get an error that it can't reach openai. Its a bit sad because gpt 4 is extremely stupid and useless compared to claude 3.5.

viavirus avatar Jun 27 '24 14:06 viavirus

hey so if anyone else has issues and has to keep reopening for it to work, i took a bit of an investigation into why my claude wasnt working, i paid $5 to try and use the api key instead, and i noticed that it had the same issue of it saying it had issues reaching open ai servers. so it didnt matter whether i used my cursor pro or the api key for my claude. I went and reset my cursor and noticed it worked and then stopped working again. So I thought about what the new tabs were doing and when it failed (it seemed to fail when it was trying to look into the files and index them), I also noticed it failed when i would try send my codebase, with ctrl enter. So i went into my settings and decided to clear out my codebase indexing and resynced the index again. it seems that if you do this you can continue a convo with claude longer without it having errors. it seems after a period of time that the requests break due to some kind of code indexing issue. so if you wipe it every like 10 requests you should be able to keep using the same tab and have it have the context window that claude is known for. i also cleared out my files in my appdata because my issue even before clearing my files is that it didn't ever work. just know doing that will make you lose any settings you did locally do your vscode, shortcuts, themes, etc, but not extensions.

keep in mind for me im not using open router or anything mine is just failing by default with the standard claude 3.5 and all other claude models with cursor if the chat is 5-10+ messages long with sending the code base.

viavirus avatar Jun 28 '24 18:06 viavirus

@truell20 i dont really know who else to tag about this but hopefully it helps. I saw a few days ago you guys were investigating it and its still not fixed so maybe that makes it a bit easier to find out what it is

viavirus avatar Jun 28 '24 18:06 viavirus

For me, it doesn't work in any way: ALT+Enter, Enter, CTRL+Enter. Resetting the indexing didn't work either.

Patryz avatar Jul 01 '24 07:07 Patryz

Still have the issue on latest patch. Different error, it seems to be trying to reach anthropic, even though anthropic is disabled and only openai with custom api for openrouter is enabled. Will not update further as I was forced to switch product.

Patryz avatar Jul 09 '24 08:07 Patryz

Same error, using an OpenRouter api key used to work but is broken now. Cursor v0.37.1 Vscode 1.89.1. Windows 10.

Cursor_kDp80mpEEY Cursor_mqQpWwpAoR

kfwebdev avatar Jul 19 '24 03:07 kfwebdev

Same here, any solutions or hot fixes for now?

generalsvr avatar Jul 22 '24 08:07 generalsvr

unfortunately same issue - seems like Cursor is doing some hard-string matching to route to Anthropic when the name contains Claude

psinger avatar Jul 30 '24 13:07 psinger

Same here, @psinger is right there is some sort of hard coded routing.

byrondelgado avatar Aug 07 '24 11:08 byrondelgado

You're using your own API key, and we got the following error from Anthropic: {"type":"error","error":{"type":"authentication_error","message":"invalid x-api-key"}}

I dont even have anthropic turned on and yet Screenshot 2024-08-23 at 06 09 19

puterhimself avatar Aug 23 '24 00:08 puterhimself

Cursor team, how can we help get this fixed? (OpenRouter dev here)

alexanderatallah avatar Aug 31 '24 04:08 alexanderatallah

Cursor team, how can we help get this fixed? (OpenRouter dev here)

I used a proxy(one-api) to change claude model to another name and it works. Maybe OpenRouter could support model name alias.

deadblue22 avatar Aug 31 '24 04:08 deadblue22

It works for models which cursor don't provide like: deepseek/deepseek-coder

sFritsch09 avatar Sep 05 '24 12:09 sFritsch09

Still getting this issue, are there any hot fixes?

iudicium avatar Sep 06 '24 17:09 iudicium

Cursor team, how can we help get this fixed? (OpenRouter dev here)

I used a proxy(one-api) to change claude model to another name and it works. Maybe OpenRouter could support model name alias.

hi @deadblue22 any guide for doin that?

ardhi-de avatar Sep 10 '24 17:09 ardhi-de

Cursor team, how can we help get this fixed? (OpenRouter dev here)

I really need it

PierrunoYT avatar Sep 10 '24 18:09 PierrunoYT

Cursor team, how can we help get this fixed? (OpenRouter dev here)

please Cursor, please take this user need to higher priority, we really need this feature.

sunlanchang avatar Sep 11 '24 03:09 sunlanchang

I have a quick fix. Disable all models but one from Openrouter and then validate the API key. You can toggle them on afterwards.

It seems like this trick does not work with Anthropic models as I was getting an error regarding wrong API key in x-api-key header

image

additional context

❯ cursor --version
0.40.4
63dae81aea2c3fc079420fe72578a8eef26ba870
x64

da-moon avatar Sep 11 '24 21:09 da-moon

I have a quick fix. Disable all models but one from Openrouter and then validate the API key. You can toggle them on afterwards.

This didn't fix the issue for me. I'm always able to validate the Openrouter API key and use other models like deepseek-coder.

Anthropic still fails to connect apparently due to reasons above.

kfwebdev avatar Sep 15 '24 01:09 kfwebdev

@kfwebdev You are absolutely correct. I forgot to update my original post with this info. I ended up using https://crosshatch.app mixture of experts models instead

PS: Does anyone know if cursor is using Anthropic prompt caching or not?

da-moon avatar Sep 16 '24 12:09 da-moon

I am also exploring https://www.cursorlens.com

da-moon avatar Sep 16 '24 12:09 da-moon

imo the people behind cursor are being extremely lazy to implement this simple little openrouter glitch. when it sends calls to openrouter it doesnt put the model names correctly i noticed ("gpt-4" instead of "openai/gpt-4") and so idk if thats it or what but it is SOOOOO frustrating

paradiselabs-ai avatar Sep 17 '24 13:09 paradiselabs-ai

I also feel inconvenienced and don't understand the details, but the situation is that they are not accepting feedback for development, so I think it's pointless to write about this. The recent commits also seem to be adjusting the wording of the README, so maybe it's more like an archive?

bonk avatar Sep 17 '24 14:09 bonk

maybe it's time to switch to open-source Cursor alternative, Void https://voideditor.com

sunlanchang avatar Sep 17 '24 16:09 sunlanchang

Continue.dev also works fine with OpenRouter and Claude

I am also a bit puzzled that this heavily requested feature is not fixed, although it is trivial to fix.

psinger avatar Sep 18 '24 13:09 psinger

openrouter + anthropic/claude-3.5-sonnet works again. sorry it was broken!

tmm1 avatar Sep 20 '24 23:09 tmm1

openrouter + anthropic/claude-3.5-sonnet works again! thank you @tmm1 !!

kfwebdev avatar Oct 09 '24 17:10 kfwebdev

It still does not work for me today with the same error. Can anyone confirm?

ducmbui avatar Oct 11 '24 18:10 ducmbui

can work with openai/gpt-4o-2024-08-06 ?

leoatchina avatar Oct 18 '24 03:10 leoatchina

It still does not work for me today with the same error. Can anyone confirm?

It worked for me on image using anthropic/claude-3.5-sonnet as model image

ans-4175 avatar Oct 23 '24 06:10 ans-4175