Skip to content

feat: model as first parameter in body for proxy routing efficiency #2400

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gbmarc1
Copy link

@gbmarc1 gbmarc1 commented Jun 5, 2025

I would like that the generator could produce code with the "model" field as the first parameter only.

Proxies such as open-router (or custom proxies) use the "model" field as a routing parameter. We don't need to read the entire payload for routing, we can readily exit the read when we find the "model" field.

The important thing is that the "model" field should be before the "prompt" or "inputs" as those can be very large.

@gbmarc1 gbmarc1 requested a review from a team as a code owner June 5, 2025 15:50
@RobertCraigie
Copy link
Collaborator

Thanks for the PR but I don't think we'll want to change the order of the keys in each method body, instead this ordering could happen in https://github.com/openai/openai-python/blob/main/src/openai/_base_client.py before we turn the dictionary into json, would you mind updating the PR with that approach?

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 this pull request may close these issues.

2 participants