|
23 | 23 | "description": "Maximum output token size in tokens (e.g., 4096, 8192), null when undocumented" |
24 | 24 | }, |
25 | 25 | "tokenPricing": { |
26 | | - "type": "object", |
27 | | - "description": "Token-based pricing information for API usage (in $/M tokens)", |
28 | | - "properties": { |
29 | | - "input": { |
30 | | - "type": ["number", "null"], |
31 | | - "description": "Input token pricing in USD per million tokens, null when unavailable or not representable as a single USD rate" |
32 | | - }, |
33 | | - "output": { |
34 | | - "type": ["number", "null"], |
35 | | - "description": "Output token pricing in USD per million tokens, null when unavailable or not representable as a single USD rate" |
36 | | - }, |
37 | | - "cache": { |
38 | | - "type": ["number", "null"], |
39 | | - "description": "Cache token pricing in $/M tokens (e.g., 0.07 for $0.07/1M tokens, null if not applicable)" |
40 | | - } |
41 | | - }, |
42 | | - "required": ["input", "output", "cache"], |
43 | | - "additionalProperties": false |
| 26 | + "$ref": "#/$defs/tokenPricing" |
44 | 27 | }, |
45 | 28 | "releaseDate": { |
46 | 29 | "type": ["string", "null"], |
|
150 | 133 | "platformUrls" |
151 | 134 | ] |
152 | 135 | } |
153 | | - ] |
| 136 | + ], |
| 137 | + "$defs": { |
| 138 | + "tokenPricing": { |
| 139 | + "description": "First-party, pay-as-you-go standard API token pricing. Rates use the offer's native currency per million tokens.", |
| 140 | + "oneOf": [ |
| 141 | + { |
| 142 | + "type": "object", |
| 143 | + "properties": { |
| 144 | + "status": { |
| 145 | + "const": "available" |
| 146 | + }, |
| 147 | + "primaryOffer": { |
| 148 | + "type": "string", |
| 149 | + "pattern": "^[a-z0-9-]+$" |
| 150 | + }, |
| 151 | + "offers": { |
| 152 | + "type": "array", |
| 153 | + "items": { |
| 154 | + "$ref": "#/$defs/tokenPricingOffer" |
| 155 | + }, |
| 156 | + "minItems": 1, |
| 157 | + "uniqueItems": true |
| 158 | + } |
| 159 | + }, |
| 160 | + "required": ["status", "primaryOffer", "offers"], |
| 161 | + "additionalProperties": false |
| 162 | + }, |
| 163 | + { |
| 164 | + "type": "object", |
| 165 | + "properties": { |
| 166 | + "status": { |
| 167 | + "const": "not-applicable" |
| 168 | + }, |
| 169 | + "reason": { |
| 170 | + "type": "string", |
| 171 | + "enum": ["open-weights-only", "subscription-only"] |
| 172 | + }, |
| 173 | + "primaryOffer": { |
| 174 | + "type": "null" |
| 175 | + }, |
| 176 | + "offers": { |
| 177 | + "type": "array", |
| 178 | + "maxItems": 0 |
| 179 | + } |
| 180 | + }, |
| 181 | + "required": ["status", "reason", "primaryOffer", "offers"], |
| 182 | + "additionalProperties": false |
| 183 | + }, |
| 184 | + { |
| 185 | + "type": "object", |
| 186 | + "properties": { |
| 187 | + "status": { |
| 188 | + "const": "unavailable" |
| 189 | + }, |
| 190 | + "reason": { |
| 191 | + "type": "string", |
| 192 | + "enum": [ |
| 193 | + "official-price-not-published", |
| 194 | + "historical-price-unverified", |
| 195 | + "unsupported-pricing-structure" |
| 196 | + ] |
| 197 | + }, |
| 198 | + "primaryOffer": { |
| 199 | + "type": "null" |
| 200 | + }, |
| 201 | + "offers": { |
| 202 | + "type": "array", |
| 203 | + "maxItems": 0 |
| 204 | + } |
| 205 | + }, |
| 206 | + "required": ["status", "reason", "primaryOffer", "offers"], |
| 207 | + "additionalProperties": false |
| 208 | + } |
| 209 | + ] |
| 210 | + }, |
| 211 | + "tokenPricingOffer": { |
| 212 | + "type": "object", |
| 213 | + "description": "A first-party API pricing offer for one region and service tier.", |
| 214 | + "properties": { |
| 215 | + "id": { |
| 216 | + "type": "string", |
| 217 | + "pattern": "^[a-z0-9-]+$" |
| 218 | + }, |
| 219 | + "currency": { |
| 220 | + "type": "string", |
| 221 | + "pattern": "^[A-Z]{3}$", |
| 222 | + "description": "ISO 4217 currency code" |
| 223 | + }, |
| 224 | + "region": { |
| 225 | + "type": "string", |
| 226 | + "pattern": "^(global|[A-Z]{2})$", |
| 227 | + "description": "global or an ISO 3166-1 alpha-2 region code" |
| 228 | + }, |
| 229 | + "serviceTier": { |
| 230 | + "const": "standard" |
| 231 | + }, |
| 232 | + "effectiveFrom": { |
| 233 | + "type": ["string", "null"], |
| 234 | + "format": "date" |
| 235 | + }, |
| 236 | + "effectiveTo": { |
| 237 | + "type": ["string", "null"], |
| 238 | + "format": "date" |
| 239 | + }, |
| 240 | + "tiers": { |
| 241 | + "type": "array", |
| 242 | + "items": { |
| 243 | + "$ref": "#/$defs/tokenPricingTier" |
| 244 | + }, |
| 245 | + "minItems": 1, |
| 246 | + "uniqueItems": true |
| 247 | + } |
| 248 | + }, |
| 249 | + "required": [ |
| 250 | + "id", |
| 251 | + "currency", |
| 252 | + "region", |
| 253 | + "serviceTier", |
| 254 | + "effectiveFrom", |
| 255 | + "effectiveTo", |
| 256 | + "tiers" |
| 257 | + ], |
| 258 | + "additionalProperties": false |
| 259 | + }, |
| 260 | + "tokenPricingTier": { |
| 261 | + "type": "object", |
| 262 | + "properties": { |
| 263 | + "condition": { |
| 264 | + "oneOf": [ |
| 265 | + { |
| 266 | + "type": "null" |
| 267 | + }, |
| 268 | + { |
| 269 | + "$ref": "#/$defs/tokenPricingCondition" |
| 270 | + } |
| 271 | + ] |
| 272 | + }, |
| 273 | + "rates": { |
| 274 | + "$ref": "#/$defs/tokenPricingRates" |
| 275 | + } |
| 276 | + }, |
| 277 | + "required": ["condition", "rates"], |
| 278 | + "additionalProperties": false |
| 279 | + }, |
| 280 | + "tokenPricingCondition": { |
| 281 | + "type": "object", |
| 282 | + "properties": { |
| 283 | + "metric": { |
| 284 | + "type": "string", |
| 285 | + "enum": ["inputTokens", "contextTokens"] |
| 286 | + }, |
| 287 | + "min": { |
| 288 | + "type": ["number", "null"], |
| 289 | + "minimum": 0 |
| 290 | + }, |
| 291 | + "max": { |
| 292 | + "type": ["number", "null"], |
| 293 | + "minimum": 0 |
| 294 | + } |
| 295 | + }, |
| 296 | + "required": ["metric", "min", "max"], |
| 297 | + "additionalProperties": false |
| 298 | + }, |
| 299 | + "tokenPricingRates": { |
| 300 | + "type": "object", |
| 301 | + "properties": { |
| 302 | + "input": { |
| 303 | + "type": ["number", "null"], |
| 304 | + "minimum": 0 |
| 305 | + }, |
| 306 | + "output": { |
| 307 | + "type": ["number", "null"], |
| 308 | + "minimum": 0 |
| 309 | + }, |
| 310 | + "cacheRead": { |
| 311 | + "type": ["number", "null"], |
| 312 | + "minimum": 0 |
| 313 | + }, |
| 314 | + "cacheWrite": { |
| 315 | + "type": ["number", "null"], |
| 316 | + "minimum": 0 |
| 317 | + } |
| 318 | + }, |
| 319 | + "required": ["input", "output", "cacheRead", "cacheWrite"], |
| 320 | + "additionalProperties": false |
| 321 | + } |
| 322 | + } |
154 | 323 | } |
0 commit comments