anomalyco / anomalyco/models.dev

Support per-unit pricing (per-image, per-second) in cost

Open
#5,311 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
6.9k
Forks
1.7k
Avg merge
3h 21m
Merged PRs (30d)
873

Description

Is your feature request related to a problem?

cost is denominated per million tokens, so models that charge per image or per second have nowhere to put their price and end up with cost: {}.

xAI's published API prices, none of which the schema can hold:

model price cost in api.json
grok-imagine-image $0.02 / image {}
grok-imagine-image-2.0 $0.04 / image {}
grok-imagine-video-1.5 $0.080 / sec {}

OpenAI's gpt-image-1, gpt-image-1.5, gpt-image-1-mini and chatgpt-image-latest are in the same position.

Describe the solution you'd like

A per-unit price alongside the existing token fields, so text models are unaffected:

[cost.per_unit]
unit = "image"   # or "second"
amount = 0.04
Describe alternatives you've considered

#66 proposes per-modality costs with a quality × dimensions matrix. That fits OpenAI's tiering, but not xAI's flat per-image price, and it doesn't cover per-second video — so video stays unrepresentable even if it ships as written. Happy for this to be folded into #66 if you'd rather keep one thread; the per-second case is the part I didn't want to lose.

Consumers looking prices up themselves. These providers publish pricing as marketing HTML, not an API, so it would mean scraping.

Additional context

We hit this in jazz, trying to cap what an agent may spend on image generation. We ended up capping the number of calls instead — a dollar cap silently becomes no cap on exactly the models that report no price.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing cost schema and token-pricing fields in api.json, then compare how current model pricing entries are represented. Done means the schema can represent per-image and per-second prices through a per_unit value while leaving token-based text model costs unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.