llm_cost_tracker 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/llm_cost_tracker/integrations/openai.rb +1 -0
- data/lib/llm_cost_tracker/prices.json +187 -49
- data/lib/llm_cost_tracker/providers/openai/parser.rb +1 -1
- data/lib/llm_cost_tracker/providers/openai/response_parser.rb +11 -1
- data/lib/llm_cost_tracker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 380c06ddfdda1e5df94061a377dc703fd1f52c4b5ab92ab1f786ef1fce591be1
|
|
4
|
+
data.tar.gz: e58224c8eb4d538faea70fe867d33be5000611a35ec58ab33feb72d39fca9ef6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2cd2b3c33e60e7638c58044220f2e43336be78f2cd085d253cdf99badb9af8586f411d1ced9e332a7255b81f08267407a52e7610b5dedc33fc2623cbca681a34
|
|
7
|
+
data.tar.gz: 70c17315f8a243cc59ebaf036f480151320a4ecb3adc53d152f5f15bfe50b51d81fdc0722e784d026d540e94d64d9a64443cc6f8cf51bcaf5585093b80ee049a
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: [SemVer](https://semver.org/spec/v2.0.0.html).
|
|
4
4
|
|
|
5
|
+
## [0.15.2] - 2026-10-29
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Bundled prices add OpenAI GPT-6.1 Terra.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- OpenAI Decisions API calls through the official openai gem and Faraday are recorded.
|
|
14
|
+
- OpenAI Decisions output tokens are not billed, RubyLLM 2.x judgments included, as OpenAI prices them.
|
|
15
|
+
|
|
5
16
|
## [0.15.1] - 2026-10-26
|
|
6
17
|
|
|
7
18
|
### Changed
|
|
@@ -47,6 +47,7 @@ module LlmCostTracker
|
|
|
47
47
|
patch_target("OpenAI::Resources::Audio::Translations", with: TranslationsPatch, optional: true),
|
|
48
48
|
patch_target("OpenAI::Resources::Audio::Speech", with: SpeechPatch, optional: true),
|
|
49
49
|
patch_target("OpenAI::Resources::Moderations", with: ModerationsPatch, optional: true),
|
|
50
|
+
patch_target("OpenAI::Resources::Decisions", with: CreatePatch, optional: true, since: "0.101.0"),
|
|
50
51
|
patch_target("OpenAI::Resources::Batches", with: BatchesPatch, optional: true)
|
|
51
52
|
]
|
|
52
53
|
end
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"openrouter/arcee-ai/coder-large": "2026-10-05",
|
|
30
30
|
"openrouter/arcee-ai/maestro-reasoning": "2026-10-05",
|
|
31
31
|
"openrouter/arcee-ai/spotlight": "2026-10-05",
|
|
32
|
+
"openrouter/arcee-ai/trinity-large-thinking": "2026-10-27",
|
|
32
33
|
"openrouter/arcee-ai/trinity-mini": "2026-10-05",
|
|
33
34
|
"openrouter/arcee-ai/virtuoso-large": "2026-10-05",
|
|
34
35
|
"openrouter/baidu/ernie-4.5-21b-a3b": "2026-10-05",
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
"openrouter/google/gemini-2.5-pro:batch": "2026-10-21",
|
|
56
57
|
"openrouter/google/gemma-3n-e4b-it": "2026-10-05",
|
|
57
58
|
"openrouter/google/gemma-4-31b-it:batch": "2026-10-05",
|
|
59
|
+
"openrouter/ibm-granite/granite-4.0-h-micro": "2026-10-27",
|
|
58
60
|
"openrouter/ibm-granite/granite-4.1-8b": "2026-10-05",
|
|
59
61
|
"openrouter/inception/mercury-2.5-preview": "2026-10-05",
|
|
60
62
|
"openrouter/inclusionai/ling-2.6-1t": "2026-10-05",
|
|
@@ -76,11 +78,16 @@
|
|
|
76
78
|
"openrouter/microsoft/phi-4-mini-instruct": "2026-10-05",
|
|
77
79
|
"openrouter/microsoft/wizardlm-2-8x22b": "2026-10-19",
|
|
78
80
|
"openrouter/minimax/minimax-m3:batch": "2026-10-05",
|
|
81
|
+
"openrouter/mistralai/codestral-2508:batch": "2026-10-27",
|
|
79
82
|
"openrouter/mistralai/devstral-medium": "2026-10-05",
|
|
80
83
|
"openrouter/mistralai/devstral-small": "2026-10-05",
|
|
81
84
|
"openrouter/mistralai/ministral-8b": "2026-10-05",
|
|
85
|
+
"openrouter/mistralai/ministral-8b-2512:batch": "2026-10-27",
|
|
82
86
|
"openrouter/mistralai/mistral-7b-instruct-v0.1": "2026-10-05",
|
|
83
87
|
"openrouter/mistralai/mistral-large-2411": "2026-10-05",
|
|
88
|
+
"openrouter/mistralai/mistral-large-2512:batch": "2026-10-27",
|
|
89
|
+
"openrouter/mistralai/mistral-medium-3.1:batch": "2026-10-27",
|
|
90
|
+
"openrouter/mistralai/mistral-small-2603:batch": "2026-10-27",
|
|
84
91
|
"openrouter/mistralai/pixtral-large-2411": "2026-10-05",
|
|
85
92
|
"openrouter/moonshotai/kimi-k2.7-code:batch": "2026-10-05",
|
|
86
93
|
"openrouter/nex-agi/deepseek-v3.1-nex-n1": "2026-10-05",
|
|
@@ -198,7 +205,7 @@
|
|
|
198
205
|
"https://docs.x.ai/developers/pricing.md"
|
|
199
206
|
],
|
|
200
207
|
"unit": "1M tokens",
|
|
201
|
-
"updated_at": "2026-10-
|
|
208
|
+
"updated_at": "2026-10-28"
|
|
202
209
|
},
|
|
203
210
|
"models": {
|
|
204
211
|
"anthropic/claude-3-5-haiku": {
|
|
@@ -3774,6 +3781,109 @@
|
|
|
3774
3781
|
"ultrafast_input": 12.0,
|
|
3775
3782
|
"ultrafast_output": 60.0
|
|
3776
3783
|
},
|
|
3784
|
+
"openai/gpt-6.1-terra": {
|
|
3785
|
+
"_context_price_threshold_tokens": 272000,
|
|
3786
|
+
"above_context_batch_cache_read_input": 0.05,
|
|
3787
|
+
"above_context_batch_cache_write_extended_input": 2.5,
|
|
3788
|
+
"above_context_batch_cache_write_input": 1.25,
|
|
3789
|
+
"above_context_batch_data_residency_cache_read_input": 0.055,
|
|
3790
|
+
"above_context_batch_data_residency_cache_write_extended_input": 2.75,
|
|
3791
|
+
"above_context_batch_data_residency_cache_write_input": 1.375,
|
|
3792
|
+
"above_context_batch_data_residency_input": 1.1,
|
|
3793
|
+
"above_context_batch_data_residency_output": 4.125,
|
|
3794
|
+
"above_context_batch_input": 1.0,
|
|
3795
|
+
"above_context_batch_output": 3.75,
|
|
3796
|
+
"above_context_cache_read_input": 0.1,
|
|
3797
|
+
"above_context_cache_write_extended_input": 5.0,
|
|
3798
|
+
"above_context_cache_write_input": 2.5,
|
|
3799
|
+
"above_context_data_residency_cache_read_input": 0.11,
|
|
3800
|
+
"above_context_data_residency_cache_write_extended_input": 5.5,
|
|
3801
|
+
"above_context_data_residency_cache_write_input": 2.75,
|
|
3802
|
+
"above_context_data_residency_input": 2.2,
|
|
3803
|
+
"above_context_data_residency_output": 8.25,
|
|
3804
|
+
"above_context_fast_cache_read_input": 0.2,
|
|
3805
|
+
"above_context_fast_cache_write_extended_input": 10.0,
|
|
3806
|
+
"above_context_fast_cache_write_input": 5.0,
|
|
3807
|
+
"above_context_fast_data_residency_cache_read_input": 0.22,
|
|
3808
|
+
"above_context_fast_data_residency_cache_write_extended_input": 11.0,
|
|
3809
|
+
"above_context_fast_data_residency_cache_write_input": 5.5,
|
|
3810
|
+
"above_context_fast_data_residency_input": 4.4,
|
|
3811
|
+
"above_context_fast_data_residency_output": 16.5,
|
|
3812
|
+
"above_context_fast_input": 4.0,
|
|
3813
|
+
"above_context_fast_output": 15.0,
|
|
3814
|
+
"above_context_flex_cache_read_input": 0.05,
|
|
3815
|
+
"above_context_flex_cache_write_extended_input": 2.5,
|
|
3816
|
+
"above_context_flex_cache_write_input": 1.25,
|
|
3817
|
+
"above_context_flex_data_residency_cache_read_input": 0.055,
|
|
3818
|
+
"above_context_flex_data_residency_cache_write_extended_input": 2.75,
|
|
3819
|
+
"above_context_flex_data_residency_cache_write_input": 1.375,
|
|
3820
|
+
"above_context_flex_data_residency_input": 1.1,
|
|
3821
|
+
"above_context_flex_data_residency_output": 4.125,
|
|
3822
|
+
"above_context_flex_input": 1.0,
|
|
3823
|
+
"above_context_flex_output": 3.75,
|
|
3824
|
+
"above_context_input": 2.0,
|
|
3825
|
+
"above_context_output": 7.5,
|
|
3826
|
+
"above_context_priority_cache_read_input": 0.2,
|
|
3827
|
+
"above_context_priority_cache_write_extended_input": 10.0,
|
|
3828
|
+
"above_context_priority_cache_write_input": 5.0,
|
|
3829
|
+
"above_context_priority_data_residency_cache_read_input": 0.22,
|
|
3830
|
+
"above_context_priority_data_residency_cache_write_extended_input": 11.0,
|
|
3831
|
+
"above_context_priority_data_residency_cache_write_input": 5.5,
|
|
3832
|
+
"above_context_priority_data_residency_input": 4.4,
|
|
3833
|
+
"above_context_priority_data_residency_output": 16.5,
|
|
3834
|
+
"above_context_priority_input": 4.0,
|
|
3835
|
+
"above_context_priority_output": 15.0,
|
|
3836
|
+
"batch_cache_read_input": 0.025,
|
|
3837
|
+
"batch_cache_write_extended_input": 1.25,
|
|
3838
|
+
"batch_cache_write_input": 0.625,
|
|
3839
|
+
"batch_data_residency_cache_read_input": 0.0275,
|
|
3840
|
+
"batch_data_residency_cache_write_extended_input": 1.375,
|
|
3841
|
+
"batch_data_residency_cache_write_input": 0.6875,
|
|
3842
|
+
"batch_data_residency_input": 0.55,
|
|
3843
|
+
"batch_data_residency_output": 2.75,
|
|
3844
|
+
"batch_input": 0.5,
|
|
3845
|
+
"batch_output": 2.5,
|
|
3846
|
+
"cache_read_input": 0.05,
|
|
3847
|
+
"cache_write_extended_input": 2.5,
|
|
3848
|
+
"cache_write_input": 1.25,
|
|
3849
|
+
"data_residency_cache_read_input": 0.055,
|
|
3850
|
+
"data_residency_cache_write_extended_input": 2.75,
|
|
3851
|
+
"data_residency_cache_write_input": 1.375,
|
|
3852
|
+
"data_residency_input": 1.1,
|
|
3853
|
+
"data_residency_output": 5.5,
|
|
3854
|
+
"fast_cache_read_input": 0.1,
|
|
3855
|
+
"fast_cache_write_extended_input": 5.0,
|
|
3856
|
+
"fast_cache_write_input": 2.5,
|
|
3857
|
+
"fast_data_residency_cache_read_input": 0.11,
|
|
3858
|
+
"fast_data_residency_cache_write_extended_input": 5.5,
|
|
3859
|
+
"fast_data_residency_cache_write_input": 2.75,
|
|
3860
|
+
"fast_data_residency_input": 2.2,
|
|
3861
|
+
"fast_data_residency_output": 11.0,
|
|
3862
|
+
"fast_input": 2.0,
|
|
3863
|
+
"fast_output": 10.0,
|
|
3864
|
+
"flex_cache_read_input": 0.025,
|
|
3865
|
+
"flex_cache_write_extended_input": 1.25,
|
|
3866
|
+
"flex_cache_write_input": 0.625,
|
|
3867
|
+
"flex_data_residency_cache_read_input": 0.0275,
|
|
3868
|
+
"flex_data_residency_cache_write_extended_input": 1.375,
|
|
3869
|
+
"flex_data_residency_cache_write_input": 0.6875,
|
|
3870
|
+
"flex_data_residency_input": 0.55,
|
|
3871
|
+
"flex_data_residency_output": 2.75,
|
|
3872
|
+
"flex_input": 0.5,
|
|
3873
|
+
"flex_output": 2.5,
|
|
3874
|
+
"input": 1.0,
|
|
3875
|
+
"output": 5.0,
|
|
3876
|
+
"priority_cache_read_input": 0.1,
|
|
3877
|
+
"priority_cache_write_extended_input": 5.0,
|
|
3878
|
+
"priority_cache_write_input": 2.5,
|
|
3879
|
+
"priority_data_residency_cache_read_input": 0.11,
|
|
3880
|
+
"priority_data_residency_cache_write_extended_input": 5.5,
|
|
3881
|
+
"priority_data_residency_cache_write_input": 2.75,
|
|
3882
|
+
"priority_data_residency_input": 2.2,
|
|
3883
|
+
"priority_data_residency_output": 11.0,
|
|
3884
|
+
"priority_input": 2.0,
|
|
3885
|
+
"priority_output": 10.0
|
|
3886
|
+
},
|
|
3777
3887
|
"openai/gpt-audio": {
|
|
3778
3888
|
"audio_input": 32.0,
|
|
3779
3889
|
"audio_output": 64.0,
|
|
@@ -4478,9 +4588,9 @@
|
|
|
4478
4588
|
"output": 0.182
|
|
4479
4589
|
},
|
|
4480
4590
|
"openrouter/deepseek/deepseek-v4-flash-0731": {
|
|
4481
|
-
"cache_read_input": 0.
|
|
4482
|
-
"input": 0.
|
|
4483
|
-
"output": 0.
|
|
4591
|
+
"cache_read_input": 0.0238,
|
|
4592
|
+
"input": 0.119,
|
|
4593
|
+
"output": 0.238
|
|
4484
4594
|
},
|
|
4485
4595
|
"openrouter/deepseek/deepseek-v4-flash-0731:batch": {
|
|
4486
4596
|
"cache_read_input": 0.0035,
|
|
@@ -4498,9 +4608,9 @@
|
|
|
4498
4608
|
"output": 0.33
|
|
4499
4609
|
},
|
|
4500
4610
|
"openrouter/deepseek/deepseek-v4-pro": {
|
|
4501
|
-
"cache_read_input": 0.
|
|
4502
|
-
"input": 0.
|
|
4503
|
-
"output":
|
|
4611
|
+
"cache_read_input": 0.079605,
|
|
4612
|
+
"input": 0.95526,
|
|
4613
|
+
"output": 1.91052
|
|
4504
4614
|
},
|
|
4505
4615
|
"openrouter/deepseek/deepseek-v4-pro-0813": {
|
|
4506
4616
|
"cache_read_input": 0.044,
|
|
@@ -4513,9 +4623,9 @@
|
|
|
4513
4623
|
"output": 1.98
|
|
4514
4624
|
},
|
|
4515
4625
|
"openrouter/deepseek/deepseek-v4.1-flash": {
|
|
4516
|
-
"cache_read_input": 0.
|
|
4517
|
-
"input": 0.
|
|
4518
|
-
"output":
|
|
4626
|
+
"cache_read_input": 0.0042,
|
|
4627
|
+
"input": 0.14,
|
|
4628
|
+
"output": 0.42
|
|
4519
4629
|
},
|
|
4520
4630
|
"openrouter/deepseek/deepseek-v4.1-flash-1017": {
|
|
4521
4631
|
"cache_read_input": 0.006,
|
|
@@ -4831,18 +4941,17 @@
|
|
|
4831
4941
|
"output": 0.35
|
|
4832
4942
|
},
|
|
4833
4943
|
"openrouter/google/gemma-3-4b-it": {
|
|
4834
|
-
"
|
|
4835
|
-
"
|
|
4836
|
-
"output": 0.05
|
|
4944
|
+
"input": 0.05,
|
|
4945
|
+
"output": 0.1
|
|
4837
4946
|
},
|
|
4838
4947
|
"openrouter/google/gemma-3n-e4b-it": {
|
|
4839
4948
|
"input": 0.06,
|
|
4840
4949
|
"output": 0.12
|
|
4841
4950
|
},
|
|
4842
4951
|
"openrouter/google/gemma-4-26b-a4b-it": {
|
|
4843
|
-
"cache_read_input": 0.
|
|
4844
|
-
"input": 0.
|
|
4845
|
-
"output": 0.
|
|
4952
|
+
"cache_read_input": 0.05,
|
|
4953
|
+
"input": 0.09,
|
|
4954
|
+
"output": 0.3
|
|
4846
4955
|
},
|
|
4847
4956
|
"openrouter/google/gemma-4-31b-it": {
|
|
4848
4957
|
"input": 0.2,
|
|
@@ -4999,9 +5108,8 @@
|
|
|
4999
5108
|
"output": 0.4
|
|
5000
5109
|
},
|
|
5001
5110
|
"openrouter/meta-llama/llama-3.1-8b-instruct": {
|
|
5002
|
-
"
|
|
5003
|
-
"
|
|
5004
|
-
"output": 0.08
|
|
5111
|
+
"input": 0.02,
|
|
5112
|
+
"output": 0.04
|
|
5005
5113
|
},
|
|
5006
5114
|
"openrouter/meta-llama/llama-3.2-11b-vision-instruct": {
|
|
5007
5115
|
"input": 0.345,
|
|
@@ -5327,8 +5435,8 @@
|
|
|
5327
5435
|
},
|
|
5328
5436
|
"openrouter/moonshotai/kimi-k2.7-code": {
|
|
5329
5437
|
"cache_read_input": 0.15,
|
|
5330
|
-
"input": 0.
|
|
5331
|
-
"output": 3.
|
|
5438
|
+
"input": 0.56,
|
|
5439
|
+
"output": 3.1
|
|
5332
5440
|
},
|
|
5333
5441
|
"openrouter/moonshotai/kimi-k2.7-code:batch": {
|
|
5334
5442
|
"cache_read_input": 0.19,
|
|
@@ -5336,9 +5444,9 @@
|
|
|
5336
5444
|
"output": 4.0
|
|
5337
5445
|
},
|
|
5338
5446
|
"openrouter/moonshotai/kimi-k3": {
|
|
5339
|
-
"cache_read_input": 0.
|
|
5340
|
-
"input": 0.
|
|
5341
|
-
"output":
|
|
5447
|
+
"cache_read_input": 0.169,
|
|
5448
|
+
"input": 0.179,
|
|
5449
|
+
"output": 20.0
|
|
5342
5450
|
},
|
|
5343
5451
|
"openrouter/moonshotai/kimi-k3.1-pro": {
|
|
5344
5452
|
"cache_read_input": 0.2,
|
|
@@ -5395,6 +5503,7 @@
|
|
|
5395
5503
|
"output": 0.7
|
|
5396
5504
|
},
|
|
5397
5505
|
"openrouter/nousresearch/hermes-4-405b": {
|
|
5506
|
+
"cache_read_input": 0.2,
|
|
5398
5507
|
"input": 1.0,
|
|
5399
5508
|
"output": 3.0
|
|
5400
5509
|
},
|
|
@@ -5407,6 +5516,7 @@
|
|
|
5407
5516
|
"output": 0.4
|
|
5408
5517
|
},
|
|
5409
5518
|
"openrouter/nvidia/nemotron-3-nano-30b-a3b": {
|
|
5519
|
+
"cache_read_input": 0.012,
|
|
5410
5520
|
"input": 0.06,
|
|
5411
5521
|
"output": 0.24
|
|
5412
5522
|
},
|
|
@@ -5503,7 +5613,7 @@
|
|
|
5503
5613
|
"output": 0.8
|
|
5504
5614
|
},
|
|
5505
5615
|
"openrouter/openai/gpt-4.1-nano": {
|
|
5506
|
-
"cache_read_input": 0.
|
|
5616
|
+
"cache_read_input": 0.03,
|
|
5507
5617
|
"input": 0.1,
|
|
5508
5618
|
"output": 0.4
|
|
5509
5619
|
},
|
|
@@ -5925,6 +6035,30 @@
|
|
|
5925
6035
|
"input": 1.0,
|
|
5926
6036
|
"output": 5.0
|
|
5927
6037
|
},
|
|
6038
|
+
"openrouter/openai/gpt-6.1-terra": {
|
|
6039
|
+
"cache_read_input": 0.05,
|
|
6040
|
+
"cache_write_input": 1.25,
|
|
6041
|
+
"input": 1.0,
|
|
6042
|
+
"output": 5.0
|
|
6043
|
+
},
|
|
6044
|
+
"openrouter/openai/gpt-6.1-terra-pro": {
|
|
6045
|
+
"cache_read_input": 0.05,
|
|
6046
|
+
"cache_write_input": 1.25,
|
|
6047
|
+
"input": 1.0,
|
|
6048
|
+
"output": 5.0
|
|
6049
|
+
},
|
|
6050
|
+
"openrouter/openai/gpt-6.1-terra-pro:batch": {
|
|
6051
|
+
"cache_read_input": 0.025,
|
|
6052
|
+
"cache_write_input": 0.625,
|
|
6053
|
+
"input": 0.5,
|
|
6054
|
+
"output": 2.5
|
|
6055
|
+
},
|
|
6056
|
+
"openrouter/openai/gpt-6.1-terra:batch": {
|
|
6057
|
+
"cache_read_input": 0.025,
|
|
6058
|
+
"cache_write_input": 0.625,
|
|
6059
|
+
"input": 0.5,
|
|
6060
|
+
"output": 2.5
|
|
6061
|
+
},
|
|
5928
6062
|
"openrouter/openai/gpt-audio": {
|
|
5929
6063
|
"audio_input": 32.0,
|
|
5930
6064
|
"input": 2.5,
|
|
@@ -6106,6 +6240,11 @@
|
|
|
6106
6240
|
"input": 0.075,
|
|
6107
6241
|
"output": 0.5
|
|
6108
6242
|
},
|
|
6243
|
+
"openrouter/prism-ml/ternary-bonsai-2-9b": {
|
|
6244
|
+
"cache_read_input": 0.04,
|
|
6245
|
+
"input": 0.08,
|
|
6246
|
+
"output": 0.13
|
|
6247
|
+
},
|
|
6109
6248
|
"openrouter/qwen/qwen-2.5-72b-instruct": {
|
|
6110
6249
|
"input": 0.36,
|
|
6111
6250
|
"output": 0.4
|
|
@@ -6158,7 +6297,8 @@
|
|
|
6158
6297
|
"output": 0.5
|
|
6159
6298
|
},
|
|
6160
6299
|
"openrouter/qwen/qwen3-30b-a3b-instruct-2507": {
|
|
6161
|
-
"
|
|
6300
|
+
"cache_read_input": 0.1,
|
|
6301
|
+
"input": 0.1,
|
|
6162
6302
|
"output": 0.3
|
|
6163
6303
|
},
|
|
6164
6304
|
"openrouter/qwen/qwen3-30b-a3b-thinking-2507": {
|
|
@@ -6248,13 +6388,12 @@
|
|
|
6248
6388
|
"output": 2.1
|
|
6249
6389
|
},
|
|
6250
6390
|
"openrouter/qwen/qwen3.5-122b-a10b": {
|
|
6251
|
-
"input": 0.
|
|
6252
|
-
"output":
|
|
6391
|
+
"input": 0.26,
|
|
6392
|
+
"output": 2.08
|
|
6253
6393
|
},
|
|
6254
6394
|
"openrouter/qwen/qwen3.5-27b": {
|
|
6255
|
-
"
|
|
6256
|
-
"
|
|
6257
|
-
"output": 2.16
|
|
6395
|
+
"input": 0.26,
|
|
6396
|
+
"output": 2.6
|
|
6258
6397
|
},
|
|
6259
6398
|
"openrouter/qwen/qwen3.5-35b-a3b": {
|
|
6260
6399
|
"cache_read_input": 0.05,
|
|
@@ -6288,14 +6427,13 @@
|
|
|
6288
6427
|
"output": 1.8
|
|
6289
6428
|
},
|
|
6290
6429
|
"openrouter/qwen/qwen3.6-27b": {
|
|
6291
|
-
"
|
|
6292
|
-
"
|
|
6293
|
-
"output": 2.0
|
|
6430
|
+
"input": 0.45,
|
|
6431
|
+
"output": 2.7
|
|
6294
6432
|
},
|
|
6295
6433
|
"openrouter/qwen/qwen3.6-35b-a3b": {
|
|
6296
|
-
"cache_read_input": 0.
|
|
6434
|
+
"cache_read_input": 0.025,
|
|
6297
6435
|
"input": 0.1,
|
|
6298
|
-
"output": 0.
|
|
6436
|
+
"output": 0.9
|
|
6299
6437
|
},
|
|
6300
6438
|
"openrouter/qwen/qwen3.6-flash": {
|
|
6301
6439
|
"cache_write_input": 0.234375,
|
|
@@ -6345,9 +6483,9 @@
|
|
|
6345
6483
|
"output": 6.0
|
|
6346
6484
|
},
|
|
6347
6485
|
"openrouter/qwen/qwen3.8-27b": {
|
|
6348
|
-
"cache_read_input": 0.
|
|
6349
|
-
"input": 0.
|
|
6350
|
-
"output":
|
|
6486
|
+
"cache_read_input": 0.0039,
|
|
6487
|
+
"input": 0.039,
|
|
6488
|
+
"output": 1.25
|
|
6351
6489
|
},
|
|
6352
6490
|
"openrouter/qwen/qwen3.8-flash": {
|
|
6353
6491
|
"cache_read_input": 0.016,
|
|
@@ -6628,14 +6766,14 @@
|
|
|
6628
6766
|
"output": 3.0
|
|
6629
6767
|
},
|
|
6630
6768
|
"openrouter/xiaomi/mimo-v2.5": {
|
|
6631
|
-
"cache_read_input": 0.
|
|
6632
|
-
"input": 0.
|
|
6633
|
-
"output": 0
|
|
6769
|
+
"cache_read_input": 0.08,
|
|
6770
|
+
"input": 0.4,
|
|
6771
|
+
"output": 2.0
|
|
6634
6772
|
},
|
|
6635
6773
|
"openrouter/xiaomi/mimo-v2.5-pro": {
|
|
6636
|
-
"cache_read_input": 0.
|
|
6637
|
-
"input": 0.
|
|
6638
|
-
"output":
|
|
6774
|
+
"cache_read_input": 0.096,
|
|
6775
|
+
"input": 0.48,
|
|
6776
|
+
"output": 1.8
|
|
6639
6777
|
},
|
|
6640
6778
|
"openrouter/xiaomi/mimo-v2.6-flash": {
|
|
6641
6779
|
"cache_read_input": 0.0028,
|
|
@@ -6706,8 +6844,8 @@
|
|
|
6706
6844
|
"output": 4.4
|
|
6707
6845
|
},
|
|
6708
6846
|
"openrouter/z-ai/glm-5.2": {
|
|
6709
|
-
"cache_read_input": 0.
|
|
6710
|
-
"input": 0.
|
|
6847
|
+
"cache_read_input": 0.013,
|
|
6848
|
+
"input": 0.014,
|
|
6711
6849
|
"output": 7.0
|
|
6712
6850
|
},
|
|
6713
6851
|
"openrouter/z-ai/glm-5.2:batch": {
|
|
@@ -6716,8 +6854,8 @@
|
|
|
6716
6854
|
"output": 2.2
|
|
6717
6855
|
},
|
|
6718
6856
|
"openrouter/z-ai/glm-5.3": {
|
|
6719
|
-
"cache_read_input": 0.
|
|
6720
|
-
"input": 0.
|
|
6857
|
+
"cache_read_input": 0.0689,
|
|
6858
|
+
"input": 0.0699,
|
|
6721
6859
|
"output": 1.4
|
|
6722
6860
|
},
|
|
6723
6861
|
"openrouter/z-ai/glm-5.3-flash": {
|
|
@@ -8,7 +8,7 @@ module LlmCostTracker
|
|
|
8
8
|
include StreamParser
|
|
9
9
|
|
|
10
10
|
TRACKED_ENDPOINTS = %w[
|
|
11
|
-
chat/completions completions embeddings moderations responses responses/compact
|
|
11
|
+
chat/completions completions decisions embeddings moderations responses responses/compact
|
|
12
12
|
audio/transcriptions audio/translations audio/speech
|
|
13
13
|
images/generations images/edits images/variations
|
|
14
14
|
].freeze
|
|
@@ -14,6 +14,7 @@ module LlmCostTracker
|
|
|
14
14
|
PENDING_STATUSES = %w[queued in_progress].freeze
|
|
15
15
|
RETRIEVE_PATH_PATTERN = %r{/(?:responses|agent)/resp_}
|
|
16
16
|
TRANSCRIPTION_PATH_PATTERN = %r{/audio/(?:transcriptions|translations)\z}
|
|
17
|
+
UNBILLED_DECISION_USAGE = %i[output_tokens output_tokens_details total_tokens].freeze
|
|
17
18
|
|
|
18
19
|
class << self
|
|
19
20
|
def included(base) = base.include(StreamParser)
|
|
@@ -29,7 +30,7 @@ module LlmCostTracker
|
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def event_from_response(response:, request:, provider:, host:, usage_source:, pricing_mode: nil)
|
|
32
|
-
usage = response
|
|
33
|
+
usage = billed_usage(response, provider)
|
|
33
34
|
return nil if usage.nil? || pending?(response)
|
|
34
35
|
|
|
35
36
|
model = response["model"] || request["model"]
|
|
@@ -73,6 +74,15 @@ module LlmCostTracker
|
|
|
73
74
|
def pending?(response)
|
|
74
75
|
PENDING_STATUSES.include?(response["status"].to_s)
|
|
75
76
|
end
|
|
77
|
+
|
|
78
|
+
def billed_usage(response, provider)
|
|
79
|
+
usage = response["usage"]&.deep_symbolize_keys
|
|
80
|
+
return usage unless usage && decision?(response, provider)
|
|
81
|
+
|
|
82
|
+
usage.except(*UNBILLED_DECISION_USAGE)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def decision?(response, provider) = provider.to_s == "openai" && response.key?("answers")
|
|
76
86
|
end
|
|
77
87
|
|
|
78
88
|
def parse(request_url:, request_body:, response_status:, response_body:, **)
|