package chatoyant
Build not yet checked sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
OCaml-first LLM SDK with Melange-generated JavaScript
Install
dune-project
Dependency
Authors
Maintainers
Sources
chatoyant-v0.19.2.tbz
sha256=1db9f9013e4598484347097646c00f09c3a438c2c7bc752d4ad0b0a7a86af3d4
sha512=fa1c09b16414b4858f26bbcd23e46041d318494b821c4262492056783eaedb4676f0d13dd807009533a0ae577ad23f5a9e9d0c73a88cd7f5bf926326583b49b6
doc/src/chatoyant.tokens/pricing.ml.html
Source file pricing.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336let p ?cached ?cache_write_5m ?cache_write_1h ?per_image ?per_second ~input ~output () = Cost.pricing ?cached_per_million:cached ?cache_write_per_million:cache_write_5m ?cache_write_1h_per_million:cache_write_1h ?per_image ?per_second ~input_per_million:input ~output_per_million:output () let all = [ (* OpenAI bills >272K input at a higher long-context tier not modelled here. *) ("gpt-6-cyber", p ~input:20.0 ~output:100.0 ~cached:2.0 ()); (* OpenAI short-context Standard rates. Law and Healthcare configuration promotional pricing is available at least through 2026-12-31. *) ("gpt-6.2-astra", p ~input:8.0 ~output:40.0 ~cached:0.4 ()); ("gpt-6.2-astra-healthcare", p ~input:8.0 ~output:40.0 ~cached:0.4 ()); ("gpt-6.2-sol", p ~input:2.0 ~output:10.0 ~cached:0.1 ()); ("gpt-6.2-sol-healthcare", p ~input:2.0 ~output:10.0 ~cached:0.1 ()); ("gpt-6.2-astra-law", p ~input:8.0 ~output:40.0 ~cached:0.4 ()); ("gpt-6-astra", p ~input:10.0 ~output:50.0 ~cached:1.0 ()); ("gpt-6-astra-healthcare", p ~input:10.0 ~output:50.0 ~cached:1.0 ()); ("gpt-6-astra-law", p ~input:10.0 ~output:50.0 ~cached:1.0 ()); ("gpt-6-rosalind", p ~input:15.0 ~output:75.0 ~cached:1.5 ()); ("gpt-rosalind-research", p ~input:5.0 ~output:25.0 ~cached:0.5 ()); ("gpt-rosalind-discovery", p ~input:5.0 ~output:25.0 ~cached:0.5 ()); ("gpt-6.1-terra", p ~input:1.0 ~output:5.0 ~cached:0.05 ()); ("gpt-6.1-sol", p ~input:2.0 ~output:10.0 ~cached:0.1 ()); ("gpt-6.1-sol-healthcare", p ~input:2.0 ~output:10.0 ~cached:0.1 ()); ("gpt-6-sol", p ~input:2.0 ~output:10.0 ~cached:0.2 ()); ("gpt-6-luna", p ~input:0.1 ~output:0.5 ~cached:0.01 ()); ("gpt-5.6-cyber", p ~input:12.5 ~output:75.0 ~cached:1.25 ()); ("gpt-5.5-cyber", p ~input:12.5 ~output:75.0 ~cached:1.25 ()); ("gpt-5.5-cyber-preview", p ~input:12.5 ~output:75.0 ~cached:1.25 ()); ("gpt-5.3-codex", p ~input:1.75 ~output:14.0 ~cached:0.175 ()); ("chat-latest", p ~input:5.0 ~output:30.0 ~cached:0.5 ()); ("gpt-5-search-api", p ~input:1.25 ~output:10.0 ~cached:0.125 ()); ( "claude-fable-5-2", p ~input:8.0 ~output:40.0 ~cached:0.2 ~cache_write_5m:10.0 ~cache_write_1h:16.0 () ); ( "claude-mythos-5-2", p ~input:8.0 ~output:40.0 ~cached:0.2 ~cache_write_5m:10.0 ~cache_write_1h:16.0 () ); ( "claude-fable-5-1", p ~input:10.0 ~output:50.0 ~cached:0.25 ~cache_write_5m:12.5 ~cache_write_1h:20.0 () ); ( "claude-mythos-5-1", p ~input:10.0 ~output:50.0 ~cached:0.25 ~cache_write_5m:12.5 ~cache_write_1h:20.0 () ); ( "claude-opus-5-5", p ~input:4.0 ~output:20.0 ~cached:0.2 ~cache_write_5m:5.0 ~cache_write_1h:8.0 () ); ( "claude-opus-5", p ~input:5.0 ~output:25.0 ~cached:0.5 ~cache_write_5m:6.25 ~cache_write_1h:10.0 () ); ( "claude-sonnet-5-5", p ~input:2.0 ~output:10.0 ~cached:0.1 ~cache_write_5m:2.5 ~cache_write_1h:4.0 () ); (* Prompts >100K tokens bill 0.50/2.50/0.05/0.625/1, not modelled. *) ( "claude-haiku-5-5", p ~input:0.1 ~output:0.5 ~cached:0.01 ~cache_write_5m:0.125 ~cache_write_1h:0.2 () ); ("grok-4.7", p ~input:2.0 ~output:6.0 ~cached:0.5 ()); ("grok-4.6", p ~input:2.0 ~output:6.0 ~cached:0.5 ()); (* >=200K prompt tokens bill 2x, not modelled. *) ("grok-build-0.1", p ~input:1.0 ~output:2.0 ~cached:0.2 ()); ("muse-spark-1.3", p ~input:1.25 ~output:4.25 ~cached:0.15 ()); ("muse-spark-1.3-contributor", p ~input:0.1 ~output:0.2 ~cached:0.002 ()); (* >200K input (including cached tokens) bills 0.30/1.50/0.012, not modelled. *) ("muse-ember-1.0", p ~input:0.1 ~output:0.5 ~cached:0.004 ()); ("muse-wonder-1.0", p ~input:4.0 ~output:20.0 ~cached:0.2 ()); ("grok-imagine-image-2.0", p ~input:0.0 ~output:0.0 ~per_image:0.04 ()); ("grok-imagine-image-quality", p ~input:0.0 ~output:0.0 ~per_image:0.04 ()); ("grok-imagine-video-1.5", p ~input:0.0 ~output:0.0 ~per_second:0.08 ()); ("grok-imagine-video-1.5-lite", p ~input:0.0 ~output:0.0 ~per_second:0.02 ()); ("gpt-5.6-sol", p ~input:5.0 ~output:30.0 ~cached:0.5 ()); ("gpt-5.6-terra", p ~input:2.0 ~output:12.0 ~cached:0.2 ()); ("gpt-5.6-luna", p ~input:0.2 ~output:1.2 ~cached:0.02 ()); ("gpt-5.5", p ~input:5.0 ~output:30.0 ~cached:0.5 ()); ("gpt-5.5-pro", p ~input:30.0 ~output:180.0 ()); ("gpt-5.4", p ~input:2.5 ~output:15.0 ~cached:0.25 ()); ("gpt-5.4-mini", p ~input:0.75 ~output:4.5 ~cached:0.075 ()); ("gpt-5.4-nano", p ~input:0.2 ~output:1.25 ~cached:0.02 ()); ("gpt-5.4-pro", p ~input:30.0 ~output:180.0 ()); ("gpt-5.2", p ~input:1.75 ~output:14.0 ~cached:0.175 ()); ("gpt-5.2-pro", p ~input:21.0 ~output:168.0 ()); ("gpt-5.2-codex", p ~input:1.75 ~output:14.0 ~cached:0.175 ()); ("gpt-5.1", p ~input:1.25 ~output:10.0 ~cached:0.125 ()); ("gpt-5.1-codex", p ~input:1.25 ~output:10.0 ~cached:0.125 ()); ("gpt-5.1-codex-max", p ~input:1.25 ~output:10.0 ~cached:0.125 ()); ("gpt-5.1-codex-mini", p ~input:0.25 ~output:2.0 ~cached:0.025 ()); ("gpt-5", p ~input:1.25 ~output:10.0 ~cached:0.125 ()); ("gpt-5-pro", p ~input:15.0 ~output:120.0 ()); ("gpt-5-mini", p ~input:0.25 ~output:2.0 ~cached:0.025 ()); ("gpt-5-nano", p ~input:0.05 ~output:0.4 ~cached:0.005 ()); ("gpt-5-codex", p ~input:1.25 ~output:10.0 ~cached:0.125 ()); ("gpt-5-image", p ~input:10.0 ~output:10.0 ~cached:1.25 ()); ("gpt-5-image-mini", p ~input:2.5 ~output:2.0 ~cached:0.25 ()); ("gpt-4o", p ~input:2.5 ~output:10.0 ~cached:1.25 ()); ("gpt-4o-2024-11-20", p ~input:2.5 ~output:10.0 ~cached:1.25 ()); ("gpt-4o-2024-08-06", p ~input:2.5 ~output:10.0 ~cached:1.25 ()); ("gpt-4o-2024-05-13", p ~input:5.0 ~output:15.0 ()); ("gpt-4o-mini", p ~input:0.15 ~output:0.6 ~cached:0.075 ()); ("gpt-4o-mini-2024-07-18", p ~input:0.15 ~output:0.6 ~cached:0.075 ()); ("gpt-4.1", p ~input:2.0 ~output:8.0 ~cached:0.5 ()); ("gpt-4.1-mini", p ~input:0.4 ~output:1.6 ~cached:0.1 ()); ("gpt-4.1-nano", p ~input:0.1 ~output:0.4 ~cached:0.025 ()); ("gpt-4-turbo", p ~input:10.0 ~output:30.0 ()); ("gpt-4-turbo-2024-04-09", p ~input:10.0 ~output:30.0 ()); ("gpt-4-turbo-preview", p ~input:5.0 ~output:15.0 ()); ("gpt-4", p ~input:30.0 ~output:60.0 ()); ("gpt-4-0613", p ~input:30.0 ~output:60.0 ()); ("gpt-4-32k", p ~input:60.0 ~output:120.0 ()); ("gpt-3.5-turbo", p ~input:0.5 ~output:1.5 ()); ("gpt-3.5-turbo-0125", p ~input:0.5 ~output:1.5 ()); ("gpt-3.5-turbo-16k", p ~input:3.0 ~output:4.0 ()); ("o1", p ~input:15.0 ~output:60.0 ~cached:7.5 ()); ("o1-2024-12-17", p ~input:15.0 ~output:60.0 ~cached:7.5 ()); ("o1-preview", p ~input:15.0 ~output:60.0 ()); ("o1-mini", p ~input:3.0 ~output:12.0 ()); ("o1-pro", p ~input:150.0 ~output:600.0 ()); ("o3", p ~input:2.0 ~output:8.0 ~cached:0.5 ()); ("o3-2025-04-16", p ~input:2.0 ~output:8.0 ~cached:0.5 ()); ("o3-mini", p ~input:1.1 ~output:4.4 ~cached:0.55 ()); ("o3-mini-2025-01-31", p ~input:1.1 ~output:4.4 ~cached:0.55 ()); ("o3-pro", p ~input:20.0 ~output:80.0 ()); ("o3-deep-research", p ~input:10.0 ~output:40.0 ~cached:2.5 ()); ("o4-mini", p ~input:1.1 ~output:4.4 ~cached:0.275 ()); ("o4-mini-deep-research", p ~input:2.0 ~output:8.0 ()); ("gpt-oss-120b", p ~input:0.039 ~output:0.19 ()); ("gpt-oss-20b", p ~input:0.03 ~output:0.14 ()); ("text-embedding-3-small", p ~input:0.02 ~output:0.0 ()); ("text-embedding-3-large", p ~input:0.13 ~output:0.0 ()); ("text-embedding-ada-002", p ~input:0.1 ~output:0.0 ()); ( "claude-fable-5", p ~input:10.0 ~output:50.0 ~cached:1.0 ~cache_write_5m:12.5 ~cache_write_1h:20.0 () ); ( "claude-mythos-5", p ~input:10.0 ~output:50.0 ~cached:1.0 ~cache_write_5m:12.5 ~cache_write_1h:20.0 () ); ( "claude-opus-4-8", p ~input:5.0 ~output:25.0 ~cached:0.5 ~cache_write_5m:6.25 ~cache_write_1h:10.0 () ); ( "claude-opus-4-7", p ~input:5.0 ~output:25.0 ~cached:0.5 ~cache_write_5m:6.25 ~cache_write_1h:10.0 () ); (* Standard price, including the former introductory discount. *) ( "claude-sonnet-5", p ~input:2.0 ~output:10.0 ~cached:0.2 ~cache_write_5m:2.5 ~cache_write_1h:4.0 () ); ( "claude-opus-4-6", p ~input:5.0 ~output:25.0 ~cached:0.5 ~cache_write_5m:6.25 ~cache_write_1h:10.0 () ); ( "claude-sonnet-4-6", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-opus-4-5-20251101", p ~input:5.0 ~output:25.0 ~cached:0.5 ~cache_write_5m:6.25 ~cache_write_1h:10.0 () ); ( "claude-opus-4-5", p ~input:5.0 ~output:25.0 ~cached:0.5 ~cache_write_5m:6.25 ~cache_write_1h:10.0 () ); ( "claude-sonnet-4-5-20250929", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-sonnet-4-5", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-haiku-4-5-20251001", p ~input:1.0 ~output:5.0 ~cached:0.1 ~cache_write_5m:1.25 ~cache_write_1h:2.0 () ); ( "claude-haiku-4-5", p ~input:1.0 ~output:5.0 ~cached:0.1 ~cache_write_5m:1.25 ~cache_write_1h:2.0 () ); (* retired on the provider's first-party API as of 2026-10; kept so existing ids still resolve *) ( "claude-opus-4-1-20250805", p ~input:15.0 ~output:75.0 ~cached:1.5 ~cache_write_5m:18.75 ~cache_write_1h:30.0 () ); ( "claude-opus-4-1", p ~input:15.0 ~output:75.0 ~cached:1.5 ~cache_write_5m:18.75 ~cache_write_1h:30.0 () ); ( "claude-sonnet-4-20250514", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-sonnet-4-0", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-opus-4-20250514", p ~input:15.0 ~output:75.0 ~cached:1.5 ~cache_write_5m:18.75 ~cache_write_1h:30.0 () ); ( "claude-opus-4-0", p ~input:15.0 ~output:75.0 ~cached:1.5 ~cache_write_5m:18.75 ~cache_write_1h:30.0 () ); ( "claude-3-5-sonnet-20241022", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-3-5-sonnet-20240620", p ~input:3.0 ~output:15.0 ~cached:0.3 ~cache_write_5m:3.75 ~cache_write_1h:6.0 () ); ( "claude-3-5-haiku-20241022", p ~input:0.8 ~output:4.0 ~cached:0.08 ~cache_write_5m:1.0 ~cache_write_1h:1.6 () ); ( "claude-3-opus-20240229", p ~input:15.0 ~output:75.0 ~cached:1.5 ~cache_write_5m:18.75 ~cache_write_1h:30.0 () ); ( "claude-3-haiku-20240307", p ~input:0.25 ~output:1.25 ~cached:0.03 ~cache_write_5m:0.3 ~cache_write_1h:0.5 () ); ("muse-spark-1.2", p ~input:1.25 ~output:4.25 ~cached:0.15 ()); ("muse-spark-1.1", p ~input:1.25 ~output:4.25 ~cached:0.15 ()); ("muse-spark-1.2-contributor", p ~input:0.1 ~output:0.2 ~cached:0.002 ()); ("grok-4.5", p ~input:2.0 ~output:6.0 ~cached:0.3 ()); ("grok-4.3", p ~input:1.25 ~output:2.5 ~cached:0.2 ()); ("grok-4.20-0309-reasoning", p ~input:1.25 ~output:2.5 ~cached:0.2 ()); ("grok-4.20-0309-non-reasoning", p ~input:1.25 ~output:2.5 ~cached:0.2 ()); ("grok-4.20-multi-agent-0309", p ~input:1.25 ~output:2.5 ~cached:0.2 ()); (* retired on the provider's first-party API as of 2026-10; kept so existing ids still resolve *) ("grok-4-1-fast-reasoning", p ~input:0.2 ~output:0.5 ~cached:0.05 ()); ("grok-4-1-fast-non-reasoning", p ~input:0.2 ~output:0.5 ~cached:0.05 ()); ("grok-4-fast-reasoning", p ~input:0.2 ~output:0.5 ~cached:0.05 ()); ("grok-4-fast-non-reasoning", p ~input:0.2 ~output:0.5 ~cached:0.05 ()); ("grok-4-0709", p ~input:3.0 ~output:15.0 ~cached:0.75 ()); ("grok-4", p ~input:3.0 ~output:15.0 ~cached:0.75 ()); ("grok-code-fast-1", p ~input:0.2 ~output:1.5 ~cached:0.02 ()); ("grok-3", p ~input:3.0 ~output:15.0 ~cached:0.75 ()); ("grok-3-mini", p ~input:0.3 ~output:0.5 ~cached:0.07 ()); ("grok-2-vision-1212", p ~input:2.0 ~output:10.0 ()); ("grok-imagine-image", p ~input:0.0 ~output:0.0 ~per_image:0.02 ()); ("grok-imagine-image-pro", p ~input:0.0 ~output:0.0 ~per_image:0.04 ()); ("grok-imagine-video", p ~input:0.0 ~output:0.0 ~per_second:0.05 ()); ("grok-embedding-1", p ~input:0.0 ~output:0.0 ()); ] let starts_with ~prefix value = let prefix_len = String.length prefix in String.length value >= prefix_len && String.sub value 0 prefix_len = prefix let contains text needle = let needle_len = String.length needle in let text_len = String.length text in let rec loop index = if needle_len = 0 then true else if index + needle_len > text_len then false else if String.sub text index needle_len = needle then true else loop (index + 1) in loop 0 let family_model model = let lower = String.lowercase_ascii model in if starts_with ~prefix:"claude" lower && (contains lower "fable" || contains lower "mythos") then Some "claude-fable-5-1" else if starts_with ~prefix:"claude" lower && contains lower "opus" then Some "claude-opus-5-5" else if starts_with ~prefix:"claude" lower && contains lower "sonnet" then Some "claude-sonnet-5-5" else if starts_with ~prefix:"claude" lower && contains lower "haiku" then Some "claude-haiku-5-5" else if starts_with ~prefix:"gpt-" lower && contains lower "-nano" then Some "gpt-5.4-nano" else if starts_with ~prefix:"gpt-" lower && contains lower "-mini" then Some "gpt-5.4-mini" else if starts_with ~prefix:"gpt-" lower && contains lower "-pro" then Some "gpt-5.4-pro" else if starts_with ~prefix:"gpt-" lower && contains lower "-codex" then Some "gpt-5.2-codex" else if starts_with ~prefix:"gpt-6" lower then Some "gpt-6.1-sol" else if starts_with ~prefix:"gpt-4o" lower then Some "gpt-4o" else if starts_with ~prefix:"gpt-" lower then Some "gpt-5.4" else if starts_with ~prefix:"o" lower && contains lower "-mini" then Some "o4-mini" else if starts_with ~prefix:"o" lower && contains lower "-pro" then Some "o3-pro" else if starts_with ~prefix:"o" lower then Some "o3" else if starts_with ~prefix:"grok-4.20" lower then Some "grok-4.20-0309-reasoning" else if starts_with ~prefix:"grok-" lower && contains lower "fast-reasoning" then Some "grok-4-1-fast-reasoning" else if starts_with ~prefix:"grok-" lower && contains lower "fast-non-reasoning" then Some "grok-4-1-fast-non-reasoning" else if starts_with ~prefix:"grok-" lower && contains lower "mini" then Some "grok-3-mini" else if starts_with ~prefix:"grok-" lower && contains lower "code" then Some "grok-code-fast-1" else if starts_with ~prefix:"grok-imagine-image-quality" lower then Some "grok-imagine-image-quality" else if starts_with ~prefix:"grok-imagine-image-2.0" lower then Some "grok-imagine-image-2.0" else if starts_with ~prefix:"grok-imagine-video-1.5-lite" lower then Some "grok-imagine-video-1.5-lite" else if starts_with ~prefix:"grok-imagine-video-1.5" lower then Some "grok-imagine-video-1.5" else if starts_with ~prefix:"grok-imagine-image-pro" lower then Some "grok-imagine-image-pro" else if starts_with ~prefix:"grok-imagine-image" lower then Some "grok-imagine-image" else if starts_with ~prefix:"grok-imagine-video" lower then Some "grok-imagine-video" else if starts_with ~prefix:"grok-" lower then Some "grok-4.7" else if starts_with ~prefix:"chatgpt" lower then Some "o1-pro" else if starts_with ~prefix:"muse-wonder" lower then Some "muse-wonder-1.0" else if starts_with ~prefix:"muse-spark" lower then Some (if contains lower "contributor" then "muse-spark-1.3-contributor" else "muse-spark-1.3") else None let provider_max_model model = let lower = String.lowercase_ascii model in if starts_with ~prefix:"claude" lower then Some "claude-opus-4-1" else if starts_with ~prefix:"gpt-" lower || starts_with ~prefix:"chatgpt" lower || starts_with ~prefix:"o" lower then Some "o1-pro" else if starts_with ~prefix:"grok" lower then Some "grok-4-0709" else None let get ?fallback model = match List.assoc_opt model all with | Some pricing -> Some pricing | None -> ( match Option.bind (family_model model) (fun model -> List.assoc_opt model all) with | Some _ as pricing -> pricing | None -> ( match Option.bind (provider_max_model model) (fun model -> List.assoc_opt model all) with | Some _ as pricing -> pricing | None -> fallback)) let has model = Option.is_some (List.assoc_opt model all)
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>