models.py 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. from __future__ import annotations
  2. from dataclasses import dataclass
  3. from .Provider import IterListProvider, ProviderType
  4. from .Provider import (
  5. AIChatFree,
  6. Blackbox,
  7. Blackbox2,
  8. BingCreateImages,
  9. ChatGpt,
  10. ChatGptEs,
  11. Cloudflare,
  12. Copilot,
  13. CopilotAccount,
  14. DarkAI,
  15. DDG,
  16. DeepInfraChat,
  17. Flux,
  18. Free2GPT,
  19. GigaChat,
  20. Gemini,
  21. GeminiPro,
  22. HuggingChat,
  23. HuggingFace,
  24. Liaobots,
  25. Airforce,
  26. Mhystical,
  27. MetaAI,
  28. MicrosoftDesigner,
  29. OpenaiChat,
  30. OpenaiAccount,
  31. PerplexityLabs,
  32. Pi,
  33. Pizzagpt,
  34. PollinationsAI,
  35. Reka,
  36. ReplicateHome,
  37. RubiksAI,
  38. TeachAnything,
  39. )
  40. @dataclass(unsafe_hash=True)
  41. class Model:
  42. """
  43. Represents a machine learning model configuration.
  44. Attributes:
  45. name (str): Name of the model.
  46. base_provider (str): Default provider for the model.
  47. best_provider (ProviderType): The preferred provider for the model, typically with retry logic.
  48. """
  49. name: str
  50. base_provider: str
  51. best_provider: ProviderType = None
  52. @staticmethod
  53. def __all__() -> list[str]:
  54. """Returns a list of all model names."""
  55. return _all_models
  56. class ImageModel(Model):
  57. pass
  58. ### Default ###
  59. default = Model(
  60. name = "",
  61. base_provider = "",
  62. best_provider = IterListProvider([
  63. DDG,
  64. Pizzagpt,
  65. ReplicateHome,
  66. Blackbox2,
  67. Blackbox,
  68. Free2GPT,
  69. DeepInfraChat,
  70. Airforce,
  71. ChatGptEs,
  72. Cloudflare,
  73. Mhystical,
  74. PollinationsAI,
  75. ])
  76. )
  77. ############
  78. ### Text ###
  79. ############
  80. ### OpenAI ###
  81. # gpt-3.5
  82. gpt_35_turbo = Model(
  83. name = 'gpt-3.5-turbo',
  84. base_provider = 'OpenAI',
  85. best_provider = IterListProvider([DarkAI, ChatGpt])
  86. )
  87. # gpt-4
  88. gpt_4 = Model(
  89. name = 'gpt-4',
  90. base_provider = 'OpenAI',
  91. best_provider = IterListProvider([DDG, Blackbox, ChatGptEs, PollinationsAI, Copilot, OpenaiChat, Liaobots, Airforce])
  92. )
  93. gpt_4_turbo = Model(
  94. name = 'gpt-4-turbo',
  95. base_provider = 'OpenAI',
  96. best_provider = Airforce
  97. )
  98. # gpt-4o
  99. gpt_4o = Model(
  100. name = 'gpt-4o',
  101. base_provider = 'OpenAI',
  102. best_provider = IterListProvider([Blackbox, ChatGptEs, PollinationsAI, DarkAI, ChatGpt, Airforce, Liaobots, OpenaiChat])
  103. )
  104. gpt_4o_mini = Model(
  105. name = 'gpt-4o-mini',
  106. base_provider = 'OpenAI',
  107. best_provider = IterListProvider([DDG, ChatGptEs, Pizzagpt, ChatGpt, Airforce, RubiksAI, Liaobots, OpenaiChat])
  108. )
  109. # o1
  110. o1_preview = Model(
  111. name = 'o1-preview',
  112. base_provider = 'OpenAI',
  113. best_provider = Liaobots
  114. )
  115. o1_mini = Model(
  116. name = 'o1-mini',
  117. base_provider = 'OpenAI',
  118. best_provider = IterListProvider([Liaobots, Airforce])
  119. )
  120. ### GigaChat ###
  121. gigachat = Model(
  122. name = 'GigaChat:latest',
  123. base_provider = 'gigachat',
  124. best_provider = GigaChat
  125. )
  126. ### Meta ###
  127. meta = Model(
  128. name = "meta-ai",
  129. base_provider = "Meta",
  130. best_provider = MetaAI
  131. )
  132. # llama 2
  133. llama_2_7b = Model(
  134. name = "llama-2-7b",
  135. base_provider = "Meta Llama",
  136. best_provider = IterListProvider([Cloudflare, Airforce])
  137. )
  138. # llama 3
  139. llama_3_8b = Model(
  140. name = "llama-3-8b",
  141. base_provider = "Meta Llama",
  142. best_provider = Cloudflare
  143. )
  144. # llama 3.1
  145. llama_3_1_8b = Model(
  146. name = "llama-3.1-8b",
  147. base_provider = "Meta Llama",
  148. best_provider = IterListProvider([Blackbox, DeepInfraChat, Cloudflare, Airforce, PerplexityLabs])
  149. )
  150. llama_3_1_70b = Model(
  151. name = "llama-3.1-70b",
  152. base_provider = "Meta Llama",
  153. best_provider = IterListProvider([DDG, DeepInfraChat, Blackbox, Blackbox2, TeachAnything, PollinationsAI, DarkAI, Airforce, RubiksAI, PerplexityLabs])
  154. )
  155. llama_3_1_405b = Model(
  156. name = "llama-3.1-405b",
  157. base_provider = "Meta Llama",
  158. best_provider = Blackbox
  159. )
  160. # llama 3.2
  161. llama_3_2_1b = Model(
  162. name = "llama-3.2-1b",
  163. base_provider = "Meta Llama",
  164. best_provider = Cloudflare
  165. )
  166. llama_3_2_11b = Model(
  167. name = "llama-3.2-11b",
  168. base_provider = "Meta Llama",
  169. best_provider = IterListProvider([HuggingChat, HuggingFace])
  170. )
  171. # llama 3.3
  172. llama_3_3_70b = Model(
  173. name = "llama-3.3-70b",
  174. base_provider = "Meta Llama",
  175. best_provider = IterListProvider([HuggingChat, HuggingFace, PerplexityLabs])
  176. )
  177. ### Mistral ###
  178. mixtral_8x7b = Model(
  179. name = "mixtral-8x7b",
  180. base_provider = "Mistral",
  181. best_provider = DDG
  182. )
  183. mistral_nemo = Model(
  184. name = "mistral-nemo",
  185. base_provider = "Mistral",
  186. best_provider = IterListProvider([PollinationsAI, HuggingChat, HuggingFace])
  187. )
  188. mistral_large = Model(
  189. name = "mistral-large",
  190. base_provider = "Mistral",
  191. best_provider = PollinationsAI
  192. )
  193. ### NousResearch ###
  194. hermes_2_dpo = Model(
  195. name = "hermes-2-dpo",
  196. base_provider = "NousResearch",
  197. best_provider = Airforce
  198. )
  199. hermes_2_pro = Model(
  200. name = "hermes-2-pro",
  201. base_provider = "NousResearch",
  202. best_provider = Airforce
  203. )
  204. hermes_3 = Model(
  205. name = "hermes-3",
  206. base_provider = "NousResearch",
  207. best_provider = IterListProvider([HuggingChat, HuggingFace])
  208. )
  209. ### Microsoft ###
  210. phi_2 = Model(
  211. name = "phi-2",
  212. base_provider = "Microsoft",
  213. best_provider = Airforce
  214. )
  215. phi_3_5_mini = Model(
  216. name = "phi-3.5-mini",
  217. base_provider = "Microsoft",
  218. best_provider = IterListProvider([HuggingChat, HuggingFace])
  219. )
  220. ### Google DeepMind ###
  221. # gemini
  222. gemini_pro = Model(
  223. name = 'gemini-pro',
  224. base_provider = 'Google DeepMind',
  225. best_provider = IterListProvider([Blackbox, AIChatFree, Gemini, GeminiPro, Liaobots])
  226. )
  227. gemini_flash = Model(
  228. name = 'gemini-flash',
  229. base_provider = 'Google DeepMind',
  230. best_provider = IterListProvider([Blackbox, Gemini, GeminiPro, Liaobots])
  231. )
  232. gemini = Model(
  233. name = 'gemini',
  234. base_provider = 'Google DeepMind',
  235. best_provider = Gemini
  236. )
  237. # gemma
  238. gemma_2b = Model(
  239. name = 'gemma-2b',
  240. base_provider = 'Google',
  241. best_provider = ReplicateHome
  242. )
  243. ### Anthropic ###
  244. # claude 3
  245. claude_3_opus = Model(
  246. name = 'claude-3-opus',
  247. base_provider = 'Anthropic',
  248. best_provider = Liaobots
  249. )
  250. claude_3_sonnet = Model(
  251. name = 'claude-3-sonnet',
  252. base_provider = 'Anthropic',
  253. best_provider = Liaobots
  254. )
  255. claude_3_haiku = Model(
  256. name = 'claude-3-haiku',
  257. base_provider = 'Anthropic',
  258. best_provider = DDG
  259. )
  260. # claude 3.5
  261. claude_3_5_sonnet = Model(
  262. name = 'claude-3.5-sonnet',
  263. base_provider = 'Anthropic',
  264. best_provider = IterListProvider([Blackbox, PollinationsAI, Liaobots])
  265. )
  266. ### Reka AI ###
  267. reka_core = Model(
  268. name = 'reka-core',
  269. base_provider = 'Reka AI',
  270. best_provider = Reka
  271. )
  272. ### Blackbox AI ###
  273. blackboxai = Model(
  274. name = 'blackboxai',
  275. base_provider = 'Blackbox AI',
  276. best_provider = Blackbox
  277. )
  278. blackboxai_pro = Model(
  279. name = 'blackboxai-pro',
  280. base_provider = 'Blackbox AI',
  281. best_provider = Blackbox
  282. )
  283. ### CohereForAI ###
  284. command_r_plus = Model(
  285. name = 'command-r-plus',
  286. base_provider = 'CohereForAI',
  287. best_provider = HuggingChat
  288. )
  289. command_r = Model(
  290. name = 'command-r',
  291. base_provider = 'CohereForAI',
  292. best_provider = PollinationsAI
  293. )
  294. ### Qwen ###
  295. # qwen 1_5
  296. qwen_1_5_7b = Model(
  297. name = 'qwen-1.5-7b',
  298. base_provider = 'Qwen',
  299. best_provider = Cloudflare
  300. )
  301. # qwen 2
  302. qwen_2_72b = Model(
  303. name = 'qwen-2-72b',
  304. base_provider = 'Qwen',
  305. best_provider = DeepInfraChat
  306. )
  307. # qwen 2.5
  308. qwen_2_5_72b = Model(
  309. name = 'qwen-2.5-72b',
  310. base_provider = 'Qwen',
  311. best_provider = IterListProvider([HuggingChat, HuggingFace])
  312. )
  313. qwen_2_5_coder_32b = Model(
  314. name = 'qwen-2.5-coder-32b',
  315. base_provider = 'Qwen',
  316. best_provider = IterListProvider([DeepInfraChat, PollinationsAI, HuggingChat, HuggingFace])
  317. )
  318. qwq_32b = Model(
  319. name = 'qwq-32b',
  320. base_provider = 'Qwen',
  321. best_provider = IterListProvider([DeepInfraChat, HuggingChat, HuggingFace])
  322. )
  323. ### Inflection ###
  324. pi = Model(
  325. name = 'pi',
  326. base_provider = 'Inflection',
  327. best_provider = Pi
  328. )
  329. ### DeepSeek ###
  330. deepseek_coder = Model(
  331. name = 'deepseek-coder',
  332. base_provider = 'DeepSeek',
  333. best_provider = Airforce
  334. )
  335. ### WizardLM ###
  336. wizardlm_2_8x22b = Model(
  337. name = 'wizardlm-2-8x22b',
  338. base_provider = 'WizardLM',
  339. best_provider = DeepInfraChat
  340. )
  341. ### OpenChat ###
  342. openchat_3_5 = Model(
  343. name = 'openchat-3.5',
  344. base_provider = 'OpenChat',
  345. best_provider = Airforce
  346. )
  347. ### x.ai ###
  348. grok_beta = Model(
  349. name = 'grok-beta',
  350. base_provider = 'x.ai',
  351. best_provider = Liaobots
  352. )
  353. ### Perplexity AI ###
  354. sonar_online = Model(
  355. name = 'sonar-online',
  356. base_provider = 'Perplexity AI',
  357. best_provider = PerplexityLabs
  358. )
  359. sonar_chat = Model(
  360. name = 'sonar-chat',
  361. base_provider = 'Perplexity AI',
  362. best_provider = PerplexityLabs
  363. )
  364. ### Nvidia ###
  365. nemotron_70b = Model(
  366. name = 'nemotron-70b',
  367. base_provider = 'Nvidia',
  368. best_provider = IterListProvider([DeepInfraChat, HuggingChat, HuggingFace])
  369. )
  370. ### Teknium ###
  371. openhermes_2_5 = Model(
  372. name = 'openhermes-2.5',
  373. base_provider = 'Teknium',
  374. best_provider = Airforce
  375. )
  376. ### Liquid ###
  377. lfm_40b = Model(
  378. name = 'lfm-40b',
  379. base_provider = 'Liquid',
  380. best_provider = IterListProvider([Airforce, PerplexityLabs])
  381. )
  382. ### DiscoResearch ###
  383. german_7b = Model(
  384. name = 'german-7b',
  385. base_provider = 'DiscoResearch',
  386. best_provider = Airforce
  387. )
  388. ### HuggingFaceH4 ###
  389. zephyr_7b = Model(
  390. name = 'zephyr-7b',
  391. base_provider = 'HuggingFaceH4',
  392. best_provider = Airforce
  393. )
  394. ### Inferless ###
  395. neural_7b = Model(
  396. name = 'neural-7b',
  397. base_provider = 'Inferless',
  398. best_provider = Airforce
  399. )
  400. ### PollinationsAI ###
  401. p1 = Model(
  402. name = 'p1',
  403. base_provider = 'PollinationsAI',
  404. best_provider = PollinationsAI
  405. )
  406. ### Uncensored AI ###
  407. evil = Model(
  408. name = 'evil',
  409. base_provider = 'Evil Mode - Experimental',
  410. best_provider = IterListProvider([PollinationsAI, Airforce])
  411. )
  412. ### Other ###
  413. midijourney = Model(
  414. name = 'midijourney',
  415. base_provider = 'Other',
  416. best_provider = PollinationsAI
  417. )
  418. turbo = Model(
  419. name = 'turbo',
  420. base_provider = 'Other',
  421. best_provider = PollinationsAI
  422. )
  423. unity = Model(
  424. name = 'unity',
  425. base_provider = 'Other',
  426. best_provider = PollinationsAI
  427. )
  428. rtist = Model(
  429. name = 'rtist',
  430. base_provider = 'Other',
  431. best_provider = PollinationsAI
  432. )
  433. #############
  434. ### Image ###
  435. #############
  436. ### Stability AI ###
  437. sdxl = ImageModel(
  438. name = 'sdxl',
  439. base_provider = 'Stability AI',
  440. best_provider = IterListProvider([ReplicateHome, Airforce])
  441. )
  442. sd_3 = ImageModel(
  443. name = 'sd-3',
  444. base_provider = 'Stability AI',
  445. best_provider = ReplicateHome
  446. )
  447. ### Playground ###
  448. playground_v2_5 = ImageModel(
  449. name = 'playground-v2.5',
  450. base_provider = 'Playground AI',
  451. best_provider = ReplicateHome
  452. )
  453. ### Flux AI ###
  454. flux = ImageModel(
  455. name = 'flux',
  456. base_provider = 'Flux AI',
  457. best_provider = IterListProvider([Blackbox, Blackbox2, PollinationsAI, Airforce])
  458. )
  459. flux_pro = ImageModel(
  460. name = 'flux-pro',
  461. base_provider = 'Flux AI',
  462. best_provider = IterListProvider([PollinationsAI, Airforce])
  463. )
  464. flux_dev = ImageModel(
  465. name = 'flux-dev',
  466. base_provider = 'Flux AI',
  467. best_provider = IterListProvider([Flux, HuggingChat, HuggingFace])
  468. )
  469. flux_realism = ImageModel(
  470. name = 'flux-realism',
  471. base_provider = 'Flux AI',
  472. best_provider = IterListProvider([PollinationsAI, Airforce])
  473. )
  474. flux_cablyai = ImageModel(
  475. name = 'flux-cablyai',
  476. base_provider = 'Flux AI',
  477. best_provider = PollinationsAI
  478. )
  479. flux_anime = ImageModel(
  480. name = 'flux-anime',
  481. base_provider = 'Flux AI',
  482. best_provider = IterListProvider([PollinationsAI, Airforce])
  483. )
  484. flux_3d = ImageModel(
  485. name = 'flux-3d',
  486. base_provider = 'Flux AI',
  487. best_provider = IterListProvider([PollinationsAI, Airforce])
  488. )
  489. flux_disney = ImageModel(
  490. name = 'flux-disney',
  491. base_provider = 'Flux AI',
  492. best_provider = Airforce
  493. )
  494. flux_pixel = ImageModel(
  495. name = 'flux-pixel',
  496. base_provider = 'Flux AI',
  497. best_provider = Airforce
  498. )
  499. flux_4o = ImageModel(
  500. name = 'flux-4o',
  501. base_provider = 'Flux AI',
  502. best_provider = Airforce
  503. )
  504. ### OpenAI ###
  505. dall_e_3 = ImageModel(
  506. name = 'dall-e-3',
  507. base_provider = 'OpenAI',
  508. best_provider = IterListProvider([Airforce, PollinationsAI, CopilotAccount, OpenaiAccount, MicrosoftDesigner, BingCreateImages])
  509. )
  510. ### Midjourney ###
  511. midjourney = ImageModel(
  512. name = 'midjourney',
  513. base_provider = 'Midjourney',
  514. best_provider = IterListProvider([PollinationsAI, Airforce])
  515. )
  516. ### Other ###
  517. any_dark = ImageModel(
  518. name = 'any-dark',
  519. base_provider = 'Other',
  520. best_provider = IterListProvider([PollinationsAI, Airforce])
  521. )
  522. class ModelUtils:
  523. """
  524. Utility class for mapping string identifiers to Model instances.
  525. Attributes:
  526. convert (dict[str, Model]): Dictionary mapping model string identifiers to Model instances.
  527. """
  528. convert: dict[str, Model] = {
  529. ############
  530. ### Text ###
  531. ############
  532. ### OpenAI ###
  533. # gpt-3
  534. 'gpt-3': gpt_35_turbo,
  535. # gpt-3.5
  536. 'gpt-3.5-turbo': gpt_35_turbo,
  537. # gpt-4
  538. 'gpt-4': gpt_4,
  539. 'gpt-4-turbo': gpt_4_turbo,
  540. # gpt-4o
  541. 'gpt-4o': gpt_4o,
  542. 'gpt-4o-mini': gpt_4o_mini,
  543. # o1
  544. 'o1-preview': o1_preview,
  545. 'o1-mini': o1_mini,
  546. ### Meta ###
  547. "meta-ai": meta,
  548. # llama-2
  549. 'llama-2-7b': llama_2_7b,
  550. # llama-3
  551. 'llama-3-8b': llama_3_8b,
  552. # llama-3.1
  553. 'llama-3.1-8b': llama_3_1_8b,
  554. 'llama-3.1-70b': llama_3_1_70b,
  555. 'llama-3.1-405b': llama_3_1_405b,
  556. # llama-3.2
  557. 'llama-3.2-1b': llama_3_2_1b,
  558. 'llama-3.2-11b': llama_3_2_11b,
  559. # llama-3.3
  560. 'llama-3.3-70b': llama_3_3_70b,
  561. ### Mistral ###
  562. 'mixtral-8x7b': mixtral_8x7b,
  563. 'mistral-nemo': mistral_nemo,
  564. 'mistral-large': mistral_large,
  565. ### NousResearch ###
  566. 'hermes-2-dpo': hermes_2_dpo,
  567. 'hermes-2-pro': hermes_2_pro,
  568. 'hermes-3': hermes_3,
  569. ### Microsoft ###
  570. 'phi-2': phi_2,
  571. 'phi-3.5-mini': phi_3_5_mini,
  572. ### Google ###
  573. # gemini
  574. 'gemini': gemini,
  575. 'gemini-pro': gemini_pro,
  576. 'gemini-flash': gemini_flash,
  577. # gemma
  578. 'gemma-2b': gemma_2b,
  579. ### Anthropic ###
  580. # claude 3
  581. 'claude-3-opus': claude_3_opus,
  582. 'claude-3-sonnet': claude_3_sonnet,
  583. 'claude-3-haiku': claude_3_haiku,
  584. # claude 3.5
  585. 'claude-3.5-sonnet': claude_3_5_sonnet,
  586. ### Reka AI ###
  587. 'reka-core': reka_core,
  588. ### Blackbox AI ###
  589. 'blackboxai': blackboxai,
  590. 'blackboxai-pro': blackboxai_pro,
  591. ### CohereForAI ###
  592. 'command-r+': command_r_plus,
  593. 'command-r': command_r,
  594. ### GigaChat ###
  595. 'gigachat': gigachat,
  596. ### Qwen ###
  597. # qwen 1_5
  598. 'qwen-1.5-7b': qwen_1_5_7b,
  599. # qwen 2
  600. 'qwen-2-72b': qwen_2_72b,
  601. # qwen 2.5
  602. 'qwen-2.5-72b': qwen_2_5_72b,
  603. 'qwen-2.5-coder-32b': qwen_2_5_coder_32b,
  604. 'qwq-32b': qwq_32b,
  605. ### Inflection ###
  606. 'pi': pi,
  607. ### WizardLM ###
  608. 'wizardlm-2-8x22b': wizardlm_2_8x22b,
  609. ### OpenChat ###
  610. 'openchat-3.5': openchat_3_5,
  611. ### x.ai ###
  612. 'grok-beta': grok_beta,
  613. ### Perplexity AI ###
  614. 'sonar-online': sonar_online,
  615. 'sonar-chat': sonar_chat,
  616. ### DeepSeek ###
  617. 'deepseek-coder': deepseek_coder,
  618. ### TheBloke ###
  619. 'german-7b': german_7b,
  620. ### Nvidia ###
  621. 'nemotron-70b': nemotron_70b,
  622. ### Teknium ###
  623. 'openhermes-2.5': openhermes_2_5,
  624. ### Liquid ###
  625. 'lfm-40b': lfm_40b,
  626. ### HuggingFaceH4 ###
  627. 'zephyr-7b': zephyr_7b,
  628. ### Inferless ###
  629. 'neural-7b': neural_7b,
  630. ### PollinationsAI ###
  631. 'p1': p1,
  632. ### Uncensored AI ###
  633. 'evil': evil,
  634. ### Other ###
  635. 'midijourney': midijourney,
  636. 'turbo': turbo,
  637. 'unity': unity,
  638. 'rtist': rtist,
  639. #############
  640. ### Image ###
  641. #############
  642. ### Stability AI ###
  643. 'sdxl': sdxl,
  644. 'sd-3': sd_3,
  645. ### Playground ###
  646. 'playground-v2.5': playground_v2_5,
  647. ### Flux AI ###
  648. 'flux': flux,
  649. 'flux-pro': flux_pro,
  650. 'flux-dev': flux_dev,
  651. 'flux-realism': flux_realism,
  652. 'flux-cablyai': flux_cablyai,
  653. 'flux-anime': flux_anime,
  654. 'flux-3d': flux_3d,
  655. 'flux-disney': flux_disney,
  656. 'flux-pixel': flux_pixel,
  657. 'flux-4o': flux_4o,
  658. ### OpenAI ###
  659. 'dall-e-3': dall_e_3,
  660. ### Midjourney ###
  661. 'midjourney': midjourney,
  662. ### Other ###
  663. 'any-dark': any_dark,
  664. }
  665. # Create a list of all working models
  666. __models__ = {model.name: (model, providers) for model, providers in [
  667. (model, [provider for provider in providers if provider.working])
  668. for model, providers in [
  669. (model, model.best_provider.providers
  670. if isinstance(model.best_provider, IterListProvider)
  671. else [model.best_provider]
  672. if model.best_provider is not None
  673. else [])
  674. for model in ModelUtils.convert.values()]
  675. ] if providers}
  676. # Update the ModelUtils.convert with the working models
  677. ModelUtils.convert = {model.name: model for model, _ in __models__.values()}
  678. _all_models = list(ModelUtils.convert.keys())