OpenAI o1 not available because max_completion_tokens parameter hasn't been implemented?

Adding my API key with the required access rights I get an error that the max_tokens parameter is not supported.
This comes as quite the surprise. Has this really not been implemented yet by Cursor, or am I missing something?

(status code 400)
{
  "error": {
    "message": "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.",
    "type": "invalid_request_error",
    "param": "max_tokens",
    "code": "unsupported_parameter"
  }

The curl request works as expected:

curl https://api.openai.com/v1/chat/completions -H “Content-Type: application/json” -H “Authorization: Bearer sk-proj-” -d “{ "messages": [ { "role": "system", "content": "You are a test assistant." }, { "role": "user", "content": "Testing. Just say hi and nothing else." } ], "model": "o1" }”

{
  "id": "chatcmpl-BCoIO6Pdk5QQmQP1e8tPZkTpyK1uS",
  "object": "chat.completion",
  "created": 1742392972,
  "model": "o1-2024-12-17",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "hi",
        "refusal": null,
        "annotations": []
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ]
2 Likes

"o3-mini is also not working for me.

I’m using the same API key that works with older models (gpt-4, gpt-3.5, etc.).

I’ve confirmed that it’s not working on versions x64-0.45.17, x64-0.46.11, and x64-0.47.8.

Would downgrading to an older version of Cursor potentially resolve this issue?"

I think I’ve found a solution that might help others facing this issue.

While the “max_tokens” error related to unsupported models didn’t disappear entirely, I was able to successfully use the o3-mini model with my OpenAI API key for the ask, edit, and agent functionalities.

Here’s what worked for me:

  1. Temporarily select both gpt-4 (or any other readily available OpenAI gpt model) and the o1, o3, or whichever model you’re trying to use.
  2. Click “Verify.” It should now verify successfully.
  3. After successful verification, you can uncheck the temporarily selected gpt model (the gpt-4 or alternative).

To Confirm It’s Working:

Ask the AI a question and then check your token usage on the https://platform.openai.com/usage page to see if tokens are being consumed.

Hopefully, this helps someone else struggling with the same problem!

2 Likes

Unfortunately, we don’t currently support special configuration parameters beyond the default OpenAI standard, as mentioned in our docs here:

However, @hktrollgames workaround seems like it could work!

@hktrollgames
Following your excellent suggestion it was possible for me to enable both o3-mini high and o1 in the Cursor Chat interface.

What has worked for me, is selecting 4o and o3-mini high to verify the API key. The result was that the OpenAI Api key was finally enabled in the Cursor settings.
Then, I added o1 in a next step. And it works!

@danperks: since it’s obviously possible I suggest to update the documentation. Most likely the auth process needs just a tiny adjustment to make it work withou any additional workarounds.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.