models.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988
  1. from __future__ import annotations
  2. from dataclasses import dataclass
  3. from .Provider import IterListProvider, ProviderType
  4. from .Provider import (
  5. ### No Auth Required ###
  6. AllenAI,
  7. Blackbox,
  8. ChatGLM,
  9. ChatGptEs,
  10. Cloudflare,
  11. Copilot,
  12. DDG,
  13. DeepInfraChat,
  14. Dynaspark,
  15. Free2GPT,
  16. FreeGpt,
  17. HuggingSpace,
  18. G4F,
  19. Grok,
  20. DeepseekAI_JanusPro7b,
  21. Glider,
  22. Goabror,
  23. ImageLabs,
  24. Jmuz,
  25. LambdaChat,
  26. Liaobots,
  27. OIVSCode,
  28. PerplexityLabs,
  29. Pi,
  30. PollinationsAI,
  31. PollinationsImage,
  32. TypeGPT,
  33. TeachAnything,
  34. Websim,
  35. Yqcloud,
  36. ### Needs Auth ###
  37. BingCreateImages,
  38. CopilotAccount,
  39. Gemini,
  40. GeminiPro,
  41. GigaChat,
  42. HailuoAI,
  43. HuggingChat,
  44. HuggingFace,
  45. HuggingFaceAPI,
  46. MetaAI,
  47. MicrosoftDesigner,
  48. OpenaiAccount,
  49. OpenaiChat,
  50. Reka,
  51. )
  52. @dataclass(unsafe_hash=True)
  53. class Model:
  54. """
  55. Represents a machine learning model configuration.
  56. Attributes:
  57. name (str): Name of the model.
  58. base_provider (str): Default provider for the model.
  59. best_provider (ProviderType): The preferred provider for the model, typically with retry logic.
  60. """
  61. name: str
  62. base_provider: str
  63. best_provider: ProviderType = None
  64. @staticmethod
  65. def __all__() -> list[str]:
  66. """Returns a list of all model names."""
  67. return _all_models
  68. class ImageModel(Model):
  69. pass
  70. class AudioModel(Model):
  71. pass
  72. class VisionModel(Model):
  73. pass
  74. ### Default ###
  75. default = Model(
  76. name = "",
  77. base_provider = "",
  78. best_provider = IterListProvider([
  79. DDG,
  80. Blackbox,
  81. Copilot,
  82. DeepInfraChat,
  83. AllenAI,
  84. PollinationsAI,
  85. TypeGPT,
  86. OIVSCode,
  87. ChatGptEs,
  88. Free2GPT,
  89. FreeGpt,
  90. Glider,
  91. Dynaspark,
  92. OpenaiChat,
  93. Jmuz,
  94. Cloudflare,
  95. ])
  96. )
  97. default_vision = Model(
  98. name = "",
  99. base_provider = "",
  100. best_provider = IterListProvider([
  101. Blackbox,
  102. OIVSCode,
  103. TypeGPT,
  104. DeepInfraChat,
  105. PollinationsAI,
  106. Dynaspark,
  107. HuggingSpace,
  108. GeminiPro,
  109. HuggingFaceAPI,
  110. CopilotAccount,
  111. OpenaiAccount,
  112. Gemini,
  113. ], shuffle=False)
  114. )
  115. ##########################
  116. ### Text//Audio/Vision ###
  117. ##########################
  118. ### OpenAI ###
  119. # gpt-3.5
  120. gpt_3_5_turbo = Model(
  121. name = 'gpt-3.5-turbo',
  122. base_provider = 'OpenAI'
  123. )
  124. # gpt-4
  125. gpt_4 = Model(
  126. name = 'gpt-4',
  127. base_provider = 'OpenAI',
  128. best_provider = IterListProvider([DDG, Jmuz, ChatGptEs, PollinationsAI, Yqcloud, Goabror, Copilot, OpenaiChat, Liaobots])
  129. )
  130. # gpt-4o
  131. gpt_4o = VisionModel(
  132. name = 'gpt-4o',
  133. base_provider = 'OpenAI',
  134. best_provider = IterListProvider([Blackbox, Jmuz, ChatGptEs, PollinationsAI, Liaobots, OpenaiChat])
  135. )
  136. gpt_4o_mini = Model(
  137. name = 'gpt-4o-mini',
  138. base_provider = 'OpenAI',
  139. best_provider = IterListProvider([DDG, Blackbox, ChatGptEs, TypeGPT, PollinationsAI, OIVSCode, Liaobots, Jmuz, OpenaiChat])
  140. )
  141. gpt_4o_audio = AudioModel(
  142. name = 'gpt-4o-audio',
  143. base_provider = 'OpenAI',
  144. best_provider = PollinationsAI
  145. )
  146. # o1
  147. o1 = Model(
  148. name = 'o1',
  149. base_provider = 'OpenAI',
  150. best_provider = IterListProvider([Blackbox, Copilot, OpenaiAccount])
  151. )
  152. o1_mini = Model(
  153. name = 'o1-mini',
  154. base_provider = 'OpenAI',
  155. best_provider = OpenaiAccount
  156. )
  157. # o3
  158. o3_mini = Model(
  159. name = 'o3-mini',
  160. base_provider = 'OpenAI',
  161. best_provider = IterListProvider([DDG, Blackbox, PollinationsAI, Liaobots])
  162. )
  163. ### GigaChat ###
  164. gigachat = Model(
  165. name = 'GigaChat:latest',
  166. base_provider = 'gigachat',
  167. best_provider = GigaChat
  168. )
  169. ### Meta ###
  170. meta = Model(
  171. name = "meta-ai",
  172. base_provider = "Meta",
  173. best_provider = MetaAI
  174. )
  175. # llama 2
  176. llama_2_7b = Model(
  177. name = "llama-2-7b",
  178. base_provider = "Meta Llama",
  179. best_provider = Cloudflare
  180. )
  181. # llama 3
  182. llama_3_8b = Model(
  183. name = "llama-3-8b",
  184. base_provider = "Meta Llama",
  185. best_provider = IterListProvider([Jmuz, Cloudflare])
  186. )
  187. llama_3_70b = Model(
  188. name = "llama-3-70b",
  189. base_provider = "Meta Llama",
  190. best_provider = Jmuz
  191. )
  192. # llama 3.1
  193. llama_3_1_8b = Model(
  194. name = "llama-3.1-8b",
  195. base_provider = "Meta Llama",
  196. best_provider = IterListProvider([DeepInfraChat, Glider, PollinationsAI, AllenAI, Jmuz, Cloudflare])
  197. )
  198. llama_3_1_70b = Model(
  199. name = "llama-3.1-70b",
  200. base_provider = "Meta Llama",
  201. best_provider = IterListProvider([Glider, AllenAI, Jmuz])
  202. )
  203. llama_3_1_405b = Model(
  204. name = "llama-3.1-405b",
  205. base_provider = "Meta Llama",
  206. best_provider = IterListProvider([AllenAI, Jmuz])
  207. )
  208. # llama 3.2
  209. llama_3_2_1b = Model(
  210. name = "llama-3.2-1b",
  211. base_provider = "Meta Llama",
  212. best_provider = Cloudflare
  213. )
  214. llama_3_2_3b = Model(
  215. name = "llama-3.2-3b",
  216. base_provider = "Meta Llama",
  217. best_provider = Glider
  218. )
  219. llama_3_2_11b = VisionModel(
  220. name = "llama-3.2-11b",
  221. base_provider = "Meta Llama",
  222. best_provider = IterListProvider([Jmuz, HuggingChat, HuggingFace])
  223. )
  224. llama_3_2_90b = Model(
  225. name = "llama-3.2-90b",
  226. base_provider = "Meta Llama",
  227. best_provider = IterListProvider([DeepInfraChat, Jmuz])
  228. )
  229. # llama 3.3
  230. llama_3_3_70b = Model(
  231. name = "llama-3.3-70b",
  232. base_provider = "Meta Llama",
  233. best_provider = IterListProvider([DDG, DeepInfraChat, LambdaChat, PollinationsAI, Jmuz, HuggingChat, HuggingFace])
  234. )
  235. ### Mistral ###
  236. mixtral_8x7b = Model(
  237. name = "mixtral-8x7b",
  238. base_provider = "Mistral",
  239. best_provider = Jmuz
  240. )
  241. mixtral_8x22b = Model(
  242. name = "mixtral-8x22b",
  243. base_provider = "Mistral",
  244. best_provider = DeepInfraChat
  245. )
  246. mistral_nemo = Model(
  247. name = "mistral-nemo",
  248. base_provider = "Mistral",
  249. best_provider = IterListProvider([PollinationsAI, HuggingChat, HuggingFace])
  250. )
  251. mixtral_small_24b = Model(
  252. name = "mixtral-small-24b",
  253. base_provider = "Mistral",
  254. best_provider = IterListProvider([DDG, DeepInfraChat])
  255. )
  256. ### NousResearch ###
  257. hermes_3 = Model(
  258. name = "hermes-3",
  259. base_provider = "NousResearch",
  260. best_provider = LambdaChat
  261. )
  262. ### Microsoft ###
  263. # phi
  264. phi_3_5_mini = Model(
  265. name = "phi-3.5-mini",
  266. base_provider = "Microsoft",
  267. best_provider = HuggingChat
  268. )
  269. phi_4 = Model(
  270. name = "phi-4",
  271. base_provider = "Microsoft",
  272. best_provider = IterListProvider([DeepInfraChat, PollinationsAI, HuggingSpace])
  273. )
  274. # wizardlm
  275. wizardlm_2_7b = Model(
  276. name = 'wizardlm-2-7b',
  277. base_provider = 'Microsoft',
  278. best_provider = DeepInfraChat
  279. )
  280. wizardlm_2_8x22b = Model(
  281. name = 'wizardlm-2-8x22b',
  282. base_provider = 'Microsoft',
  283. best_provider = IterListProvider([DeepInfraChat, Jmuz])
  284. )
  285. ### Google DeepMind ###
  286. # gemini
  287. gemini = Model(
  288. name = 'gemini-2.0',
  289. base_provider = 'Google',
  290. best_provider = Gemini
  291. )
  292. # gemini-exp
  293. gemini_exp = Model(
  294. name = 'gemini-exp',
  295. base_provider = 'Google',
  296. best_provider = Jmuz
  297. )
  298. # gemini-1.5
  299. gemini_1_5_flash = Model(
  300. name = 'gemini-1.5-flash',
  301. base_provider = 'Google DeepMind',
  302. best_provider = IterListProvider([Free2GPT, FreeGpt, TeachAnything, Websim, Dynaspark, Jmuz, GeminiPro])
  303. )
  304. gemini_1_5_pro = Model(
  305. name = 'gemini-1.5-pro',
  306. base_provider = 'Google DeepMind',
  307. best_provider = IterListProvider([Free2GPT, FreeGpt, TeachAnything, Websim, Jmuz, GeminiPro])
  308. )
  309. # gemini-2.0
  310. gemini_2_0_flash = Model(
  311. name = 'gemini-2.0-flash',
  312. base_provider = 'Google DeepMind',
  313. best_provider = IterListProvider([Dynaspark, GeminiPro, Gemini])
  314. )
  315. gemini_2_0_flash_thinking = Model(
  316. name = 'gemini-2.0-flash-thinking',
  317. base_provider = 'Google DeepMind',
  318. best_provider = Gemini
  319. )
  320. gemini_2_0_flash_thinking_with_apps = Model(
  321. name = 'gemini-2.0-flash-thinking-with-apps',
  322. base_provider = 'Google DeepMind',
  323. best_provider = Gemini
  324. )
  325. ### Anthropic ###
  326. # claude 3
  327. claude_3_haiku = Model(
  328. name = 'claude-3-haiku',
  329. base_provider = 'Anthropic',
  330. best_provider = IterListProvider([DDG, Jmuz])
  331. )
  332. # claude 3.5
  333. claude_3_5_sonnet = Model(
  334. name = 'claude-3.5-sonnet',
  335. base_provider = 'Anthropic',
  336. best_provider = IterListProvider([Jmuz, Liaobots])
  337. )
  338. # claude 3.7
  339. claude_3_7_sonnet = Model(
  340. name = 'claude-3.7-sonnet',
  341. base_provider = 'Anthropic',
  342. best_provider = IterListProvider([Blackbox, Liaobots])
  343. )
  344. ### Reka AI ###
  345. reka_core = Model(
  346. name = 'reka-core',
  347. base_provider = 'Reka AI',
  348. best_provider = Reka
  349. )
  350. ### Blackbox AI ###
  351. blackboxai = Model(
  352. name = 'blackboxai',
  353. base_provider = 'Blackbox AI',
  354. best_provider = Blackbox
  355. )
  356. blackboxai_pro = Model(
  357. name = 'blackboxai-pro',
  358. base_provider = 'Blackbox AI',
  359. best_provider = Blackbox
  360. )
  361. ### CohereForAI ###
  362. command_r = Model(
  363. name = 'command-r',
  364. base_provider = 'CohereForAI',
  365. best_provider = HuggingSpace
  366. )
  367. command_r_plus = Model(
  368. name = 'command-r-plus',
  369. base_provider = 'CohereForAI',
  370. best_provider = IterListProvider([HuggingSpace, HuggingChat])
  371. )
  372. command_r7b = Model(
  373. name = 'command-r7b',
  374. base_provider = 'CohereForAI',
  375. best_provider = HuggingSpace
  376. )
  377. command_a = Model(
  378. name = 'command-a',
  379. base_provider = 'CohereForAI',
  380. best_provider = HuggingSpace
  381. )
  382. ### Qwen ###
  383. # qwen-1.5
  384. qwen_1_5_7b = Model(
  385. name = 'qwen-1.5-7b',
  386. base_provider = 'Qwen',
  387. best_provider = Cloudflare
  388. )
  389. # qwen-2
  390. qwen_2_72b = Model(
  391. name = 'qwen-2-72b',
  392. base_provider = 'Qwen',
  393. best_provider = IterListProvider([DeepInfraChat, HuggingSpace])
  394. )
  395. qwen_2_vl_7b = VisionModel(
  396. name = "qwen-2-vl-7b",
  397. base_provider = 'Qwen',
  398. best_provider = HuggingFaceAPI
  399. )
  400. # qwen-2.5
  401. qwen_2_5 = Model(
  402. name = 'qwen-2.5',
  403. base_provider = 'Qwen',
  404. best_provider = HuggingSpace
  405. )
  406. qwen_2_5_72b = Model(
  407. name = 'qwen-2.5-72b',
  408. base_provider = 'Qwen',
  409. best_provider = Jmuz
  410. )
  411. qwen_2_5_coder_32b = Model(
  412. name = 'qwen-2.5-coder-32b',
  413. base_provider = 'Qwen',
  414. best_provider = IterListProvider([PollinationsAI, Jmuz, HuggingChat])
  415. )
  416. qwen_2_5_1m = Model(
  417. name = 'qwen-2.5-1m',
  418. base_provider = 'Qwen',
  419. best_provider = HuggingSpace
  420. )
  421. qwen_2_5_max = Model(
  422. name = 'qwen-2-5-max',
  423. base_provider = 'Qwen',
  424. best_provider = HuggingSpace
  425. )
  426. ### qwq/qvq ###
  427. qwq_32b = Model(
  428. name = 'qwq-32b',
  429. base_provider = 'Qwen',
  430. best_provider = IterListProvider([Jmuz, HuggingChat])
  431. )
  432. qvq_72b = VisionModel(
  433. name = 'qvq-72b',
  434. base_provider = 'Qwen',
  435. best_provider = HuggingSpace
  436. )
  437. ### Inflection ###
  438. pi = Model(
  439. name = 'pi',
  440. base_provider = 'Inflection',
  441. best_provider = Pi
  442. )
  443. ### DeepSeek ###
  444. deepseek_chat = Model(
  445. name = 'deepseek-chat',
  446. base_provider = 'DeepSeek',
  447. best_provider = IterListProvider([Blackbox, Jmuz])
  448. )
  449. deepseek_v3 = Model(
  450. name = 'deepseek-v3',
  451. base_provider = 'DeepSeek',
  452. best_provider = IterListProvider([Blackbox, DeepInfraChat, LambdaChat, OIVSCode, TypeGPT, Liaobots])
  453. )
  454. deepseek_r1 = Model(
  455. name = 'deepseek-r1',
  456. base_provider = 'DeepSeek',
  457. best_provider = IterListProvider([Blackbox, DeepInfraChat, Glider, LambdaChat, PollinationsAI, TypeGPT, Liaobots, Jmuz, HuggingChat, HuggingFace])
  458. )
  459. janus_pro_7b = VisionModel(
  460. name = DeepseekAI_JanusPro7b.default_model,
  461. base_provider = 'DeepSeek',
  462. best_provider = IterListProvider([DeepseekAI_JanusPro7b, G4F])
  463. )
  464. ### x.ai ###
  465. grok_3 = Model(
  466. name = 'grok-3',
  467. base_provider = 'x.ai',
  468. best_provider = Grok
  469. )
  470. grok_3_r1 = Model(
  471. name = 'grok-3-r1',
  472. base_provider = 'x.ai',
  473. best_provider = Grok
  474. )
  475. ### Perplexity AI ###
  476. sonar = Model(
  477. name = 'sonar',
  478. base_provider = 'Perplexity AI',
  479. best_provider = PerplexityLabs
  480. )
  481. sonar_pro = Model(
  482. name = 'sonar-pro',
  483. base_provider = 'Perplexity AI',
  484. best_provider = PerplexityLabs
  485. )
  486. sonar_reasoning = Model(
  487. name = 'sonar-reasoning',
  488. base_provider = 'Perplexity AI',
  489. best_provider = PerplexityLabs
  490. )
  491. sonar_reasoning_pro = Model(
  492. name = 'sonar-reasoning-pro',
  493. base_provider = 'Perplexity AI',
  494. best_provider = PerplexityLabs
  495. )
  496. r1_1776 = Model(
  497. name = 'r1-1776',
  498. base_provider = 'Perplexity AI',
  499. best_provider = PerplexityLabs
  500. )
  501. ### Nvidia ###
  502. nemotron_70b = Model(
  503. name = 'nemotron-70b',
  504. base_provider = 'Nvidia',
  505. best_provider = IterListProvider([LambdaChat, HuggingChat, HuggingFace])
  506. )
  507. ### Databricks ###
  508. dbrx_instruct = Model(
  509. name = 'dbrx-instruct',
  510. base_provider = 'Databricks',
  511. best_provider = DeepInfraChat
  512. )
  513. ### THUDM ###
  514. glm_4 = Model(
  515. name = 'glm-4',
  516. base_provider = 'THUDM',
  517. best_provider = ChatGLM
  518. )
  519. ### MiniMax ###
  520. mini_max = Model(
  521. name = "MiniMax",
  522. base_provider = "MiniMax",
  523. best_provider = HailuoAI
  524. )
  525. ### 01-ai ###
  526. yi_34b = Model(
  527. name = "yi-34b",
  528. base_provider = "01-ai",
  529. best_provider = DeepInfraChat
  530. )
  531. ### Cognitive Computations ###
  532. dolphin_2_6 = Model(
  533. name = "dolphin-2.6",
  534. base_provider = "Cognitive Computations",
  535. best_provider = DeepInfraChat
  536. )
  537. dolphin_2_9 = Model(
  538. name = "dolphin-2.9",
  539. base_provider = "Cognitive Computations",
  540. best_provider = DeepInfraChat
  541. )
  542. ### DeepInfra ###
  543. airoboros_70b = Model(
  544. name = "airoboros-70b",
  545. base_provider = "DeepInfra",
  546. best_provider = DeepInfraChat
  547. )
  548. ### Lizpreciatior ###
  549. lzlv_70b = Model(
  550. name = "lzlv-70b",
  551. base_provider = "Lizpreciatior",
  552. best_provider = DeepInfraChat
  553. )
  554. ### OpenBMB ###
  555. minicpm_2_5 = Model(
  556. name = "minicpm-2.5",
  557. base_provider = "OpenBMB",
  558. best_provider = DeepInfraChat
  559. )
  560. ### Ai2 ###
  561. tulu_3_405b = Model(
  562. name = "tulu-3-405b",
  563. base_provider = "Ai2",
  564. best_provider = AllenAI
  565. )
  566. olmo_2_13b = Model(
  567. name = "olmo-2-13b",
  568. base_provider = "Ai2",
  569. best_provider = AllenAI
  570. )
  571. tulu_3_1_8b = Model(
  572. name = "tulu-3-1-8b",
  573. base_provider = "Ai2",
  574. best_provider = AllenAI
  575. )
  576. tulu_3_70b = Model(
  577. name = "tulu-3-70b",
  578. base_provider = "Ai2",
  579. best_provider = AllenAI
  580. )
  581. olmoe_0125 = Model(
  582. name = "olmoe-0125",
  583. base_provider = "Ai2",
  584. best_provider = AllenAI
  585. )
  586. lfm_40b = Model(
  587. name = "lfm-40b",
  588. base_provider = "Liquid AI",
  589. best_provider = LambdaChat
  590. )
  591. ### Uncensored AI ###
  592. evil = Model(
  593. name = 'evil',
  594. base_provider = 'Evil Mode - Experimental',
  595. best_provider = IterListProvider([PollinationsAI, TypeGPT])
  596. )
  597. #############
  598. ### Image ###
  599. #############
  600. ### Stability AI ###
  601. sdxl_turbo = ImageModel(
  602. name = 'sdxl-turbo',
  603. base_provider = 'Stability AI',
  604. best_provider = IterListProvider([PollinationsImage, ImageLabs])
  605. )
  606. sd_3_5 = ImageModel(
  607. name = 'sd-3.5',
  608. base_provider = 'Stability AI',
  609. best_provider = HuggingSpace
  610. )
  611. ### Black Forest Labs ###
  612. flux = ImageModel(
  613. name = 'flux',
  614. base_provider = 'Black Forest Labs',
  615. best_provider = IterListProvider([Blackbox, PollinationsImage, Websim, HuggingSpace])
  616. )
  617. flux_pro = ImageModel(
  618. name = 'flux-pro',
  619. base_provider = 'Black Forest Labs',
  620. best_provider = PollinationsImage
  621. )
  622. flux_dev = ImageModel(
  623. name = 'flux-dev',
  624. base_provider = 'Black Forest Labs',
  625. best_provider = IterListProvider([PollinationsImage, HuggingSpace, HuggingChat, HuggingFace])
  626. )
  627. flux_schnell = ImageModel(
  628. name = 'flux-schnell',
  629. base_provider = 'Black Forest Labs',
  630. best_provider = IterListProvider([PollinationsImage, HuggingSpace, HuggingChat, HuggingFace])
  631. )
  632. ### OpenAI ###
  633. dall_e_3 = ImageModel(
  634. name = 'dall-e-3',
  635. base_provider = 'OpenAI',
  636. best_provider = IterListProvider([PollinationsImage, CopilotAccount, OpenaiAccount, MicrosoftDesigner, BingCreateImages])
  637. )
  638. ### Midjourney ###
  639. midjourney = ImageModel(
  640. name = 'midjourney',
  641. base_provider = 'Midjourney',
  642. best_provider = PollinationsImage
  643. )
  644. class ModelUtils:
  645. """
  646. Utility class for mapping string identifiers to Model instances.
  647. Attributes:
  648. convert (dict[str, Model]): Dictionary mapping model string identifiers to Model instances.
  649. """
  650. convert: dict[str, Model] = {
  651. ############
  652. ### Text ###
  653. ############
  654. ### OpenAI ###
  655. # gpt-3.5
  656. gpt_3_5_turbo.name: gpt_3_5_turbo,
  657. # gpt-4
  658. gpt_4.name: gpt_4,
  659. # gpt-4o
  660. gpt_4o.name: gpt_4o,
  661. gpt_4o_mini.name: gpt_4o_mini,
  662. gpt_4o_audio.name: gpt_4o_audio,
  663. # o1
  664. o1.name: o1,
  665. o1_mini.name: o1_mini,
  666. # o3
  667. o3_mini.name: o3_mini,
  668. ### Meta ###
  669. meta.name: meta,
  670. # llama-2
  671. llama_2_7b.name: llama_2_7b,
  672. # llama-3
  673. llama_3_8b.name: llama_3_8b,
  674. llama_3_70b.name: llama_3_70b,
  675. # llama-3.1
  676. llama_3_1_8b.name: llama_3_1_8b,
  677. llama_3_1_70b.name: llama_3_1_70b,
  678. llama_3_1_405b.name: llama_3_1_405b,
  679. # llama-3.2
  680. llama_3_2_1b.name: llama_3_2_1b,
  681. llama_3_2_3b.name: llama_3_2_3b,
  682. llama_3_2_11b.name: llama_3_2_11b,
  683. llama_3_2_90b.name: llama_3_2_90b,
  684. # llama-3.3
  685. llama_3_3_70b.name: llama_3_3_70b,
  686. ### Mistral ###
  687. mixtral_8x7b.name: mixtral_8x7b,
  688. mixtral_8x22b.name: mixtral_8x22b,
  689. mistral_nemo.name: mistral_nemo,
  690. mixtral_small_24b.name: mixtral_small_24b,
  691. ### NousResearch ###
  692. hermes_3.name: hermes_3,
  693. ### Microsoft ###
  694. # phi
  695. phi_3_5_mini.name: phi_3_5_mini,
  696. phi_4.name: phi_4,
  697. # wizardlm
  698. wizardlm_2_7b.name: wizardlm_2_7b,
  699. wizardlm_2_8x22b.name: wizardlm_2_8x22b,
  700. ### Google ###
  701. ### Gemini
  702. "gemini": gemini,
  703. gemini.name: gemini,
  704. gemini_exp.name: gemini_exp,
  705. gemini_1_5_pro.name: gemini_1_5_pro,
  706. gemini_1_5_flash.name: gemini_1_5_flash,
  707. gemini_2_0_flash.name: gemini_2_0_flash,
  708. gemini_2_0_flash_thinking.name: gemini_2_0_flash_thinking,
  709. gemini_2_0_flash_thinking_with_apps.name: gemini_2_0_flash_thinking_with_apps,
  710. ### Anthropic ###
  711. # claude 3
  712. claude_3_haiku.name: claude_3_haiku,
  713. # claude 3.5
  714. claude_3_5_sonnet.name: claude_3_5_sonnet,
  715. # claude 3.7
  716. claude_3_7_sonnet.name: claude_3_7_sonnet,
  717. ### Reka AI ###
  718. reka_core.name: reka_core,
  719. ### Blackbox AI ###
  720. blackboxai.name: blackboxai,
  721. blackboxai_pro.name: blackboxai_pro,
  722. ### CohereForAI ###
  723. command_r.name: command_r,
  724. command_r_plus.name: command_r_plus,
  725. command_r7b.name: command_r7b,
  726. command_a.name: command_a,
  727. ### GigaChat ###
  728. gigachat.name: gigachat,
  729. ### Qwen ###
  730. # qwen-1.5
  731. qwen_1_5_7b.name: qwen_1_5_7b,
  732. # qwen-2
  733. qwen_2_72b.name: qwen_2_72b,
  734. qwen_2_vl_7b.name: qwen_2_vl_7b,
  735. # qwen-2.5
  736. qwen_2_5.name: qwen_2_5,
  737. qwen_2_5_72b.name: qwen_2_5_72b,
  738. qwen_2_5_coder_32b.name: qwen_2_5_coder_32b,
  739. qwen_2_5_1m.name: qwen_2_5_1m,
  740. qwen_2_5_max.name: qwen_2_5_max,
  741. # qwq/qvq
  742. qwq_32b.name: qwq_32b,
  743. qvq_72b.name: qvq_72b,
  744. ### Inflection ###
  745. pi.name: pi,
  746. ### x.ai ###
  747. grok_3.name: grok_3,
  748. ### Perplexity AI ###
  749. sonar.name: sonar,
  750. sonar_pro.name: sonar_pro,
  751. sonar_reasoning.name: sonar_reasoning,
  752. sonar_reasoning_pro.name: sonar_reasoning_pro,
  753. r1_1776.name: r1_1776,
  754. ### DeepSeek ###
  755. deepseek_chat.name: deepseek_chat,
  756. deepseek_v3.name: deepseek_v3,
  757. deepseek_r1.name: deepseek_r1,
  758. ### Nvidia ###
  759. nemotron_70b.name: nemotron_70b,
  760. ### Databricks ###
  761. dbrx_instruct.name: dbrx_instruct,
  762. ### THUDM ###
  763. glm_4.name: glm_4,
  764. ## MiniMax ###
  765. mini_max.name: mini_max,
  766. ## 01-ai ###
  767. yi_34b.name: yi_34b,
  768. ### Cognitive Computations ###
  769. dolphin_2_6.name: dolphin_2_6,
  770. dolphin_2_9.name: dolphin_2_9,
  771. ### DeepInfra ###
  772. airoboros_70b.name: airoboros_70b,
  773. ### Lizpreciatior ###
  774. lzlv_70b.name: lzlv_70b,
  775. ### OpenBMB ###
  776. minicpm_2_5.name: minicpm_2_5,
  777. ### Ai2 ###
  778. tulu_3_405b.name: tulu_3_405b,
  779. olmo_2_13b.name: olmo_2_13b,
  780. tulu_3_1_8b.name: tulu_3_1_8b,
  781. tulu_3_70b.name: tulu_3_70b,
  782. olmoe_0125.name: olmoe_0125,
  783. ### Liquid AI ###
  784. lfm_40b.name: lfm_40b,
  785. ### Uncensored AI ###
  786. evil.name: evil,
  787. #############
  788. ### Image ###
  789. #############
  790. ### Stability AI ###
  791. sdxl_turbo.name: sdxl_turbo,
  792. sd_3_5.name: sd_3_5,
  793. ### Flux AI ###
  794. flux.name: flux,
  795. flux_pro.name: flux_pro,
  796. flux_dev.name: flux_dev,
  797. flux_schnell.name: flux_schnell,
  798. ### OpenAI ###
  799. dall_e_3.name: dall_e_3,
  800. ### Midjourney ###
  801. midjourney.name: midjourney,
  802. }
  803. demo_models = {
  804. llama_3_2_11b.name: [llama_3_2_11b, [HuggingChat]],
  805. qwen_2_vl_7b.name: [qwen_2_vl_7b, [HuggingFaceAPI]],
  806. deepseek_r1.name: [deepseek_r1, [HuggingFace, PollinationsAI]],
  807. janus_pro_7b.name: [janus_pro_7b, [HuggingSpace, G4F]],
  808. command_r.name: [command_r, [HuggingSpace]],
  809. command_r_plus.name: [command_r_plus, [HuggingSpace]],
  810. command_r7b.name: [command_r7b, [HuggingSpace]],
  811. qwen_2_5_coder_32b.name: [qwen_2_5_coder_32b, [HuggingFace]],
  812. qwq_32b.name: [qwq_32b, [HuggingFace]],
  813. llama_3_3_70b.name: [llama_3_3_70b, [HuggingFace]],
  814. sd_3_5.name: [sd_3_5, [HuggingSpace, HuggingFace]],
  815. flux_dev.name: [flux_dev, [PollinationsImage, HuggingFace, HuggingSpace]],
  816. flux_schnell.name: [flux_schnell, [PollinationsImage, HuggingFace, HuggingSpace]],
  817. }
  818. # Create a list of all models and his providers
  819. __models__ = {
  820. model.name: (model, providers)
  821. for model, providers in [
  822. (model, [provider for provider in model.best_provider.providers if provider.working]
  823. if isinstance(model.best_provider, IterListProvider)
  824. else [model.best_provider]
  825. if model.best_provider is not None and model.best_provider.working
  826. else [])
  827. for model in ModelUtils.convert.values()]
  828. if providers
  829. }
  830. _all_models = list(__models__.keys())