[FEATURE] config.price cannot set image prices
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 69/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- ruby
- Ambito
- backend-api-design
Direzione di ricerca
Leggi Model::Pricing::OVERRIDES e la gestione esistente di config.price, poi verifica come Cost legge i prezzi delle immagini, come descritto nell’issue. Aggiungi il supporto per gli override image_input e image_output, associati alla categoria images, ed esegui i test di pricing pertinenti. Il lavoro è completato quando entrambe le opzioni vengono accettate e i costi delle immagini usano le tariffe configurate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Scope check
- This is core LLM communication (not application logic)
- This benefits most users (not just my use case)
- This can't be solved in application code with current RubyLLM
- I read the Contributing Guide
Due diligence
- I searched existing issues
- I checked the documentation
What problem does this solve?
Cost prices an image from model.pricing.images and falls back to the text prices when that category is empty (Cost#output_price, #image_input_parts). config.price can write every other category, but not that one:
RubyLLM.configure { |c| c.price "gpt-image-2", provider: :openai, images: 40 }
# ArgumentError: Unknown price: images. Valid prices: input, output, cache_read,
# cache_write, characters, audio_seconds, search_units
It matters for models that bill image tokens at another rate than text. In 2.2.3's registry:
RubyLLM.models.find("gemini-3-pro-image", provider: :gemini).pricing.to_h
# => {text_tokens: {standard: {input_per_million: 2, output_per_million: 12}}}
RubyLLM.models.find("gpt-image-2", provider: :openai).pricing.to_h
# => {}
The registry at an earlier 2.2 commit priced gemini-3-pro-image output at 120. models.dev now lists the text rate there, so RubyLLM.paint(...).cost.total comes out at a tenth of the image rate. The only way to correct it today is config.price "gemini-3-pro-image", provider: :gemini, output: 120, which also reprices the same model's text and thinking output in chats.
Proposed solution
Two more keys on config.price, mapped into the images category the way characters maps into its own:
config.price "gemini-3-pro-image", provider: :gemini, image_output: 120
config.price "gpt-image-2", provider: :openai, input: 5, image_input: 8, image_output: 30
In Model::Pricing::OVERRIDES that is image_input: %i[images input_per_million] and image_output: %i[images output_per_million]. Cost already reads both.
Why this belongs in RubyLLM
config.price is the public door for "the registry has no price, or not mine", and Model::Pricing.override rejects any key it does not list. The one category it cannot reach is the one where registry data is thinnest, so an app is left to prepend Models.load_models and rewrite pricing hashes, which is private API.
- Lingua principale
- Ruby
- Stelle
- 4.5k
- Fork
- 543
- Merge medio
- 11h 38m
- PR unite (30g)
- 410
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di crmne/ruby_llm
-
[BUG] MCP over HTTP can't read a JSON reply that starts with a byte order markForse già presa @yorzi l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
crmne/ruby_llm#1879 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] XLSX date-times on January 1, 1904 lose the dateForse già presa @yorzi l’ha presa oggi. Apertabug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 3/5 Mezza giornata Idoneità per principianti 48/100
crmne/ruby_llm#1876 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] after_fallback reports a fallback as failed when after_message raises on its replyForse già presa @yorzi l’ha presa 2 giorni fa. Apertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
crmne/ruby_llm#1861 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Agent.create resolves the model before applying the agent contextForse già presa @yorzi l’ha presa 2 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di crmne/ruby_llm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
swombat/souls-house#1203 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
we-promise/sure#5924 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
CircuitVerse/CircuitVerse#8342 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#963 ·
I maintainer di solito rispondono entro 1 giorno