active_harness_pricing 0.1.2 → 0.1.3
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/lib/active_harness/pricing/models_dev.rb +1 -1
- data/lib/active_harness/pricing.rb +12 -21
- data/lib/active_harness_pricing.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: f689ca4f8b7b527abbb2acda1b27f1204cf67df99ce45054f26a5039e8f4ee16
|
|
4
|
+
data.tar.gz: df4cfba2637bbcb51712f31e832dd541fbf5b1700d0a4095fb4a50e2e371ae8b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7837a3c69a2a7f70e8c97a5617820a7ee072ea1540c5a99cde473309a1ddd3103088768b4db079095fce26b0a74a47cdbca0c8b4cf66c58c9b34e72d1daec79c
|
|
7
|
+
data.tar.gz: 013d47bfe9231a842ca7ad09f6d3b181bfb253aa797be5027aad22c95a4d99ad2f8d2d1a02945c272a010c1fe6f508f515802e6bbd9b568bd9587a1a557b9191
|
|
@@ -9,7 +9,7 @@ module ActiveHarness
|
|
|
9
9
|
# Fallback pricing source — fetches model data from models.dev.
|
|
10
10
|
#
|
|
11
11
|
# Data source:
|
|
12
|
-
# {project_root}/tmp/active_harness/pricing_models_dev.json — fetched cache (
|
|
12
|
+
# {project_root}/tmp/active_harness/pricing_models_dev.json — fetched cache (72h TTL)
|
|
13
13
|
# Returns nil/empty if cache is missing and network is unavailable.
|
|
14
14
|
#
|
|
15
15
|
# Usage:
|
|
@@ -4,8 +4,8 @@ module ActiveHarness
|
|
|
4
4
|
# Pricing namespace — shared types and a facade over pricing source modules.
|
|
5
5
|
#
|
|
6
6
|
# Sources (in priority order):
|
|
7
|
-
# Pricing::OpenRouter — live data from OpenRouter API (
|
|
8
|
-
# Pricing::ModelsDev — live data from models.dev API (all providers,
|
|
7
|
+
# Pricing::OpenRouter — live data from OpenRouter API (all modalities, 72h cache)
|
|
8
|
+
# Pricing::ModelsDev — live data from models.dev API (all providers, 72h cache)
|
|
9
9
|
#
|
|
10
10
|
# Public facade delegates to ModelsDev (used as the general fallback):
|
|
11
11
|
# Pricing.find("gpt-4o") → ModelPrice or nil
|
|
@@ -102,11 +102,18 @@ module ActiveHarness
|
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
# ---------------------------------------------------------------------------
|
|
105
|
-
#
|
|
105
|
+
# Public facade
|
|
106
|
+
#
|
|
107
|
+
# ModelsDev is the general source — covers all major providers (openai,
|
|
108
|
+
# anthropic, gemini, …) and is the right default for provider-agnostic
|
|
109
|
+
# lookups. OpenRouter is a specialised source for OpenRouter-routed model
|
|
110
|
+
# IDs (e.g. "openai/gpt-4o") and is consulted separately where needed.
|
|
111
|
+
#
|
|
112
|
+
# preload! is the only method that touches both sources.
|
|
106
113
|
# ---------------------------------------------------------------------------
|
|
107
114
|
class << self
|
|
108
|
-
# Eagerly
|
|
109
|
-
# Called at Rails startup. Network failures are silently ignored.
|
|
115
|
+
# Eagerly load both pricing sources into memory.
|
|
116
|
+
# Called at Rails startup via Railtie. Network failures are silently ignored.
|
|
110
117
|
def preload!
|
|
111
118
|
ModelsDev.preload!
|
|
112
119
|
OpenRouter.preload!
|
|
@@ -131,22 +138,6 @@ module ActiveHarness
|
|
|
131
138
|
def provider_names
|
|
132
139
|
ModelsDev.provider_names
|
|
133
140
|
end
|
|
134
|
-
|
|
135
|
-
def update
|
|
136
|
-
ModelsDev.update
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def reload!
|
|
140
|
-
ModelsDev.reload!
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
def cache_file
|
|
144
|
-
ModelsDev.cache_file
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def available_providers
|
|
148
|
-
ModelsDev.available_providers
|
|
149
|
-
end
|
|
150
141
|
end
|
|
151
142
|
end
|
|
152
143
|
end
|