feat: add support for gpt-image-1 model with multi-tier token pricing#5003
Draft
03-CiprianoG wants to merge 4 commits intoHelicone:mainfrom
Draft
feat: add support for gpt-image-1 model with multi-tier token pricing#500303-CiprianoG wants to merge 4 commits intoHelicone:mainfrom
03-CiprianoG wants to merge 4 commits intoHelicone:mainfrom
Conversation
Add comprehensive support for OpenAI's gpt-image-1 model, which uses a
unique pricing structure with three separate token types: text input,
image input, and image output tokens.
## Changes
### Model Configuration
- Add gpt-image-1 model definition with proper metadata
- Configure endpoints for OpenAI, Azure, and OpenRouter providers
- Set pricing: $5/1M text input, $10/1M image input, $40/1M image output
### Type System
- Add `imageInput` field to ModelUsage interface for tracking image input tokens separately
- Add `imageInputCost` to CostBreakdown interface
- Update total cost calculation to include image input costs
### Usage Processing
- Enhance OpenAIUsageProcessor to parse gpt-image-1's token structure
- Extract text_tokens and image_tokens from input_tokens_details
- Map tokens correctly: text to input, image inputs to imageInput, image outputs to output
### Testing
- Add gpt-image-1 API response snapshot
- Add test case for gpt-image-1 token parsing and cost calculation
## Technical Details
The gpt-image-1 model returns usage information in a different format than
standard OpenAI models:
```json
"usage": {
"input_tokens_details": {
"text_tokens": 50,
"image_tokens": 100
},
"prompt_tokens": 150,
"completion_tokens": 4200
}
```
This implementation correctly parses these fields and applies the appropriate
pricing rates for each token type, ensuring accurate cost tracking.
Pricing source: https://platform.openai.com/docs/models/gpt-image-1
|
@03-CiprianoG is attempting to deploy a commit to the Helicone Team on Vercel. A member of the Team first needs to authorize it. |
…columns - Add packages/secrets/package.json to dockerfile_web build dependencies - Add missing key_id and nonce columns to provider_keys table migration - Clean up whitespace in migration file These changes ensure the secrets package is properly included in the web build and the provider_keys table has all necessary columns for encryption.
Re-install jawn dependencies after copying source code to ensure tsup and other devDependencies are available in node_modules when running the build. This fixes the 'Cannot find module tsup/dist/cli-default.js' error during Docker build.
Add packages/common/package.json to the dockerfile_web to fix build error: 'Couldn't find package @helicone-package/common@*'
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.
Add comprehensive support for OpenAI's gpt-image-1 model, which uses a unique pricing structure with three separate token types: text input, image input, and image output tokens.
Changes
Model Configuration
Type System
imageInputfield to ModelUsage interface for tracking image input tokens separatelyimageInputCostto CostBreakdown interfaceUsage Processing
Testing
Technical Details
The gpt-image-1 model returns usage information in a different format than standard OpenAI models:
This implementation correctly parses these fields and applies the appropriate pricing rates for each token type, ensuring accurate cost tracking.
Pricing source: https://platform.openai.com/docs/models/gpt-image-1