Skip to content

Conversation

@03-CiprianoG
Copy link

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:

"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

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
@vercel
Copy link

vercel bot commented Oct 7, 2025

@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@*'
@H2Shami H2Shami added the community PR A PR made by our lovely Helicone opensource community! label Nov 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community PR A PR made by our lovely Helicone opensource community!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants