├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md ├── examples ├── completion.rs └── create-image.rs └── src ├── client └── mod.rs ├── completions └── mod.rs ├── error.rs ├── images └── mod.rs ├── lib.rs └── models └── mod.rs /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.22.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "atomic-waker" 22 | version = "1.1.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" 25 | 26 | [[package]] 27 | name = "autocfg" 28 | version = "1.3.0" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" 31 | 32 | [[package]] 33 | name = "backtrace" 34 | version = "0.3.73" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" 37 | dependencies = [ 38 | "addr2line", 39 | "cc", 40 | "cfg-if", 41 | "libc", 42 | "miniz_oxide", 43 | "object", 44 | "rustc-demangle", 45 | ] 46 | 47 | [[package]] 48 | name = "base64" 49 | version = "0.22.1" 50 | source = "registry+https://github.com/rust-lang/crates.io-index" 51 | checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 52 | 53 | [[package]] 54 | name = "bitflags" 55 | version = "1.3.2" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 58 | 59 | [[package]] 60 | name = "bitflags" 61 | version = "2.6.0" 62 | source = "registry+https://github.com/rust-lang/crates.io-index" 63 | checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" 64 | 65 | [[package]] 66 | name = "bumpalo" 67 | version = "3.16.0" 68 | source = "registry+https://github.com/rust-lang/crates.io-index" 69 | checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" 70 | 71 | [[package]] 72 | name = "bytes" 73 | version = "1.7.1" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" 76 | 77 | [[package]] 78 | name = "cc" 79 | version = "1.1.7" 80 | source = "registry+https://github.com/rust-lang/crates.io-index" 81 | checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" 82 | 83 | [[package]] 84 | name = "cfg-if" 85 | version = "1.0.0" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 88 | 89 | [[package]] 90 | name = "core-foundation" 91 | version = "0.9.4" 92 | source = "registry+https://github.com/rust-lang/crates.io-index" 93 | checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" 94 | dependencies = [ 95 | "core-foundation-sys", 96 | "libc", 97 | ] 98 | 99 | [[package]] 100 | name = "core-foundation-sys" 101 | version = "0.8.6" 102 | source = "registry+https://github.com/rust-lang/crates.io-index" 103 | checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" 104 | 105 | [[package]] 106 | name = "encoding_rs" 107 | version = "0.8.34" 108 | source = "registry+https://github.com/rust-lang/crates.io-index" 109 | checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" 110 | dependencies = [ 111 | "cfg-if", 112 | ] 113 | 114 | [[package]] 115 | name = "equivalent" 116 | version = "1.0.1" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 119 | 120 | [[package]] 121 | name = "errno" 122 | version = "0.3.9" 123 | source = "registry+https://github.com/rust-lang/crates.io-index" 124 | checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" 125 | dependencies = [ 126 | "libc", 127 | "windows-sys 0.52.0", 128 | ] 129 | 130 | [[package]] 131 | name = "fastrand" 132 | version = "2.1.0" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" 135 | 136 | [[package]] 137 | name = "fnv" 138 | version = "1.0.7" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 141 | 142 | [[package]] 143 | name = "foreign-types" 144 | version = "0.3.2" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 147 | dependencies = [ 148 | "foreign-types-shared", 149 | ] 150 | 151 | [[package]] 152 | name = "foreign-types-shared" 153 | version = "0.1.1" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 156 | 157 | [[package]] 158 | name = "form_urlencoded" 159 | version = "1.2.1" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" 162 | dependencies = [ 163 | "percent-encoding", 164 | ] 165 | 166 | [[package]] 167 | name = "futures-channel" 168 | version = "0.3.30" 169 | source = "registry+https://github.com/rust-lang/crates.io-index" 170 | checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" 171 | dependencies = [ 172 | "futures-core", 173 | ] 174 | 175 | [[package]] 176 | name = "futures-core" 177 | version = "0.3.30" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" 180 | 181 | [[package]] 182 | name = "futures-sink" 183 | version = "0.3.30" 184 | source = "registry+https://github.com/rust-lang/crates.io-index" 185 | checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" 186 | 187 | [[package]] 188 | name = "futures-task" 189 | version = "0.3.30" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" 192 | 193 | [[package]] 194 | name = "futures-util" 195 | version = "0.3.30" 196 | source = "registry+https://github.com/rust-lang/crates.io-index" 197 | checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" 198 | dependencies = [ 199 | "futures-core", 200 | "futures-task", 201 | "pin-project-lite", 202 | "pin-utils", 203 | ] 204 | 205 | [[package]] 206 | name = "getrandom" 207 | version = "0.2.15" 208 | source = "registry+https://github.com/rust-lang/crates.io-index" 209 | checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" 210 | dependencies = [ 211 | "cfg-if", 212 | "libc", 213 | "wasi", 214 | ] 215 | 216 | [[package]] 217 | name = "gimli" 218 | version = "0.29.0" 219 | source = "registry+https://github.com/rust-lang/crates.io-index" 220 | checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" 221 | 222 | [[package]] 223 | name = "h2" 224 | version = "0.4.5" 225 | source = "registry+https://github.com/rust-lang/crates.io-index" 226 | checksum = "fa82e28a107a8cc405f0839610bdc9b15f1e25ec7d696aa5cf173edbcb1486ab" 227 | dependencies = [ 228 | "atomic-waker", 229 | "bytes", 230 | "fnv", 231 | "futures-core", 232 | "futures-sink", 233 | "http", 234 | "indexmap", 235 | "slab", 236 | "tokio", 237 | "tokio-util", 238 | "tracing", 239 | ] 240 | 241 | [[package]] 242 | name = "hashbrown" 243 | version = "0.14.5" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" 246 | 247 | [[package]] 248 | name = "hermit-abi" 249 | version = "0.3.9" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" 252 | 253 | [[package]] 254 | name = "http" 255 | version = "1.1.0" 256 | source = "registry+https://github.com/rust-lang/crates.io-index" 257 | checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" 258 | dependencies = [ 259 | "bytes", 260 | "fnv", 261 | "itoa", 262 | ] 263 | 264 | [[package]] 265 | name = "http-body" 266 | version = "1.0.1" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" 269 | dependencies = [ 270 | "bytes", 271 | "http", 272 | ] 273 | 274 | [[package]] 275 | name = "http-body-util" 276 | version = "0.1.2" 277 | source = "registry+https://github.com/rust-lang/crates.io-index" 278 | checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" 279 | dependencies = [ 280 | "bytes", 281 | "futures-util", 282 | "http", 283 | "http-body", 284 | "pin-project-lite", 285 | ] 286 | 287 | [[package]] 288 | name = "httparse" 289 | version = "1.9.4" 290 | source = "registry+https://github.com/rust-lang/crates.io-index" 291 | checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" 292 | 293 | [[package]] 294 | name = "hyper" 295 | version = "1.4.1" 296 | source = "registry+https://github.com/rust-lang/crates.io-index" 297 | checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" 298 | dependencies = [ 299 | "bytes", 300 | "futures-channel", 301 | "futures-util", 302 | "h2", 303 | "http", 304 | "http-body", 305 | "httparse", 306 | "itoa", 307 | "pin-project-lite", 308 | "smallvec", 309 | "tokio", 310 | "want", 311 | ] 312 | 313 | [[package]] 314 | name = "hyper-rustls" 315 | version = "0.27.2" 316 | source = "registry+https://github.com/rust-lang/crates.io-index" 317 | checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" 318 | dependencies = [ 319 | "futures-util", 320 | "http", 321 | "hyper", 322 | "hyper-util", 323 | "rustls", 324 | "rustls-pki-types", 325 | "tokio", 326 | "tokio-rustls", 327 | "tower-service", 328 | ] 329 | 330 | [[package]] 331 | name = "hyper-tls" 332 | version = "0.6.0" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" 335 | dependencies = [ 336 | "bytes", 337 | "http-body-util", 338 | "hyper", 339 | "hyper-util", 340 | "native-tls", 341 | "tokio", 342 | "tokio-native-tls", 343 | "tower-service", 344 | ] 345 | 346 | [[package]] 347 | name = "hyper-util" 348 | version = "0.1.6" 349 | source = "registry+https://github.com/rust-lang/crates.io-index" 350 | checksum = "3ab92f4f49ee4fb4f997c784b7a2e0fa70050211e0b6a287f898c3c9785ca956" 351 | dependencies = [ 352 | "bytes", 353 | "futures-channel", 354 | "futures-util", 355 | "http", 356 | "http-body", 357 | "hyper", 358 | "pin-project-lite", 359 | "socket2", 360 | "tokio", 361 | "tower", 362 | "tower-service", 363 | "tracing", 364 | ] 365 | 366 | [[package]] 367 | name = "idna" 368 | version = "0.5.0" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" 371 | dependencies = [ 372 | "unicode-bidi", 373 | "unicode-normalization", 374 | ] 375 | 376 | [[package]] 377 | name = "indexmap" 378 | version = "2.3.0" 379 | source = "registry+https://github.com/rust-lang/crates.io-index" 380 | checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" 381 | dependencies = [ 382 | "equivalent", 383 | "hashbrown", 384 | ] 385 | 386 | [[package]] 387 | name = "ipnet" 388 | version = "2.9.0" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" 391 | 392 | [[package]] 393 | name = "itoa" 394 | version = "1.0.11" 395 | source = "registry+https://github.com/rust-lang/crates.io-index" 396 | checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" 397 | 398 | [[package]] 399 | name = "js-sys" 400 | version = "0.3.69" 401 | source = "registry+https://github.com/rust-lang/crates.io-index" 402 | checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" 403 | dependencies = [ 404 | "wasm-bindgen", 405 | ] 406 | 407 | [[package]] 408 | name = "libc" 409 | version = "0.2.155" 410 | source = "registry+https://github.com/rust-lang/crates.io-index" 411 | checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" 412 | 413 | [[package]] 414 | name = "linux-raw-sys" 415 | version = "0.4.14" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" 418 | 419 | [[package]] 420 | name = "lock_api" 421 | version = "0.4.12" 422 | source = "registry+https://github.com/rust-lang/crates.io-index" 423 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" 424 | dependencies = [ 425 | "autocfg", 426 | "scopeguard", 427 | ] 428 | 429 | [[package]] 430 | name = "log" 431 | version = "0.4.22" 432 | source = "registry+https://github.com/rust-lang/crates.io-index" 433 | checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" 434 | 435 | [[package]] 436 | name = "memchr" 437 | version = "2.7.4" 438 | source = "registry+https://github.com/rust-lang/crates.io-index" 439 | checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" 440 | 441 | [[package]] 442 | name = "mime" 443 | version = "0.3.17" 444 | source = "registry+https://github.com/rust-lang/crates.io-index" 445 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 446 | 447 | [[package]] 448 | name = "miniz_oxide" 449 | version = "0.7.4" 450 | source = "registry+https://github.com/rust-lang/crates.io-index" 451 | checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" 452 | dependencies = [ 453 | "adler", 454 | ] 455 | 456 | [[package]] 457 | name = "mio" 458 | version = "1.0.1" 459 | source = "registry+https://github.com/rust-lang/crates.io-index" 460 | checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" 461 | dependencies = [ 462 | "hermit-abi", 463 | "libc", 464 | "wasi", 465 | "windows-sys 0.52.0", 466 | ] 467 | 468 | [[package]] 469 | name = "native-tls" 470 | version = "0.2.12" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" 473 | dependencies = [ 474 | "libc", 475 | "log", 476 | "openssl", 477 | "openssl-probe", 478 | "openssl-sys", 479 | "schannel", 480 | "security-framework", 481 | "security-framework-sys", 482 | "tempfile", 483 | ] 484 | 485 | [[package]] 486 | name = "object" 487 | version = "0.36.2" 488 | source = "registry+https://github.com/rust-lang/crates.io-index" 489 | checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" 490 | dependencies = [ 491 | "memchr", 492 | ] 493 | 494 | [[package]] 495 | name = "once_cell" 496 | version = "1.19.0" 497 | source = "registry+https://github.com/rust-lang/crates.io-index" 498 | checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" 499 | 500 | [[package]] 501 | name = "openairs" 502 | version = "0.2.2" 503 | dependencies = [ 504 | "reqwest", 505 | "serde", 506 | "serde_json", 507 | "thiserror", 508 | "tokio", 509 | ] 510 | 511 | [[package]] 512 | name = "openssl" 513 | version = "0.10.66" 514 | source = "registry+https://github.com/rust-lang/crates.io-index" 515 | checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" 516 | dependencies = [ 517 | "bitflags 2.6.0", 518 | "cfg-if", 519 | "foreign-types", 520 | "libc", 521 | "once_cell", 522 | "openssl-macros", 523 | "openssl-sys", 524 | ] 525 | 526 | [[package]] 527 | name = "openssl-macros" 528 | version = "0.1.1" 529 | source = "registry+https://github.com/rust-lang/crates.io-index" 530 | checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" 531 | dependencies = [ 532 | "proc-macro2", 533 | "quote", 534 | "syn", 535 | ] 536 | 537 | [[package]] 538 | name = "openssl-probe" 539 | version = "0.1.5" 540 | source = "registry+https://github.com/rust-lang/crates.io-index" 541 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 542 | 543 | [[package]] 544 | name = "openssl-sys" 545 | version = "0.9.103" 546 | source = "registry+https://github.com/rust-lang/crates.io-index" 547 | checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" 548 | dependencies = [ 549 | "cc", 550 | "libc", 551 | "pkg-config", 552 | "vcpkg", 553 | ] 554 | 555 | [[package]] 556 | name = "parking_lot" 557 | version = "0.12.3" 558 | source = "registry+https://github.com/rust-lang/crates.io-index" 559 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" 560 | dependencies = [ 561 | "lock_api", 562 | "parking_lot_core", 563 | ] 564 | 565 | [[package]] 566 | name = "parking_lot_core" 567 | version = "0.9.10" 568 | source = "registry+https://github.com/rust-lang/crates.io-index" 569 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" 570 | dependencies = [ 571 | "cfg-if", 572 | "libc", 573 | "redox_syscall", 574 | "smallvec", 575 | "windows-targets 0.52.6", 576 | ] 577 | 578 | [[package]] 579 | name = "percent-encoding" 580 | version = "2.3.1" 581 | source = "registry+https://github.com/rust-lang/crates.io-index" 582 | checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" 583 | 584 | [[package]] 585 | name = "pin-project" 586 | version = "1.1.5" 587 | source = "registry+https://github.com/rust-lang/crates.io-index" 588 | checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" 589 | dependencies = [ 590 | "pin-project-internal", 591 | ] 592 | 593 | [[package]] 594 | name = "pin-project-internal" 595 | version = "1.1.5" 596 | source = "registry+https://github.com/rust-lang/crates.io-index" 597 | checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" 598 | dependencies = [ 599 | "proc-macro2", 600 | "quote", 601 | "syn", 602 | ] 603 | 604 | [[package]] 605 | name = "pin-project-lite" 606 | version = "0.2.14" 607 | source = "registry+https://github.com/rust-lang/crates.io-index" 608 | checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" 609 | 610 | [[package]] 611 | name = "pin-utils" 612 | version = "0.1.0" 613 | source = "registry+https://github.com/rust-lang/crates.io-index" 614 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 615 | 616 | [[package]] 617 | name = "pkg-config" 618 | version = "0.3.30" 619 | source = "registry+https://github.com/rust-lang/crates.io-index" 620 | checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" 621 | 622 | [[package]] 623 | name = "proc-macro2" 624 | version = "1.0.86" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" 627 | dependencies = [ 628 | "unicode-ident", 629 | ] 630 | 631 | [[package]] 632 | name = "quote" 633 | version = "1.0.36" 634 | source = "registry+https://github.com/rust-lang/crates.io-index" 635 | checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" 636 | dependencies = [ 637 | "proc-macro2", 638 | ] 639 | 640 | [[package]] 641 | name = "redox_syscall" 642 | version = "0.5.3" 643 | source = "registry+https://github.com/rust-lang/crates.io-index" 644 | checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" 645 | dependencies = [ 646 | "bitflags 2.6.0", 647 | ] 648 | 649 | [[package]] 650 | name = "reqwest" 651 | version = "0.12.5" 652 | source = "registry+https://github.com/rust-lang/crates.io-index" 653 | checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" 654 | dependencies = [ 655 | "base64", 656 | "bytes", 657 | "encoding_rs", 658 | "futures-core", 659 | "futures-util", 660 | "h2", 661 | "http", 662 | "http-body", 663 | "http-body-util", 664 | "hyper", 665 | "hyper-rustls", 666 | "hyper-tls", 667 | "hyper-util", 668 | "ipnet", 669 | "js-sys", 670 | "log", 671 | "mime", 672 | "native-tls", 673 | "once_cell", 674 | "percent-encoding", 675 | "pin-project-lite", 676 | "rustls-pemfile", 677 | "serde", 678 | "serde_json", 679 | "serde_urlencoded", 680 | "sync_wrapper", 681 | "system-configuration", 682 | "tokio", 683 | "tokio-native-tls", 684 | "tower-service", 685 | "url", 686 | "wasm-bindgen", 687 | "wasm-bindgen-futures", 688 | "web-sys", 689 | "winreg", 690 | ] 691 | 692 | [[package]] 693 | name = "ring" 694 | version = "0.17.8" 695 | source = "registry+https://github.com/rust-lang/crates.io-index" 696 | checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" 697 | dependencies = [ 698 | "cc", 699 | "cfg-if", 700 | "getrandom", 701 | "libc", 702 | "spin", 703 | "untrusted", 704 | "windows-sys 0.52.0", 705 | ] 706 | 707 | [[package]] 708 | name = "rustc-demangle" 709 | version = "0.1.24" 710 | source = "registry+https://github.com/rust-lang/crates.io-index" 711 | checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" 712 | 713 | [[package]] 714 | name = "rustix" 715 | version = "0.38.34" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" 718 | dependencies = [ 719 | "bitflags 2.6.0", 720 | "errno", 721 | "libc", 722 | "linux-raw-sys", 723 | "windows-sys 0.52.0", 724 | ] 725 | 726 | [[package]] 727 | name = "rustls" 728 | version = "0.23.12" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" 731 | dependencies = [ 732 | "once_cell", 733 | "rustls-pki-types", 734 | "rustls-webpki", 735 | "subtle", 736 | "zeroize", 737 | ] 738 | 739 | [[package]] 740 | name = "rustls-pemfile" 741 | version = "2.1.3" 742 | source = "registry+https://github.com/rust-lang/crates.io-index" 743 | checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" 744 | dependencies = [ 745 | "base64", 746 | "rustls-pki-types", 747 | ] 748 | 749 | [[package]] 750 | name = "rustls-pki-types" 751 | version = "1.7.0" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" 754 | 755 | [[package]] 756 | name = "rustls-webpki" 757 | version = "0.102.6" 758 | source = "registry+https://github.com/rust-lang/crates.io-index" 759 | checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" 760 | dependencies = [ 761 | "ring", 762 | "rustls-pki-types", 763 | "untrusted", 764 | ] 765 | 766 | [[package]] 767 | name = "ryu" 768 | version = "1.0.18" 769 | source = "registry+https://github.com/rust-lang/crates.io-index" 770 | checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" 771 | 772 | [[package]] 773 | name = "schannel" 774 | version = "0.1.23" 775 | source = "registry+https://github.com/rust-lang/crates.io-index" 776 | checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" 777 | dependencies = [ 778 | "windows-sys 0.52.0", 779 | ] 780 | 781 | [[package]] 782 | name = "scopeguard" 783 | version = "1.2.0" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 786 | 787 | [[package]] 788 | name = "security-framework" 789 | version = "2.11.1" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" 792 | dependencies = [ 793 | "bitflags 2.6.0", 794 | "core-foundation", 795 | "core-foundation-sys", 796 | "libc", 797 | "security-framework-sys", 798 | ] 799 | 800 | [[package]] 801 | name = "security-framework-sys" 802 | version = "2.11.1" 803 | source = "registry+https://github.com/rust-lang/crates.io-index" 804 | checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" 805 | dependencies = [ 806 | "core-foundation-sys", 807 | "libc", 808 | ] 809 | 810 | [[package]] 811 | name = "serde" 812 | version = "1.0.204" 813 | source = "registry+https://github.com/rust-lang/crates.io-index" 814 | checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" 815 | dependencies = [ 816 | "serde_derive", 817 | ] 818 | 819 | [[package]] 820 | name = "serde_derive" 821 | version = "1.0.204" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" 824 | dependencies = [ 825 | "proc-macro2", 826 | "quote", 827 | "syn", 828 | ] 829 | 830 | [[package]] 831 | name = "serde_json" 832 | version = "1.0.122" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" 835 | dependencies = [ 836 | "itoa", 837 | "memchr", 838 | "ryu", 839 | "serde", 840 | ] 841 | 842 | [[package]] 843 | name = "serde_urlencoded" 844 | version = "0.7.1" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" 847 | dependencies = [ 848 | "form_urlencoded", 849 | "itoa", 850 | "ryu", 851 | "serde", 852 | ] 853 | 854 | [[package]] 855 | name = "signal-hook-registry" 856 | version = "1.4.2" 857 | source = "registry+https://github.com/rust-lang/crates.io-index" 858 | checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" 859 | dependencies = [ 860 | "libc", 861 | ] 862 | 863 | [[package]] 864 | name = "slab" 865 | version = "0.4.9" 866 | source = "registry+https://github.com/rust-lang/crates.io-index" 867 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 868 | dependencies = [ 869 | "autocfg", 870 | ] 871 | 872 | [[package]] 873 | name = "smallvec" 874 | version = "1.13.2" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" 877 | 878 | [[package]] 879 | name = "socket2" 880 | version = "0.5.7" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" 883 | dependencies = [ 884 | "libc", 885 | "windows-sys 0.52.0", 886 | ] 887 | 888 | [[package]] 889 | name = "spin" 890 | version = "0.9.8" 891 | source = "registry+https://github.com/rust-lang/crates.io-index" 892 | checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" 893 | 894 | [[package]] 895 | name = "subtle" 896 | version = "2.6.1" 897 | source = "registry+https://github.com/rust-lang/crates.io-index" 898 | checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" 899 | 900 | [[package]] 901 | name = "syn" 902 | version = "2.0.72" 903 | source = "registry+https://github.com/rust-lang/crates.io-index" 904 | checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" 905 | dependencies = [ 906 | "proc-macro2", 907 | "quote", 908 | "unicode-ident", 909 | ] 910 | 911 | [[package]] 912 | name = "sync_wrapper" 913 | version = "1.0.1" 914 | source = "registry+https://github.com/rust-lang/crates.io-index" 915 | checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" 916 | 917 | [[package]] 918 | name = "system-configuration" 919 | version = "0.5.1" 920 | source = "registry+https://github.com/rust-lang/crates.io-index" 921 | checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" 922 | dependencies = [ 923 | "bitflags 1.3.2", 924 | "core-foundation", 925 | "system-configuration-sys", 926 | ] 927 | 928 | [[package]] 929 | name = "system-configuration-sys" 930 | version = "0.5.0" 931 | source = "registry+https://github.com/rust-lang/crates.io-index" 932 | checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" 933 | dependencies = [ 934 | "core-foundation-sys", 935 | "libc", 936 | ] 937 | 938 | [[package]] 939 | name = "tempfile" 940 | version = "3.11.0" 941 | source = "registry+https://github.com/rust-lang/crates.io-index" 942 | checksum = "b8fcd239983515c23a32fb82099f97d0b11b8c72f654ed659363a95c3dad7a53" 943 | dependencies = [ 944 | "cfg-if", 945 | "fastrand", 946 | "once_cell", 947 | "rustix", 948 | "windows-sys 0.52.0", 949 | ] 950 | 951 | [[package]] 952 | name = "thiserror" 953 | version = "1.0.63" 954 | source = "registry+https://github.com/rust-lang/crates.io-index" 955 | checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" 956 | dependencies = [ 957 | "thiserror-impl", 958 | ] 959 | 960 | [[package]] 961 | name = "thiserror-impl" 962 | version = "1.0.63" 963 | source = "registry+https://github.com/rust-lang/crates.io-index" 964 | checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" 965 | dependencies = [ 966 | "proc-macro2", 967 | "quote", 968 | "syn", 969 | ] 970 | 971 | [[package]] 972 | name = "tinyvec" 973 | version = "1.8.0" 974 | source = "registry+https://github.com/rust-lang/crates.io-index" 975 | checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" 976 | dependencies = [ 977 | "tinyvec_macros", 978 | ] 979 | 980 | [[package]] 981 | name = "tinyvec_macros" 982 | version = "0.1.1" 983 | source = "registry+https://github.com/rust-lang/crates.io-index" 984 | checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 985 | 986 | [[package]] 987 | name = "tokio" 988 | version = "1.39.2" 989 | source = "registry+https://github.com/rust-lang/crates.io-index" 990 | checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" 991 | dependencies = [ 992 | "backtrace", 993 | "bytes", 994 | "libc", 995 | "mio", 996 | "parking_lot", 997 | "pin-project-lite", 998 | "signal-hook-registry", 999 | "socket2", 1000 | "tokio-macros", 1001 | "windows-sys 0.52.0", 1002 | ] 1003 | 1004 | [[package]] 1005 | name = "tokio-macros" 1006 | version = "2.4.0" 1007 | source = "registry+https://github.com/rust-lang/crates.io-index" 1008 | checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" 1009 | dependencies = [ 1010 | "proc-macro2", 1011 | "quote", 1012 | "syn", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "tokio-native-tls" 1017 | version = "0.3.1" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" 1020 | dependencies = [ 1021 | "native-tls", 1022 | "tokio", 1023 | ] 1024 | 1025 | [[package]] 1026 | name = "tokio-rustls" 1027 | version = "0.26.0" 1028 | source = "registry+https://github.com/rust-lang/crates.io-index" 1029 | checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" 1030 | dependencies = [ 1031 | "rustls", 1032 | "rustls-pki-types", 1033 | "tokio", 1034 | ] 1035 | 1036 | [[package]] 1037 | name = "tokio-util" 1038 | version = "0.7.11" 1039 | source = "registry+https://github.com/rust-lang/crates.io-index" 1040 | checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" 1041 | dependencies = [ 1042 | "bytes", 1043 | "futures-core", 1044 | "futures-sink", 1045 | "pin-project-lite", 1046 | "tokio", 1047 | ] 1048 | 1049 | [[package]] 1050 | name = "tower" 1051 | version = "0.4.13" 1052 | source = "registry+https://github.com/rust-lang/crates.io-index" 1053 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 1054 | dependencies = [ 1055 | "futures-core", 1056 | "futures-util", 1057 | "pin-project", 1058 | "pin-project-lite", 1059 | "tokio", 1060 | "tower-layer", 1061 | "tower-service", 1062 | ] 1063 | 1064 | [[package]] 1065 | name = "tower-layer" 1066 | version = "0.3.2" 1067 | source = "registry+https://github.com/rust-lang/crates.io-index" 1068 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 1069 | 1070 | [[package]] 1071 | name = "tower-service" 1072 | version = "0.3.2" 1073 | source = "registry+https://github.com/rust-lang/crates.io-index" 1074 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1075 | 1076 | [[package]] 1077 | name = "tracing" 1078 | version = "0.1.40" 1079 | source = "registry+https://github.com/rust-lang/crates.io-index" 1080 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 1081 | dependencies = [ 1082 | "pin-project-lite", 1083 | "tracing-core", 1084 | ] 1085 | 1086 | [[package]] 1087 | name = "tracing-core" 1088 | version = "0.1.32" 1089 | source = "registry+https://github.com/rust-lang/crates.io-index" 1090 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 1091 | dependencies = [ 1092 | "once_cell", 1093 | ] 1094 | 1095 | [[package]] 1096 | name = "try-lock" 1097 | version = "0.2.5" 1098 | source = "registry+https://github.com/rust-lang/crates.io-index" 1099 | checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" 1100 | 1101 | [[package]] 1102 | name = "unicode-bidi" 1103 | version = "0.3.15" 1104 | source = "registry+https://github.com/rust-lang/crates.io-index" 1105 | checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" 1106 | 1107 | [[package]] 1108 | name = "unicode-ident" 1109 | version = "1.0.12" 1110 | source = "registry+https://github.com/rust-lang/crates.io-index" 1111 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1112 | 1113 | [[package]] 1114 | name = "unicode-normalization" 1115 | version = "0.1.23" 1116 | source = "registry+https://github.com/rust-lang/crates.io-index" 1117 | checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" 1118 | dependencies = [ 1119 | "tinyvec", 1120 | ] 1121 | 1122 | [[package]] 1123 | name = "untrusted" 1124 | version = "0.9.0" 1125 | source = "registry+https://github.com/rust-lang/crates.io-index" 1126 | checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" 1127 | 1128 | [[package]] 1129 | name = "url" 1130 | version = "2.5.2" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" 1133 | dependencies = [ 1134 | "form_urlencoded", 1135 | "idna", 1136 | "percent-encoding", 1137 | ] 1138 | 1139 | [[package]] 1140 | name = "vcpkg" 1141 | version = "0.2.15" 1142 | source = "registry+https://github.com/rust-lang/crates.io-index" 1143 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1144 | 1145 | [[package]] 1146 | name = "want" 1147 | version = "0.3.1" 1148 | source = "registry+https://github.com/rust-lang/crates.io-index" 1149 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1150 | dependencies = [ 1151 | "try-lock", 1152 | ] 1153 | 1154 | [[package]] 1155 | name = "wasi" 1156 | version = "0.11.0+wasi-snapshot-preview1" 1157 | source = "registry+https://github.com/rust-lang/crates.io-index" 1158 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1159 | 1160 | [[package]] 1161 | name = "wasm-bindgen" 1162 | version = "0.2.92" 1163 | source = "registry+https://github.com/rust-lang/crates.io-index" 1164 | checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" 1165 | dependencies = [ 1166 | "cfg-if", 1167 | "wasm-bindgen-macro", 1168 | ] 1169 | 1170 | [[package]] 1171 | name = "wasm-bindgen-backend" 1172 | version = "0.2.92" 1173 | source = "registry+https://github.com/rust-lang/crates.io-index" 1174 | checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" 1175 | dependencies = [ 1176 | "bumpalo", 1177 | "log", 1178 | "once_cell", 1179 | "proc-macro2", 1180 | "quote", 1181 | "syn", 1182 | "wasm-bindgen-shared", 1183 | ] 1184 | 1185 | [[package]] 1186 | name = "wasm-bindgen-futures" 1187 | version = "0.4.42" 1188 | source = "registry+https://github.com/rust-lang/crates.io-index" 1189 | checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" 1190 | dependencies = [ 1191 | "cfg-if", 1192 | "js-sys", 1193 | "wasm-bindgen", 1194 | "web-sys", 1195 | ] 1196 | 1197 | [[package]] 1198 | name = "wasm-bindgen-macro" 1199 | version = "0.2.92" 1200 | source = "registry+https://github.com/rust-lang/crates.io-index" 1201 | checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" 1202 | dependencies = [ 1203 | "quote", 1204 | "wasm-bindgen-macro-support", 1205 | ] 1206 | 1207 | [[package]] 1208 | name = "wasm-bindgen-macro-support" 1209 | version = "0.2.92" 1210 | source = "registry+https://github.com/rust-lang/crates.io-index" 1211 | checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" 1212 | dependencies = [ 1213 | "proc-macro2", 1214 | "quote", 1215 | "syn", 1216 | "wasm-bindgen-backend", 1217 | "wasm-bindgen-shared", 1218 | ] 1219 | 1220 | [[package]] 1221 | name = "wasm-bindgen-shared" 1222 | version = "0.2.92" 1223 | source = "registry+https://github.com/rust-lang/crates.io-index" 1224 | checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" 1225 | 1226 | [[package]] 1227 | name = "web-sys" 1228 | version = "0.3.69" 1229 | source = "registry+https://github.com/rust-lang/crates.io-index" 1230 | checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" 1231 | dependencies = [ 1232 | "js-sys", 1233 | "wasm-bindgen", 1234 | ] 1235 | 1236 | [[package]] 1237 | name = "windows-sys" 1238 | version = "0.48.0" 1239 | source = "registry+https://github.com/rust-lang/crates.io-index" 1240 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1241 | dependencies = [ 1242 | "windows-targets 0.48.5", 1243 | ] 1244 | 1245 | [[package]] 1246 | name = "windows-sys" 1247 | version = "0.52.0" 1248 | source = "registry+https://github.com/rust-lang/crates.io-index" 1249 | checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 1250 | dependencies = [ 1251 | "windows-targets 0.52.6", 1252 | ] 1253 | 1254 | [[package]] 1255 | name = "windows-targets" 1256 | version = "0.48.5" 1257 | source = "registry+https://github.com/rust-lang/crates.io-index" 1258 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1259 | dependencies = [ 1260 | "windows_aarch64_gnullvm 0.48.5", 1261 | "windows_aarch64_msvc 0.48.5", 1262 | "windows_i686_gnu 0.48.5", 1263 | "windows_i686_msvc 0.48.5", 1264 | "windows_x86_64_gnu 0.48.5", 1265 | "windows_x86_64_gnullvm 0.48.5", 1266 | "windows_x86_64_msvc 0.48.5", 1267 | ] 1268 | 1269 | [[package]] 1270 | name = "windows-targets" 1271 | version = "0.52.6" 1272 | source = "registry+https://github.com/rust-lang/crates.io-index" 1273 | checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 1274 | dependencies = [ 1275 | "windows_aarch64_gnullvm 0.52.6", 1276 | "windows_aarch64_msvc 0.52.6", 1277 | "windows_i686_gnu 0.52.6", 1278 | "windows_i686_gnullvm", 1279 | "windows_i686_msvc 0.52.6", 1280 | "windows_x86_64_gnu 0.52.6", 1281 | "windows_x86_64_gnullvm 0.52.6", 1282 | "windows_x86_64_msvc 0.52.6", 1283 | ] 1284 | 1285 | [[package]] 1286 | name = "windows_aarch64_gnullvm" 1287 | version = "0.48.5" 1288 | source = "registry+https://github.com/rust-lang/crates.io-index" 1289 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1290 | 1291 | [[package]] 1292 | name = "windows_aarch64_gnullvm" 1293 | version = "0.52.6" 1294 | source = "registry+https://github.com/rust-lang/crates.io-index" 1295 | checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 1296 | 1297 | [[package]] 1298 | name = "windows_aarch64_msvc" 1299 | version = "0.48.5" 1300 | source = "registry+https://github.com/rust-lang/crates.io-index" 1301 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1302 | 1303 | [[package]] 1304 | name = "windows_aarch64_msvc" 1305 | version = "0.52.6" 1306 | source = "registry+https://github.com/rust-lang/crates.io-index" 1307 | checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 1308 | 1309 | [[package]] 1310 | name = "windows_i686_gnu" 1311 | version = "0.48.5" 1312 | source = "registry+https://github.com/rust-lang/crates.io-index" 1313 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1314 | 1315 | [[package]] 1316 | name = "windows_i686_gnu" 1317 | version = "0.52.6" 1318 | source = "registry+https://github.com/rust-lang/crates.io-index" 1319 | checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 1320 | 1321 | [[package]] 1322 | name = "windows_i686_gnullvm" 1323 | version = "0.52.6" 1324 | source = "registry+https://github.com/rust-lang/crates.io-index" 1325 | checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 1326 | 1327 | [[package]] 1328 | name = "windows_i686_msvc" 1329 | version = "0.48.5" 1330 | source = "registry+https://github.com/rust-lang/crates.io-index" 1331 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1332 | 1333 | [[package]] 1334 | name = "windows_i686_msvc" 1335 | version = "0.52.6" 1336 | source = "registry+https://github.com/rust-lang/crates.io-index" 1337 | checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 1338 | 1339 | [[package]] 1340 | name = "windows_x86_64_gnu" 1341 | version = "0.48.5" 1342 | source = "registry+https://github.com/rust-lang/crates.io-index" 1343 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1344 | 1345 | [[package]] 1346 | name = "windows_x86_64_gnu" 1347 | version = "0.52.6" 1348 | source = "registry+https://github.com/rust-lang/crates.io-index" 1349 | checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 1350 | 1351 | [[package]] 1352 | name = "windows_x86_64_gnullvm" 1353 | version = "0.48.5" 1354 | source = "registry+https://github.com/rust-lang/crates.io-index" 1355 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1356 | 1357 | [[package]] 1358 | name = "windows_x86_64_gnullvm" 1359 | version = "0.52.6" 1360 | source = "registry+https://github.com/rust-lang/crates.io-index" 1361 | checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 1362 | 1363 | [[package]] 1364 | name = "windows_x86_64_msvc" 1365 | version = "0.48.5" 1366 | source = "registry+https://github.com/rust-lang/crates.io-index" 1367 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1368 | 1369 | [[package]] 1370 | name = "windows_x86_64_msvc" 1371 | version = "0.52.6" 1372 | source = "registry+https://github.com/rust-lang/crates.io-index" 1373 | checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 1374 | 1375 | [[package]] 1376 | name = "winreg" 1377 | version = "0.52.0" 1378 | source = "registry+https://github.com/rust-lang/crates.io-index" 1379 | checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" 1380 | dependencies = [ 1381 | "cfg-if", 1382 | "windows-sys 0.48.0", 1383 | ] 1384 | 1385 | [[package]] 1386 | name = "zeroize" 1387 | version = "1.8.1" 1388 | source = "registry+https://github.com/rust-lang/crates.io-index" 1389 | checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 1390 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "openairs" 3 | version = "0.2.2" 4 | edition = "2021" 5 | license = "MIT" 6 | description = "A simple and efficient wrapper around the OpenAI API" 7 | readme = "README.md" 8 | homepage = "https://github.com/0xKitsune/openai-rs" 9 | repository = "https://github.com/0xKitsune/openai-rs" 10 | keywords = ["openai", "chatgpt", "gpt", "ai"] 11 | 12 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 13 | 14 | [dependencies] 15 | thiserror = "1.0.63" 16 | tokio = { version = "1.39", features = ["full"] } 17 | serde = { version = "1.0", features = ["derive"] } 18 | reqwest = { version = "0.12", features = ["json"] } 19 | serde_json = "1.0" 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # openai-rs 2 | A simple and efficient wrapper around the OpenAI API 3 | 4 | 5 | ``` 6 | 7 | ... 8 | .:oxO0KK0Okxl;. 9 | .:kXWWXOkxxk0KXWWKx;..... 10 | ;OWW0o;. ...c0WMNK0KK0Oxo:. 11 | lXMXl. .':lkXWWX0kxxkOXWWXk:. 12 | .':xXMK: .;d0NWWNOo;. .;o0WWO; 13 | .;xKNWMMWo 'ckKWWKxoc' .lXMXc 14 | :OWWKxdKMNc ,0WN0o;. .,lxkd:. :KMX: 15 | .dNWKl. .OMN: ;XXc. .:d0KOOKWWKkc'. dWMx. 16 | .dWWO' .OMN: ;X0' .'lk0XN0l' .;oONWN0o;.lNMO. 17 | ;KMK; .OMNc ;XXdoOKOxxOX0d:. .'ckXWWXXWWx. 18 | lNMk. .OMNc ;XWXxc'. 'cxKKkl'. .;d0WMWx. 19 | cNMO' .OMNc ;XK; ,0WNKOd;. .c0WWx. 20 | 'OMNo .dNWk;. ;X0' .ONo,cxKKx; .kWWx. 21 | ;KMXo. .,lkK0xkN0' .ON: cNM0' ,0MX: 22 | ,OWW0l' .:d0NNd,. .,dXNc ;XM0' .xMWo 23 | lWMMWNOo;. .,lkK0d:,,:d0KKNNc ;XM0' .kMNl 24 | .xMWOokXWWKxc' ;OWWNX0xc',ONc ;XM0' lNM0' 25 | .xMWo .:d0NWXOo;:dOKOo;'. .ON: ;XM0' .lXMK: 26 | lNMO' .,lkXWNKxc' .:xNN: ;XM0;'l0WWO; 27 | .xWWk' .;,. .,:lkXWWKd. :NMWXNWNOc. 28 | .dNWKl. .:d0NMWNOo;. .xWWXOxl,. 29 | .:ONWXko:;,,;:okXWWKxoc' .dNM0; 30 | .,oOXWWWWWWWMMW0c. .c0WWk' 31 | .,:cccccxXWNOoc:;,,;:lxKWW0c. 32 | 'lkKNWWWWWWWWX0d;. 33 | .';::ccc:,. 34 | ``` 35 | 36 | 37 | To run the examples, first set an environment variable called `OPENAI_API_KEY`. Then you can run any example with the following command: 38 | ``` 39 | cargo run --example 40 | ``` 41 | -------------------------------------------------------------------------------- /examples/completion.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use openairs::{ 4 | client, 5 | completions::Message, 6 | messages, 7 | models::{self}, 8 | }; 9 | 10 | #[tokio::main] 11 | async fn main() -> Result<(), Box> { 12 | let api_key = std::env::var("OPENAI_API_KEY").expect("Could not get api token"); 13 | let open_ai_client = client::OpenAIClient::new(api_key); 14 | 15 | // Create a new model 16 | let model = models::GPT_4o_Mini; 17 | 18 | // Create a new prompt 19 | let msg = messages!("Can you write me a simple Rust server that can handle a 'Ping' request, returning a 'Pong' message?"); 20 | println!("{}", msg[0].content); 21 | 22 | // Send the chat completion request to OpenAI 23 | let response = open_ai_client.chat_completion(&model, msg).await?; 24 | println!("{} \n\n", response.choices[0].message.content); 25 | 26 | Ok(()) 27 | } 28 | -------------------------------------------------------------------------------- /examples/create-image.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | 3 | use openairs::client; 4 | 5 | #[tokio::main] 6 | async fn main() -> Result<(), Box> { 7 | let api_key = std::env::var("OPENAI_API_KEY").expect("Could not get api token"); 8 | let open_ai_client = client::OpenAIClient::new(api_key); 9 | 10 | //Create a new prompt 11 | let prompt = "Spiderman, but as a Wes Anderson movie"; 12 | 13 | println!("Prompt: {}", prompt); 14 | 15 | //use the client.create_image() method to send a prompt to the completion endpoint 16 | let response = open_ai_client.create_image(prompt).await?; 17 | println!("{}", response.data[0].url); 18 | 19 | Ok(()) 20 | } 21 | -------------------------------------------------------------------------------- /src/client/mod.rs: -------------------------------------------------------------------------------- 1 | use serde::{de::DeserializeOwned, Serialize}; 2 | use serde_json::{json, Value}; 3 | 4 | use crate::{ 5 | completions::{ChatCompletionRequest, ChatCompletionResponse, Message}, 6 | error::OpenAIError, 7 | images::{CreateImageRequest, ImageResponse}, 8 | models::Model, 9 | }; 10 | 11 | pub trait OpenAIRequest { 12 | fn endpoint(&self) -> &str; 13 | } 14 | 15 | pub trait OpenAIResponse {} 16 | 17 | pub struct OpenAIClient { 18 | client: reqwest::Client, 19 | api_key: String, 20 | } 21 | 22 | pub const MODELS_ENDPOINT: &str = "https://api.openai.com/v1/models"; 23 | 24 | impl OpenAIClient { 25 | pub fn new(api_key: String) -> Self { 26 | OpenAIClient { 27 | client: reqwest::Client::new(), 28 | api_key, 29 | } 30 | } 31 | 32 | pub async fn list_models(&self) -> Result { 33 | let request = self.client.get(MODELS_ENDPOINT).bearer_auth(&self.api_key); 34 | 35 | let resp = request.send().await?; 36 | resp.json::().await 37 | } 38 | 39 | pub async fn chat_completion( 40 | &self, 41 | model: &Model, 42 | messages: Vec, 43 | ) -> Result { 44 | let total_chars: usize = messages.iter().map(|m| m.content.chars().count()).sum(); 45 | 46 | //TODO: Add error handling for when the model max tokens < prompt length 47 | self.send_request::( 48 | ChatCompletionRequest::new(model.name, messages) 49 | .max_tokens(model.max_tokens - total_chars), 50 | ) 51 | .await 52 | } 53 | 54 | pub async fn create_image(&self, prompt: &str) -> Result { 55 | self.send_request::(CreateImageRequest::new(prompt)) 56 | .await 57 | } 58 | 59 | pub async fn send_request< 60 | Req: OpenAIRequest + Serialize, 61 | Res: OpenAIResponse + DeserializeOwned, 62 | >( 63 | &self, 64 | request: Req, 65 | ) -> Result { 66 | let body = json!(request); 67 | 68 | let request_builder = self 69 | .client 70 | .post(request.endpoint()) 71 | .json(&body) 72 | .bearer_auth(&self.api_key); 73 | 74 | let response = request_builder.send().await?.json::().await?; 75 | 76 | if response.get("error").is_some() { 77 | let err_json = json!(response.get("error").unwrap()); 78 | 79 | match err_json 80 | .get("type") 81 | .expect("No 'type' sent with error message") 82 | .as_str() 83 | .unwrap() 84 | { 85 | "null" => match err_json 86 | .get("type") 87 | .expect("No 'type' sent with error message") 88 | .as_str() 89 | .unwrap() 90 | { 91 | "rate_limit_exceeded" => { 92 | Err(OpenAIError::RateLimitExceeded(err_json.to_string())) 93 | } 94 | _ => Err(OpenAIError::UnrecognizedError(err_json.to_string())), 95 | }, 96 | "billing_not_active" => Err(OpenAIError::BillingNotActive(err_json.to_string())), 97 | "invalid_request_error" => Err(OpenAIError::InvalidRequest(err_json.to_string())), 98 | 99 | _ => Err(OpenAIError::UnrecognizedError(err_json.to_string())), 100 | } 101 | } else { 102 | //Handle the error 103 | Ok(Res::deserialize(response).expect("need to handle this error")) 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/completions/mod.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use serde::{Deserialize, Serialize}; 4 | 5 | use crate::client::{OpenAIRequest, OpenAIResponse}; 6 | 7 | const CHAT_COMPLETION_ENDPOINT: &str = "https://api.openai.com/v1/chat/completions"; 8 | 9 | #[derive(Default, Debug, Serialize, Clone, Deserialize)] 10 | pub struct ChatCompletionRequest { 11 | pub model: String, 12 | pub messages: Vec, 13 | #[serde(skip_serializing_if = "Option::is_none")] 14 | pub functions: Option, 15 | #[serde(skip_serializing_if = "Option::is_none")] 16 | pub function_call: Option, 17 | #[serde(skip_serializing_if = "Option::is_none")] 18 | pub max_tokens: Option, 19 | #[serde(skip_serializing_if = "Option::is_none")] 20 | pub temperature: Option, 21 | #[serde(skip_serializing_if = "Option::is_none")] 22 | pub top_p: Option, 23 | #[serde(skip_serializing_if = "Option::is_none")] 24 | pub n: Option, 25 | #[serde(skip_serializing_if = "Option::is_none")] 26 | pub stream: Option, 27 | #[serde(skip_serializing_if = "Option::is_none")] 28 | pub lob_probs: Option, 29 | #[serde(skip_serializing_if = "Option::is_none")] 30 | pub stop: Option, 31 | #[serde(skip_serializing_if = "Option::is_none")] 32 | pub presence_penalty: Option, 33 | #[serde(skip_serializing_if = "Option::is_none")] 34 | pub frequency_penalty: Option, 35 | #[serde(skip_serializing_if = "Option::is_none")] 36 | pub logit_bias: Option>, 37 | #[serde(skip_serializing_if = "Option::is_none")] 38 | pub user: Option, 39 | } 40 | 41 | #[derive(Default, Debug, Clone, Serialize, Deserialize)] 42 | pub struct Function { 43 | name: String, 44 | #[serde(skip_serializing_if = "Option::is_none")] 45 | description: Option, 46 | #[serde(skip_serializing_if = "Option::is_none")] 47 | parameters: Option, 48 | } 49 | 50 | #[derive(Default, Debug, Clone, Serialize, Deserialize)] 51 | pub struct Message { 52 | pub role: Role, 53 | pub content: String, 54 | #[serde(skip_serializing_if = "Option::is_none")] 55 | pub name: Option, 56 | #[serde(skip_serializing_if = "Option::is_none")] 57 | pub function_call: Option, 58 | } 59 | 60 | impl Message { 61 | pub fn new(content: &str) -> Message { 62 | Message { 63 | content: content.to_owned(), 64 | ..Default::default() 65 | } 66 | } 67 | 68 | pub fn role(mut self, role: Role) -> Message { 69 | self.role = role; 70 | self 71 | } 72 | 73 | pub fn name(mut self, name: String) -> Message { 74 | self.name = Some(name); 75 | self 76 | } 77 | 78 | pub fn function_call(mut self, function_call: String) -> Message { 79 | self.function_call = Some(function_call); 80 | self 81 | } 82 | } 83 | 84 | #[derive(Default, Debug, Serialize, Clone, Deserialize)] 85 | pub enum Role { 86 | #[serde(rename = "system")] 87 | #[default] 88 | System, 89 | #[serde(rename = "user")] 90 | User, 91 | #[serde(rename = "assistant")] 92 | Assistant, 93 | #[serde(rename = "function")] 94 | Function, 95 | } 96 | 97 | impl OpenAIRequest for ChatCompletionRequest { 98 | fn endpoint(&self) -> &str { 99 | CHAT_COMPLETION_ENDPOINT 100 | } 101 | } 102 | 103 | impl ChatCompletionRequest { 104 | pub fn new(model: &str, messages: Vec) -> Self { 105 | ChatCompletionRequest { 106 | model: model.to_owned(), 107 | messages, 108 | ..Default::default() 109 | } 110 | } 111 | 112 | pub fn max_tokens(mut self, max_tokens: usize) -> Self { 113 | self.max_tokens = Some(max_tokens); 114 | self 115 | } 116 | 117 | pub fn temperature(mut self, temperature: f64) -> Self { 118 | self.temperature = Some(temperature); 119 | self 120 | } 121 | 122 | pub fn top_p(mut self, top_p: f64) -> Self { 123 | self.top_p = Some(top_p); 124 | self 125 | } 126 | pub fn n(mut self, n: i32) -> Self { 127 | self.n = Some(n); 128 | self 129 | } 130 | pub fn stream(mut self, stream: bool) -> Self { 131 | self.stream = Some(stream); 132 | self 133 | } 134 | 135 | pub fn lob_probs(mut self, lob_probs: i32) -> Self { 136 | self.lob_probs = Some(lob_probs); 137 | self 138 | } 139 | 140 | pub fn stop(mut self, stop: bool) -> Self { 141 | self.stop = Some(stop); 142 | self 143 | } 144 | 145 | pub fn presence_penalty(mut self, presence_penalty: f64) -> Self { 146 | self.presence_penalty = Some(presence_penalty); 147 | self 148 | } 149 | pub fn frequency_penalty(mut self, frequency_penalty: f64) -> Self { 150 | self.frequency_penalty = Some(frequency_penalty); 151 | self 152 | } 153 | 154 | pub fn logit_bias(mut self, logit_bias: HashMap) -> Self { 155 | self.logit_bias = Some(logit_bias); 156 | self 157 | } 158 | 159 | pub fn user(mut self, user: String) -> Self { 160 | self.user = Some(user); 161 | self 162 | } 163 | } 164 | 165 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 166 | pub struct ChatCompletionResponse { 167 | pub id: String, 168 | pub object: String, 169 | pub created: usize, 170 | pub model: String, 171 | pub choices: Vec, 172 | pub usage: Usage, 173 | } 174 | 175 | impl OpenAIResponse for ChatCompletionResponse {} 176 | 177 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 178 | pub struct Choice { 179 | pub index: usize, 180 | pub message: Message, 181 | pub finish_reason: Option, 182 | } 183 | 184 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 185 | pub struct Usage { 186 | pub prompt_tokens: usize, 187 | pub completion_tokens: usize, 188 | pub total_tokens: usize, 189 | } 190 | 191 | #[macro_export] 192 | macro_rules! messages { 193 | ($($content:expr),* $(,)?) => {{ 194 | let mut messages = Vec::new(); 195 | $( 196 | messages.push(Message { 197 | content: $content.to_string(), 198 | ..Default::default() 199 | }); 200 | )* 201 | messages 202 | }}; 203 | } 204 | -------------------------------------------------------------------------------- /src/error.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | 3 | #[derive(Error, Debug)] 4 | pub enum OpenAIError { 5 | #[error("Reqwest Error")] 6 | ReqwestError(#[from] reqwest::Error), 7 | #[error("Your account is not active, please check your billing details on our website.")] 8 | BillingNotActive(String), 9 | #[error("Invalid request")] 10 | InvalidRequest(String), 11 | #[error("Unrecognized error")] 12 | UnrecognizedError(String), 13 | #[error("Rate limit exceeded")] 14 | RateLimitExceeded(String), 15 | } 16 | -------------------------------------------------------------------------------- /src/images/mod.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | use crate::client::{OpenAIRequest, OpenAIResponse}; 4 | 5 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 6 | pub struct CreateImageRequest { 7 | pub prompt: String, 8 | #[serde(skip_serializing_if = "Option::is_none")] 9 | pub n: Option, 10 | #[serde(skip_serializing_if = "Option::is_none")] 11 | pub size: Option, 12 | #[serde(skip_serializing_if = "Option::is_none")] 13 | pub response_format: Option, 14 | #[serde(skip_serializing_if = "Option::is_none")] 15 | pub user: Option, 16 | } 17 | 18 | const CREATE_IMAGE_ENDPOINT: &str = "https://api.openai.com/v1/images/generations"; 19 | 20 | impl OpenAIRequest for CreateImageRequest { 21 | fn endpoint(&self) -> &str { 22 | CREATE_IMAGE_ENDPOINT 23 | } 24 | } 25 | 26 | impl CreateImageRequest { 27 | pub fn new(prompt: &str) -> Self { 28 | CreateImageRequest { 29 | prompt: prompt.to_owned(), 30 | ..Default::default() 31 | } 32 | } 33 | 34 | pub fn n(mut self, n: i32) -> Self { 35 | self.n = Some(n); 36 | self 37 | } 38 | 39 | pub fn size(mut self, size: String) -> Self { 40 | self.size = Some(size); 41 | self 42 | } 43 | 44 | pub fn response_format(mut self, response_format: String) -> Self { 45 | self.response_format = Some(response_format); 46 | self 47 | } 48 | 49 | pub fn user(mut self, user: String) -> Self { 50 | self.user = Some(user); 51 | self 52 | } 53 | } 54 | 55 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 56 | pub struct ImageResponse { 57 | pub created: usize, 58 | pub data: Vec, 59 | } 60 | 61 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 62 | pub struct ImageUrl { 63 | pub url: String, 64 | } 65 | 66 | impl OpenAIResponse for ImageResponse {} 67 | 68 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 69 | pub struct ImageEditRequest { 70 | pub image: String, 71 | pub prompt: String, 72 | #[serde(skip_serializing_if = "Option::is_none")] 73 | pub mask: Option, 74 | #[serde(skip_serializing_if = "Option::is_none")] 75 | pub n: Option, 76 | #[serde(skip_serializing_if = "Option::is_none")] 77 | pub size: Option, 78 | #[serde(skip_serializing_if = "Option::is_none")] 79 | pub response_format: Option, 80 | #[serde(skip_serializing_if = "Option::is_none")] 81 | pub user: Option, 82 | } 83 | 84 | const IMAGE_EDIT_ENDPOINT: &str = "https://api.openai.com/v1/images/edits"; 85 | 86 | impl OpenAIRequest for ImageEditRequest { 87 | fn endpoint(&self) -> &str { 88 | IMAGE_EDIT_ENDPOINT 89 | } 90 | } 91 | 92 | impl ImageEditRequest { 93 | pub fn new(image: &str, prompt: &str) -> Self { 94 | ImageEditRequest { 95 | image: image.to_owned(), 96 | prompt: prompt.to_owned(), 97 | ..Default::default() 98 | } 99 | } 100 | 101 | pub fn n(mut self, n: i32) -> Self { 102 | self.n = Some(n); 103 | self 104 | } 105 | 106 | pub fn size(mut self, size: String) -> Self { 107 | self.size = Some(size); 108 | self 109 | } 110 | 111 | pub fn mask(mut self, mask: String) -> Self { 112 | self.mask = Some(mask); 113 | self 114 | } 115 | 116 | pub fn response_format(mut self, response_format: String) -> Self { 117 | self.response_format = Some(response_format); 118 | self 119 | } 120 | 121 | pub fn user(mut self, user: String) -> Self { 122 | self.user = Some(user); 123 | self 124 | } 125 | } 126 | 127 | #[derive(Serialize, Deserialize, Debug, Clone, Default)] 128 | pub struct ImageVariationRequest { 129 | pub image: String, 130 | #[serde(skip_serializing_if = "Option::is_none")] 131 | pub n: Option, 132 | #[serde(skip_serializing_if = "Option::is_none")] 133 | pub size: Option, 134 | #[serde(skip_serializing_if = "Option::is_none")] 135 | pub response_format: Option, 136 | #[serde(skip_serializing_if = "Option::is_none")] 137 | pub user: Option, 138 | } 139 | 140 | const IMAGE_VARIATION_ENDPOINT: &str = "https://api.openai.com/v1/images/variations"; 141 | 142 | impl OpenAIRequest for ImageVariationRequest { 143 | fn endpoint(&self) -> &str { 144 | IMAGE_VARIATION_ENDPOINT 145 | } 146 | } 147 | 148 | impl ImageVariationRequest { 149 | pub fn new(image: &str) -> Self { 150 | ImageVariationRequest { 151 | image: image.to_owned(), 152 | ..Default::default() 153 | } 154 | } 155 | 156 | pub fn n(mut self, n: i32) -> Self { 157 | self.n = Some(n); 158 | self 159 | } 160 | 161 | pub fn size(mut self, size: String) -> Self { 162 | self.size = Some(size); 163 | self 164 | } 165 | 166 | pub fn response_format(mut self, response_format: String) -> Self { 167 | self.response_format = Some(response_format); 168 | self 169 | } 170 | 171 | pub fn user(mut self, user: String) -> Self { 172 | self.user = Some(user); 173 | self 174 | } 175 | } 176 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod client; 2 | pub mod completions; 3 | pub mod error; 4 | pub mod images; 5 | pub mod models; 6 | -------------------------------------------------------------------------------- /src/models/mod.rs: -------------------------------------------------------------------------------- 1 | //https://platform.openai.com/docs/models 2 | pub struct Model { 3 | pub name: &'static str, 4 | pub max_tokens: usize, 5 | } 6 | 7 | #[allow(non_upper_case_globals)] 8 | pub const GPT_4o: Model = Model { 9 | name: "gpt-4o", 10 | max_tokens: 128000, 11 | }; 12 | 13 | #[allow(non_upper_case_globals)] 14 | pub const GPT_4o_Mini: Model = Model { 15 | name: "gpt-4o-mini", 16 | max_tokens: 128000, 17 | }; 18 | 19 | pub const GPT_4: Model = Model { 20 | name: "gpt-4", 21 | max_tokens: 8192, 22 | }; 23 | 24 | pub const GPT_4_32K: Model = Model { 25 | name: "gpt-4-32k", 26 | max_tokens: 32768, 27 | }; 28 | 29 | pub const GPT_3_5_TURBO: Model = Model { 30 | name: "gpt-3.5-turbo", 31 | max_tokens: 4096, 32 | }; 33 | 34 | pub const GPT_3_5_TURBO_16K: Model = Model { 35 | name: "gpt-3.5-turbo-16k", 36 | max_tokens: 16384, 37 | }; 38 | --------------------------------------------------------------------------------