Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API error: Error 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'}} #555

Closed
goedzo opened this issue Mar 12, 2025 · 3 comments

Comments

@goedzo
Copy link

goedzo commented Mar 12, 2025

Using model "o3-mini" from openAI. This gives the following error:

API error: Error 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'}}

Please use max_completion_tokens in the API request.

@mephistoc
Copy link

Maybe you can provide your config.toml without sensitive information for better understanding your situation.

@goedzo
Copy link
Author

goedzo commented Mar 13, 2025

Sure, just do this:

[llm]
model = "o3-mini"
base_url = "https://api.openai.com/v1"
api_key = "sk-...."
max_tokens = 4096
temperature = 0.0

[llm.vision]
model = "o3-mini"
base_url = "https://api.openai.com/v1"
api_key = "sk-...."

Btw, I've already implemented a fix on my own machine, so will also make a PR that fixes this when o3-mini is used. This is also required since the o3-mini model doesn't have a "temperature" parameter.

@goedzo
Copy link
Author

goedzo commented Mar 15, 2025

A PR has been merged that fixes this issue, so this can be closed now.

@goedzo goedzo closed this as completed Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants