How to make Cursor aware of updated OpenAI API documentation?

When I try to ask Cursor to generate or edit Python scripts that use the OpenAI API, it is using old formats that no longer work, and language models that are deprecated. Is there any way to make it aware of updated API changes?

When I paste the current OpenAI chat completion script from the api reference page, and ask Cursor if this is correct, I get the following response:

No, the code you provided is not correct. The OpenAI Python client library does not have a class named OpenAI. Instead, you should use the openai.ChatCompletion.create method to generate chat completions.

And then if continues to give me corrected code that will not work.

Likewise it is not aware of the model deprecations that just occured at the start of January, and gives me new code with language models that no longer function.

You can always add the latest API docs via @Docs → +Add new doc and point it to the section of the API docs you need.
I used this successfully to get code generated for the assistants API.

1 Like

What do I do if I’ve added new reference docs but cursor is ignoring them?
I’ve added openai’s docs and their api reference on github, and @ mentioned them in the generation, but it’s still using pre-1.0.0 options like openai.audio.create and import openai.

Bump. This is still a problem. No matter what I do I can’t have it stop insisting that it use “openai.ChatCompletion.create” which is way outdated. Tried updating the docs and it doesn’t work. It even gives me a link back and tells me its taking it from the api documentation, then when I click on the link its the actual docs which are correct and don’t mention that function.


Heres an example. I give it the exact page and ask me to prove its read it by reading from the top of the page. It ignores me and repeats from some stored page it has, or hallucinates it.

Then when I confirm it is looking at the page I provided it basically says “whoops I looked at the wrong page. I looked at [right page], and I should have looked at [wrong page]”

then always insists on using the deprecated openai.ChatCompletions function over and over
You can’t remove the OpenAI docs from Cursor, right? this is the problem probably. I tried to give it updated docs but you can see in what its looking at “Open AI”
Then it hallucinates very close to the correct answer. Its still wrong though, so it still hasn’t looked at the page.

pretty bad

Also not sure why its looking at https://link.springer.com/content/pdf/10.1007/978-3-031-29717-5.pdf? this is the link when I click on “Applied Artificial Intelligence” source after my first prompt
didn’t include that anywhere
It also looks at couReco/data/coursera-courses.csv at master · ry05/couReco · GitHub which is a lot of text that says nothing, its just an overview of what the cirriculum is in a bunch of courses?
it also looks at https://onlinelibrary.wiley.com/doi/book/10.1002/9781394163960

I feel like this can’t be helping. This is a mountain of text. What is the deal here?

@web works similar to a google search. It will try to find pages that answer your question and use them in the answer. Could you try this without @web and let me know what result you get?