Skip to content

Add GPT-4.1, o-series, and computer-use-preview models #45

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

Merged
merged 9 commits into from
Apr 22, 2025

Conversation

jamesmcroft
Copy link
Owner

This pull request introduces significant changes to the token cost calculation logic, the structure of the model data, and the user interface for model selection and calculation explanations. The updates ensure better scalability, improved user experience, and enhanced clarity in cost calculations. Below are the most important changes grouped by theme:

Cost Calculation Updates:

  • Updated the cost calculation logic to use "cost per million tokens" instead of "cost per thousand tokens" in both src/stores/CalcStore.js and src/components/calculator/CalculationExplanation.jsx. This change affects how the total cost is calculated and displayed. [1] [2] [3]

Model Data Restructuring:

  • Restructured the models data in src/stores/ModelStore.js to group models into categories (e.g., "GPT-4.1", "o-series") with nested items. This allows for better organization and scalability of model configurations. [1] [2] [3]
  • Updated the ModelSelector component to support the new grouped model structure. Added ListSubheader elements for grouping models and adjusted the logic to handle nested model data when selecting a model. [1] [2]

UI Improvements:

  • Added a new comment field for models in src/stores/ModelStore.js, which is displayed in the CalculationExplanation component if present. This provides additional context or important notes about specific models. [1] [2]

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces new multimodal models and updates the cost calculation logic from cost per thousand tokens to cost per million tokens while restructuring model data and improving the UI for model selection and explanation.

  • Updated the cost calculation logic in CalcStore.js to use cost per million tokens.
  • Restructured ModelStore.js to group models into categories and added an optional comment field for additional model context.
  • Modified ModelSelector.jsx and CalculationExplanation.jsx to support grouped models and display extra model information.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/stores/ModelStore.js Updated model grouping and cost field naming for scalability
src/stores/CalcStore.js Adjusted cost calculation logic to use per million tokens
src/components/calculator/ModelSelector.jsx Refactored model selection to support nested/grouped model data
src/components/calculator/CalculationExplanation.jsx Updated displayed cost info and conditionally rendered model comment
README.md Revised description to include the new multimodal models
Comments suppressed due to low confidence (1)

src/components/calculator/ModelSelector.jsx:21

  • [nitpick] The selection logic using flatMap with find and filter might lead to ambiguity if models across groups share the same name. Consider refactoring this logic (e.g., using a nested loop or reduce) to ensure a clear and deterministic selection and to better handle duplicate names.
const selectedModel = models.flatMap((modelGroup) => modelGroup.items.find((m) => m.name === model)).filter(Boolean)[0];

@jamesmcroft jamesmcroft merged commit b91e3d6 into main Apr 22, 2025
3 checks passed
@jamesmcroft jamesmcroft deleted the 44-feature-new-models branch April 22, 2025 11:01
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.

[Feature]: Add new GPT‑4.x series, new o‑series, and computer‑use‑preview to Image Token Calculator
1 participant