Added o3 and updated openai pricing#108
Open
williamjameshandley wants to merge 3 commits intokharvd:mainfrom
Open
Added o3 and updated openai pricing#108williamjameshandley wants to merge 3 commits intokharvd:mainfrom
williamjameshandley wants to merge 3 commits intokharvd:mainfrom
Conversation
kharvd
requested changes
Feb 3, 2025
gptcli/providers/openai.py
Outdated
| return O_1_PREVIEW_2024_09_12_PRICE_PER_TOKEN | ||
| elif model == "o3-mini": | ||
| return O_3_MINI_PRICE_PER_TOKEN | ||
| elif model == "03-mini-2025-01-31": |
Contributor
Author
There was a problem hiding this comment.
Good spot (this was a typo on the website apparently).
Contributor
Author
|
Is the above what you had in mind, or would you like to move it into a nested dict (or yaml file of prices?) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This PR expands our support for OpenAI models by introducing additional pricing constants for several GPT-3.5, GPT-4, and related models, while also adding detection for the "o3" model type in the assistant. These changes ensure that our pricing logic reflects the latest API offerings and model variants.
Changes:
• In gptcli/assistant.py:
• In gptcli/providers/openai.py:
Rationale:
• Ensures support for the latest and upcoming OpenAI models, reflecting current pricing structures.
• Improves clarity and maintainability by having explicit mappings for each model variant.
• Future-proofs our codebase against potential changes in model naming conventions and pricing updates.
Testing:
• Verified that gpt_pricing() returns the appropriate pricing dictionary for each supported model.
• Confirmed that the new "o3" prefix correctly instantiates an OpenAICompletionProvider in the assistant.
Please review the changes and let me know if any adjustments are needed.
For reference, below is the prompt I used to update the pricing.
I also then checked that these were all consistent with a large language model which did not find any issues. I checked that LLMs were able to find injected errors.
Here is the openai pricing as copied from the openai website on 2025-02-01:
These are copied from a table, so in general if it's ambiguous, the first price is the one that I want (i.e. without batching or caching)
Please update this python code to include all the prices above:
The new price should supercede the old price. Please give me the full code output (do not abbreviate) so I can copy it in as a new pull request