OPEN API max_tokens max_completion_tokens

Please update it so that the max_tokens value can be adjusted!

Max tokens are not set in api, so it will default to largest size.

Do you want to set a smaller Max token size?

For example, I would like to call the max_tokens parameter when making a request to OpenAI as shown below.

The reason is that I want to generate longer articles.

import openai

response = openai.ChatCompletion.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Write a detailed article about dog story."}
    ],
    max_tokens=1200
)

For Max tokens you should leave it blank for longest possible articles.

Max tokens include the prompt length. So if your prompt is long it creates shorter articles.

I can add it though on next update.

Thank you so much for providing the update.

Have a great day today!

1 Like

Max tokens!

Slight change because max tokens is now deprecated in favor of a new param

The update hasn’t been implemented yet, right?

I don’t see it in my settings yet.

It’s ready now.

Try download now.