BlackboxPro.py 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  1. from __future__ import annotations
  2. from aiohttp import ClientSession
  3. import os
  4. import re
  5. import json
  6. import random
  7. import string
  8. from pathlib import Path
  9. from typing import Optional
  10. from datetime import datetime, timedelta
  11. from ...typing import AsyncResult, Messages, MediaListType
  12. from ...requests.raise_for_status import raise_for_status
  13. from ..base_provider import AsyncGeneratorProvider, ProviderModelMixin
  14. from ..openai.har_file import get_har_files
  15. from ...image import to_data_uri
  16. from ...cookies import get_cookies_dir
  17. from ..helper import format_image_prompt, render_messages
  18. from ...providers.response import JsonConversation, ImageResponse
  19. from ...tools.media import merge_media
  20. from ...errors import RateLimitError, NoValidHarFileError
  21. from ... import debug
  22. class Conversation(JsonConversation):
  23. validated_value: str = None
  24. chat_id: str = None
  25. message_history: Messages = []
  26. def __init__(self, model: str):
  27. self.model = model
  28. class BlackboxPro(AsyncGeneratorProvider, ProviderModelMixin):
  29. label = "Blackbox AI Pro"
  30. url = "https://www.blackbox.ai"
  31. login_url = None
  32. api_endpoint = "https://www.blackbox.ai/api/chat"
  33. working = True
  34. needs_auth = True
  35. supports_stream = True
  36. supports_system_message = True
  37. supports_message_history = True
  38. default_model = "blackboxai"
  39. default_vision_model = default_model
  40. default_image_model = 'flux'
  41. # OpenRouter Free
  42. openrouter_free_models = [
  43. "Deepcoder 14B Preview",
  44. "DeepHermes 3 Llama 3 8B Preview",
  45. "DeepSeek R1 Zero",
  46. "DeepSeek V3",
  47. "DeepSeek V3 0324",
  48. "DeepSeek V3 Base",
  49. "Dolphin3.0 Mistral 24B",
  50. "Dolphin3.0 R1 Mistral 24B",
  51. "Flash 3",
  52. "Gemini 2.0 Flash Experimental",
  53. "Gemini 2.0 Flash Thinking Experimental",
  54. "Gemini 2.0 Flash Thinking Experimental 01-21",
  55. "Gemma 2 9B",
  56. "Gemma 3 12B",
  57. "Gemma 3 1B",
  58. "Gemma 3 27B",
  59. "Gemma 3 4B",
  60. "Kimi VL A3B Thinking",
  61. "LearnLM 1.5 Pro Experimental",
  62. "Llama 3.1 8B Instruct",
  63. "Llama 3.1 Nemotron 70B Instruct",
  64. "Llama 3.1 Nemotron Nano 8B v1",
  65. "Llama 3.1 Nemotron Ultra 253B v1",
  66. "Llama 3.2 11B Vision Instruct",
  67. "Llama 3.2 1B Instruct",
  68. "Llama 3.2 3B Instruct",
  69. "Llama 3.3 70B Instruct",
  70. "Llama 3.3 Nemotron Super 49B v1",
  71. "Llama 4 Maverick",
  72. "Llama 4 Scout",
  73. "Mistral 7B Instruct",
  74. "Mistral Nemo",
  75. "Mistral Small 3",
  76. "Mistral Small 3.1 24B",
  77. "Molmo 7B D",
  78. "Moonlight 16B A3B Instruct",
  79. "OlympicCoder 32B",
  80. "OlympicCoder 7B",
  81. "Qwen2.5 72B Instruct",
  82. "Qwen2.5 7B Instruct",
  83. "Qwen2.5 Coder 32B Instruct",
  84. "Qwen2.5 VL 32B Instruct",
  85. "Qwen2.5 VL 3B Instruct",
  86. "Qwen2.5 VL 72B Instruct",
  87. "Qwen2.5-VL 7B Instruct",
  88. "Qwerky 72B",
  89. "QwQ 32B",
  90. "QwQ 32B Preview",
  91. "QwQ 32B RpR v1",
  92. "R1",
  93. "R1 Distill Llama 70B",
  94. "R1 Distill Qwen 14B",
  95. "R1 Distill Qwen 32B",
  96. "Rogue Rose 103B v0.2",
  97. "UI-TARS 72B",
  98. "Zephyr 7B",
  99. ]
  100. # Free models (available without subscription)
  101. fallback_models = [
  102. default_model,
  103. "gpt-4o-mini",
  104. "DeepSeek-V3",
  105. "DeepSeek-R1",
  106. "Meta-Llama-3.3-70B-Instruct-Turbo",
  107. "Mistral-Small-24B-Instruct-2501",
  108. "DeepSeek-LLM-Chat-(67B)",
  109. "Qwen-QwQ-32B-Preview",
  110. # OpenRouter Free
  111. *openrouter_free_models,
  112. # Image models
  113. "flux",
  114. # Trending agent modes
  115. 'Python Agent',
  116. 'HTML Agent',
  117. 'Builder Agent',
  118. 'Java Agent',
  119. 'JavaScript Agent',
  120. 'React Agent',
  121. 'Android Agent',
  122. 'Flutter Agent',
  123. 'Next.js Agent',
  124. 'AngularJS Agent',
  125. 'Swift Agent',
  126. 'MongoDB Agent',
  127. 'PyTorch Agent',
  128. 'Xcode Agent',
  129. 'Azure Agent',
  130. 'Bitbucket Agent',
  131. 'DigitalOcean Agent',
  132. 'Docker Agent',
  133. 'Electron Agent',
  134. 'Erlang Agent',
  135. 'FastAPI Agent',
  136. 'Firebase Agent',
  137. 'Flask Agent',
  138. 'Git Agent',
  139. 'Gitlab Agent',
  140. 'Go Agent',
  141. 'Godot Agent',
  142. 'Google Cloud Agent',
  143. 'Heroku Agent',
  144. ]
  145. # Premium models (require subscription)
  146. premium_models = [
  147. "GPT-4o",
  148. "o1",
  149. "o3-mini",
  150. "Claude-sonnet-3.7",
  151. "Claude-sonnet-3.5",
  152. "Gemini-Flash-2.0",
  153. "DBRX-Instruct",
  154. "blackboxai-pro",
  155. "Gemini-PRO",
  156. ]
  157. # Premium/Pro models (require subscription) (OpenRouter)
  158. openrouter_pro_models = [
  159. "Aion-1.0",
  160. "Aion-1.0-Mini",
  161. "Aion-RP 1.0 (8B)",
  162. "Airoboros 70B",
  163. "Anubis Pro 105B V1",
  164. "Arctic Instruct",
  165. "Auto Router",
  166. "Bagel 34B v0.2",
  167. "Capybara 34B",
  168. "Capybara 7B",
  169. "ChatGPT-4o",
  170. "Chronos Hermes 13B v2",
  171. "Cinematika 7B (alpha)",
  172. "Claude 3 Haiku",
  173. "Claude 3 Haiku (self-moderated)",
  174. "Claude 3 Opus",
  175. "Claude 3 Opus (self-moderated)",
  176. "Claude 3 Sonnet",
  177. "Claude 3 Sonnet (self-moderated)",
  178. "Claude 3.5 Haiku",
  179. "Claude 3.5 Haiku (2024-10-22)",
  180. "Claude 3.5 Haiku (2024-10-22) (self-moderated)",
  181. "Claude 3.5 Haiku (self-moderated)",
  182. "Claude 3.5 Sonnet",
  183. "Claude 3.5 Sonnet (2024-06-20)",
  184. "Claude 3.5 Sonnet (2024-06-20) (self-moderated)",
  185. "Claude 3.5 Sonnet (self-moderated)",
  186. "Claude 3.7 Sonnet",
  187. "Claude 3.7 Sonnet (self-moderated)",
  188. "Claude 3.7 Sonnet (thinking)",
  189. "Claude Instant v1",
  190. "Claude Instant v1.0",
  191. "Claude Instant v1.1",
  192. "Claude v1",
  193. "Claude v1.2",
  194. "Claude v2",
  195. "Claude v2 (self-moderated)",
  196. "Claude v2.0",
  197. "Claude v2.0 (self-moderated)",
  198. "Claude v2.1",
  199. "Claude v2.1 (self-moderated)",
  200. "CodeLlama 34B Instruct",
  201. "CodeLlama 34B v2",
  202. "CodeLlama 70B Instruct",
  203. "CodeLLaMa 7B Instruct Solidity",
  204. "Codestral 2501",
  205. "Codestral Mamba",
  206. "Command",
  207. "Command A",
  208. "Command R",
  209. "Command R (03-2024)",
  210. "Command R (08-2024)",
  211. "Command R+",
  212. "Command R+ (04-2024)",
  213. "Command R+ (08-2024)",
  214. "Command R7B (12-2024)",
  215. "DBRX 132B Instruct",
  216. "DeepSeek R1",
  217. "DeepSeek V2.5",
  218. "DeepSeek V3",
  219. "DeepSeek V3 0324",
  220. "DeepSeek-Coder-V2",
  221. "Dolphin 2.6 Mixtral 8x7B \uD83D\uDC2C",
  222. "Dolphin 2.9.2 Mixtral 8x22B \uD83D\uDC2C",
  223. "Dolphin Llama 3 70B \uD83D\uDC2C",
  224. "Eagle 7B",
  225. "EVA Llama 3.33 70B",
  226. "EVA Qwen2.5 14B",
  227. "EVA Qwen2.5 32B",
  228. "EVA Qwen2.5 72B",
  229. "Fimbulvetr 11B v2",
  230. "FireLLaVA 13B",
  231. "Gemini 1.5 Flash ",
  232. "Gemini 1.5 Flash 8B",
  233. "Gemini 1.5 Flash 8B Experimental",
  234. "Gemini 1.5 Flash Experimental",
  235. "Gemini 1.5 Pro",
  236. "Gemini 1.5 Pro Experimental",
  237. "Gemini 2.0 Flash",
  238. "Gemini 2.0 Flash Lite",
  239. "Gemini 2.5 Pro",
  240. "Gemini Experimental 1114",
  241. "Gemini Experimental 1121",
  242. "Gemini Pro 1.0",
  243. "Gemini Pro Vision 1.0",
  244. "Gemma 2 27B",
  245. "Gemma 2 9B",
  246. "Gemma 3 12B",
  247. "Gemma 3 27B",
  248. "Gemma 3 4B",
  249. "Gemma 7B",
  250. "Goliath 120B",
  251. "GPT-3.5 Turbo",
  252. "GPT-3.5 Turbo (older v0301)",
  253. "GPT-3.5 Turbo (older v0613)",
  254. "GPT-3.5 Turbo 16k",
  255. "GPT-3.5 Turbo 16k",
  256. "GPT-3.5 Turbo 16k (older v1106)",
  257. "GPT-3.5 Turbo Instruct",
  258. "GPT-4",
  259. "GPT-4 (older v0314)",
  260. "GPT-4 32k",
  261. "GPT-4 32k (older v0314)",
  262. "GPT-4 Turbo",
  263. "GPT-4 Turbo (older v1106)",
  264. "GPT-4 Turbo Preview",
  265. "GPT-4 Vision",
  266. "GPT-4.1",
  267. "GPT-4.1 Mini",
  268. "GPT-4.1 Nano",
  269. "GPT-4.5 (Preview)",
  270. "GPT-4o",
  271. "GPT-4o (2024-05-13)",
  272. "GPT-4o (2024-08-06)",
  273. "GPT-4o (2024-11-20)",
  274. "GPT-4o (extended)",
  275. "GPT-4o Search Preview",
  276. "GPT-4o-mini",
  277. "GPT-4o-mini (2024-07-18)",
  278. "GPT-4o-mini Search Preview",
  279. "Grok 2",
  280. "Grok 2 1212",
  281. "Grok 2 mini",
  282. "Grok 2 Vision 1212",
  283. "Grok 3",
  284. "Grok 3 Mini Beta",
  285. "Grok Beta",
  286. "Grok Vision Beta",
  287. "Hermes 13B",
  288. "Hermes 2 Mistral 7B DPO",
  289. "Hermes 2 Mixtral 8x7B DPO",
  290. "Hermes 2 Mixtral 8x7B SFT",
  291. "Hermes 2 Pro - Llama-3 8B",
  292. "Hermes 2 Theta 8B",
  293. "Hermes 2 Vision 7B (alpha)",
  294. "Hermes 2 Yi 34B",
  295. "Hermes 3 405B Instruct",
  296. "Hermes 3 70B Instruct",
  297. "Hermes 70B",
  298. "Inflection 3 Pi",
  299. "Inflection 3 Productivity",
  300. "Jamba 1.5 Large",
  301. "Jamba 1.5 Mini",
  302. "Jamba 1.6 Large",
  303. "Jamba Instruct",
  304. "Jamba Mini 1.6",
  305. "L3.3 Electra R1 70B",
  306. "LFM 3B",
  307. "LFM 40B MoE",
  308. "LFM 7B",
  309. "Llama 2 13B Chat",
  310. "Llama 2 70B Chat",
  311. "Llama 3 70B (Base)",
  312. "Llama 3 70B Instruct",
  313. "Llama 3 8B (Base)",
  314. "Llama 3 8B Instruct",
  315. "Llama 3 8B Lunaris",
  316. "Llama 3 Euryale 70B v2.1",
  317. "Llama 3 Lumimaid 70B",
  318. "Llama 3 Lumimaid 8B",
  319. "Llama 3 Lumimaid 8B (extended)",
  320. "Llama 3 Soliloquy 7B v3 32K",
  321. "Llama 3 Soliloquy 8B v2",
  322. "Llama 3 Stheno 8B v3.3 32K",
  323. "Llama 3.1 405B (base)",
  324. "Llama 3.1 405B Instruct",
  325. "Llama 3.1 70B Hanami x1",
  326. "Llama 3.1 70B Instruct",
  327. "Llama 3.1 8B Instruct",
  328. "Llama 3.1 Euryale 70B v2.2",
  329. "Llama 3.1 Nemotron 70B Instruct",
  330. "Llama 3.1 Swallow 70B Instruct V0.3",
  331. "Llama 3.1 Swallow 8B Instruct V0.3",
  332. "Llama 3.1 Tulu 3 405B",
  333. "Llama 3.2 11B Vision Instruct",
  334. "Llama 3.2 1B Instruct",
  335. "Llama 3.2 3B Instruct",
  336. "Llama 3.2 90B Vision Instruct",
  337. "Llama 3.3 70B Instruct",
  338. "Llama 3.3 Euryale 70B",
  339. "Llama 4 Maverick",
  340. "Llama 4 Scout",
  341. "Llama Guard 3 8B",
  342. "LlamaGuard 2 8B",
  343. "LLaVA 13B",
  344. "LLaVA v1.6 34B",
  345. "Llemma 7b",
  346. "Lumimaid v0.2 70B",
  347. "Lumimaid v0.2 8B",
  348. "lzlv 70B",
  349. "Mag Mell R1 12B",
  350. "Magnum 72B",
  351. "Magnum v2 72B",
  352. "Magnum v4 72B",
  353. "Midnight Rose 70B",
  354. "MiniMax-01",
  355. "Ministral 3B",
  356. "Ministral 8B",
  357. "Ministral 8B",
  358. "Mistral 7B Instruct",
  359. "Mistral 7B Instruct v0.1",
  360. "Mistral 7B Instruct v0.2",
  361. "Mistral 7B Instruct v0.3",
  362. "Mistral Large",
  363. "Mistral Large 2407",
  364. "Mistral Large 2411",
  365. "Mistral Medium",
  366. "Mistral Nemo",
  367. "Mistral Nemo 12B Celeste",
  368. "Mistral Nemo Inferor 12B",
  369. "Mistral OpenOrca 7B",
  370. "Mistral Small",
  371. "Mistral Small 3",
  372. "Mistral Small 3.1 24B",
  373. "Mistral Tiny",
  374. "Mixtral 8x22B (base)",
  375. "Mixtral 8x22B Instruct",
  376. "Mixtral 8x7B Instruct",
  377. "Mythalion 13B",
  378. "MythoMax 13B",
  379. "MythoMist 7B",
  380. "Nemotron-4 340B Instruct",
  381. "Neural Chat 7B v3.1",
  382. "Noromaid 20B",
  383. "Noromaid Mixtral 8x7B Instruct",
  384. "Nova Lite 1.0",
  385. "Nova Micro 1.0",
  386. "Nova Pro 1.0",
  387. "o1",
  388. "o1-mini",
  389. "o1-mini (2024-09-12)",
  390. "o1-preview",
  391. "o1-preview (2024-09-12)",
  392. "o1-pro",
  393. "o3 Mini",
  394. "o3 Mini High",
  395. "Olmo 2 32B Instruct",
  396. "OLMo 7B Instruct",
  397. "OpenChat 3.5 7B",
  398. "OpenChat 3.6 8B",
  399. "OpenHands LM 32B V0.1",
  400. "OpenHermes 2 Mistral 7B",
  401. "OpenHermes 2.5 Mistral 7B",
  402. "Optimus Alpha",
  403. "PaLM 2 Chat",
  404. "PaLM 2 Chat 32k",
  405. "PaLM 2 Code Chat",
  406. "PaLM 2 Code Chat 32k",
  407. "Phi 4",
  408. "Phi 4 Multimodal Instruct",
  409. "Phi-3 Medium 128K Instruct",
  410. "Phi-3 Medium 4K Instruct",
  411. "Phi-3 Mini 128K Instruct",
  412. "Phi-3.5 Mini 128K Instruct",
  413. "Pixtral 12B",
  414. "Pixtral Large 2411",
  415. "Psyfighter 13B",
  416. "Psyfighter v2 13B",
  417. "Quasar Alpha",
  418. "Qwen 1.5 110B Chat",
  419. "Qwen 1.5 14B Chat",
  420. "Qwen 1.5 32B Chat",
  421. "Qwen 1.5 4B Chat",
  422. "Qwen 1.5 72B Chat",
  423. "Qwen 1.5 7B Chat",
  424. "Qwen 2 72B Instruct",
  425. "Qwen 2 7B Instruct",
  426. "Qwen VL Max",
  427. "Qwen VL Plus",
  428. "Qwen-Max ",
  429. "Qwen-Plus",
  430. "Qwen-Turbo",
  431. "Qwen2.5 32B Instruct",
  432. "Qwen2.5 72B Instruct",
  433. "Qwen2.5 7B Instruct",
  434. "Qwen2.5 Coder 32B Instruct",
  435. "Qwen2.5 VL 32B Instruct",
  436. "Qwen2.5 VL 72B Instruct",
  437. "Qwen2.5-VL 72B Instruct",
  438. "Qwen2.5-VL 7B Instruct",
  439. "QwQ 32B",
  440. "QwQ 32B Preview",
  441. "R1",
  442. "R1 Distill Llama 70B",
  443. "R1 Distill Llama 8B",
  444. "R1 Distill Qwen 1.5B",
  445. "R1 Distill Qwen 14B",
  446. "R1 Distill Qwen 32B",
  447. "Reflection 70B",
  448. "ReMM SLERP 13B",
  449. "Rocinante 12B",
  450. "RWKV v5 3B AI Town",
  451. "RWKV v5 World 3B",
  452. "Saba",
  453. "Skyfall 36B V2",
  454. "SorcererLM 8x22B",
  455. "Starcannon 12B",
  456. "StarCoder2 15B Instruct",
  457. "StripedHyena Hessian 7B (base)",
  458. "StripedHyena Nous 7B",
  459. "Synthia 70B",
  460. "Toppy M 7B",
  461. "Typhoon2 70B Instruct",
  462. "Typhoon2 8B Instruct",
  463. "Unslopnemo 12B",
  464. "Wayfarer Large 70B Llama 3.3",
  465. "Weaver (alpha)",
  466. "WizardLM-2 7B",
  467. "WizardLM-2 8x22B",
  468. "Xwin 70B",
  469. "Yi 1.5 34B Chat",
  470. "Yi 34B (base)",
  471. "Yi 34B 200K",
  472. "Yi 34B Chat",
  473. "Yi 6B (base)",
  474. "Yi Large",
  475. "Yi Large FC",
  476. "Yi Large Turbo",
  477. "Yi Vision",
  478. "Zephyr 141B-A35B",
  479. ]
  480. image_models = [default_image_model]
  481. vision_models = [default_vision_model, 'GPT-4o', 'o1', 'o3-mini', 'Gemini-PRO', 'Gemini Agent', 'llama-3.1-8b Agent', 'llama-3.1-70b Agent', 'llama-3.1-405 Agent', 'Gemini-Flash-2.0', 'DeepSeek-V3']
  482. userSelectedModel = ['GPT-4o', 'o1', 'o3-mini', 'Gemini-PRO', 'Claude-sonnet-3.7', 'Claude-sonnet-3.5', 'DeepSeek-V3', 'DeepSeek-R1', 'Meta-Llama-3.3-70B-Instruct-Turbo', 'Mistral-Small-24B-Instruct-2501', 'DeepSeek-LLM-Chat-(67B)', 'DBRX-Instruct', 'Qwen-QwQ-32B-Preview', 'Nous-Hermes-2-Mixtral-8x7B-DPO', 'Gemini-Flash-2.0'] + openrouter_pro_models
  483. # Agent mode configurations
  484. agentMode = {
  485. # Free (OpenRouter)
  486. 'Deepcoder 14B Preview': {'mode': True, 'id': "agentica-org/deepcoder-14b-preview:free", 'name': "Deepcoder 14B Preview"},
  487. 'DeepHermes 3 Llama 3 8B Preview': {'mode': True, 'id': "nousresearch/deephermes-3-llama-3-8b-preview:free", 'name': "DeepHermes 3 Llama 3 8B Preview"},
  488. 'DeepSeek R1 Zero': {'mode': True, 'id': "deepseek/deepseek-r1-zero:free", 'name': "DeepSeek R1 Zero"},
  489. 'DeepSeek V3': {'mode': True, 'id': "deepseek/deepseek-chat:free", 'name': "DeepSeek V3"},
  490. 'DeepSeek V3 0324': {'mode': True, 'id': "deepseek/deepseek-chat-v3-0324:free", 'name': "DeepSeek V3 0324"},
  491. 'DeepSeek V3 Base': {'mode': True, 'id': "deepseek/deepseek-v3-base:free", 'name': "DeepSeek V3 Base"},
  492. 'Dolphin3.0 Mistral 24B': {'mode': True, 'id': "cognitivecomputations/dolphin3.0-mistral-24b:free", 'name': "Dolphin3.0 Mistral 24B"},
  493. 'Dolphin3.0 R1 Mistral 24B': {'mode': True, 'id': "cognitivecomputations/dolphin3.0-r1-mistral-24b:free", 'name': "Dolphin3.0 R1 Mistral 24B"},
  494. 'Flash 3': {'mode': True, 'id': "rekaai/reka-flash-3:free", 'name': "Flash 3"},
  495. 'Gemini 2.0 Flash Experimental': {'mode': True, 'id': "google/gemini-2.0-flash-exp:free", 'name': "Gemini 2.0 Flash Experimental"},
  496. 'Gemini 2.0 Flash Thinking Experimental': {'mode': True, 'id': "google/gemini-2.0-flash-thinking-exp-1219:free", 'name': "Gemini 2.0 Flash Thinking Experimental"},
  497. 'Gemini 2.0 Flash Thinking Experimental 01-21': {'mode': True, 'id': "google/gemini-2.0-flash-thinking-exp:free", 'name': "Gemini 2.0 Flash Thinking Experimental 01-21"},
  498. 'Gemma 2 9B': {'mode': True, 'id': "google/gemma-2-9b-it:free", 'name': "Gemma 2 9B"},
  499. 'Gemma 3 12B': {'mode': True, 'id': "google/gemma-3-12b-it:free", 'name': "Gemma 3 12B"},
  500. 'Gemma 3 1B': {'mode': True, 'id': "google/gemma-3-1b-it:free", 'name': "Gemma 3 1B"},
  501. 'Gemma 3 27B': {'mode': True, 'id': "google/gemma-3-27b-it:free", 'name': "Gemma 3 27B"},
  502. 'Gemma 3 4B': {'mode': True, 'id': "google/gemma-3-4b-it:free", 'name': "Gemma 3 4B"},
  503. 'Kimi VL A3B Thinking': {'mode': True, 'id': "moonshotai/kimi-vl-a3b-thinking:free", 'name': "Kimi VL A3B Thinking"},
  504. 'LearnLM 1.5 Pro Experimental': {'mode': True, 'id': "google/learnlm-1.5-pro-experimental:free", 'name': "LearnLM 1.5 Pro Experimental"},
  505. 'Llama 3.1 8B Instruct': {'mode': True, 'id': "meta-llama/llama-3.1-8b-instruct:free", 'name': "Llama 3.1 8B Instruct"},
  506. 'Llama 3.1 Nemotron 70B Instruct': {'mode': True, 'id': "nvidia/llama-3.1-nemotron-70b-instruct:free", 'name': "Llama 3.1 Nemotron 70B Instruct"},
  507. 'Llama 3.1 Nemotron Nano 8B v1': {'mode': True, 'id': "nvidia/llama-3.1-nemotron-nano-8b-v1:free", 'name': "Llama 3.1 Nemotron Nano 8B v1"},
  508. 'Llama 3.1 Nemotron Ultra 253B v1': {'mode': True, 'id': "nvidia/llama-3.1-nemotron-ultra-253b-v1:free", 'name': "Llama 3.1 Nemotron Ultra 253B v1"},
  509. 'Llama 3.2 11B Vision Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-11b-vision-instruct:free", 'name': "Llama 3.2 11B Vision Instruct"},
  510. 'Llama 3.2 1B Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-1b-instruct:free", 'name': "Llama 3.2 1B Instruct"},
  511. 'Llama 3.2 3B Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-3b-instruct:free", 'name': "Llama 3.2 3B Instruct"},
  512. 'Llama 3.3 70B Instruct': {'mode': True, 'id': "meta-llama/llama-3.3-70b-instruct:free", 'name': "Llama 3.3 70B Instruct"},
  513. 'Llama 3.3 Nemotron Super 49B v1': {'mode': True, 'id': "nvidia/llama-3.3-nemotron-super-49b-v1:free", 'name': "Llama 3.3 Nemotron Super 49B v1"},
  514. 'Llama 4 Maverick': {'mode': True, 'id': "meta-llama/llama-4-maverick:free", 'name': "Llama 4 Maverick"},
  515. 'Llama 4 Scout': {'mode': True, 'id': "meta-llama/llama-4-scout:free", 'name': "Llama 4 Scout"},
  516. 'Mistral 7B Instruct': {'mode': True, 'id': "mistralai/mistral-7b-instruct:free", 'name': "Mistral 7B Instruct"},
  517. 'Mistral Nemo': {'mode': True, 'id': "mistralai/mistral-nemo:free", 'name': "Mistral Nemo"},
  518. 'Mistral Small 3': {'mode': True, 'id': "mistralai/mistral-small-24b-instruct-2501:free", 'name': "Mistral Small 3"},
  519. 'Mistral Small 3.1 24B': {'mode': True, 'id': "mistralai/mistral-small-3.1-24b-instruct:free", 'name': "Mistral Small 3.1 24B"},
  520. 'Molmo 7B D': {'mode': True, 'id': "allenai/molmo-7b-d:free", 'name': "Molmo 7B D"},
  521. 'Moonlight 16B A3B Instruct': {'mode': True, 'id': "moonshotai/moonlight-16b-a3b-instruct:free", 'name': "Moonlight 16B A3B Instruct"},
  522. 'OlympicCoder 32B': {'mode': True, 'id': "open-r1/olympiccoder-32b:free", 'name': "OlympicCoder 32B"},
  523. 'OlympicCoder 7B': {'mode': True, 'id': "open-r1/olympiccoder-7b:free", 'name': "OlympicCoder 7B"},
  524. 'Qwen2.5 72B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-72b-instruct:free", 'name': "Qwen2.5 72B Instruct"},
  525. 'Qwen2.5 7B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-7b-instruct:free", 'name': "Qwen2.5 7B Instruct"},
  526. 'Qwen2.5 Coder 32B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-coder-32b-instruct:free", 'name': "Qwen2.5 Coder 32B Instruct"},
  527. 'Qwen2.5 VL 32B Instruct': {'mode': True, 'id': "qwen/qwen2.5-vl-32b-instruct:free", 'name': "Qwen2.5 VL 32B Instruct"},
  528. 'Qwen2.5 VL 3B Instruct': {'mode': True, 'id': "qwen/qwen2.5-vl-3b-instruct:free", 'name': "Qwen2.5 VL 3B Instruct"},
  529. 'Qwen2.5 VL 72B Instruct': {'mode': True, 'id': "qwen/qwen2.5-vl-72b-instruct:free", 'name': "Qwen2.5 VL 72B Instruct"},
  530. 'Qwen2.5-VL 7B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-vl-7b-instruct:free", 'name': "Qwen2.5-VL 7B Instruct"},
  531. 'Qwerky 72B': {'mode': True, 'id': "featherless/qwerky-72b:free", 'name': "Qwerky 72B"},
  532. 'QwQ 32B': {'mode': True, 'id': "qwen/qwq-32b:free", 'name': "QwQ 32B"},
  533. 'QwQ 32B Preview': {'mode': True, 'id': "qwen/qwq-32b-preview:free", 'name': "QwQ 32B Preview"},
  534. 'QwQ 32B RpR v1': {'mode': True, 'id': "arliai/qwq-32b-arliai-rpr-v1:free", 'name': "QwQ 32B RpR v1"},
  535. 'R1': {'mode': True, 'id': "deepseek/deepseek-r1:free", 'name': "R1"},
  536. 'R1 Distill Llama 70B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-llama-70b:free", 'name': "R1 Distill Llama 70B"},
  537. 'R1 Distill Qwen 14B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-qwen-14b:free", 'name': "R1 Distill Qwen 14B"},
  538. 'R1 Distill Qwen 32B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-qwen-32b:free", 'name': "R1 Distill Qwen 32B"},
  539. 'Rogue Rose 103B v0.2': {'mode': True, 'id': "sophosympatheia/rogue-rose-103b-v0.2:free", 'name': "Rogue Rose 103B v0.2"},
  540. 'UI-TARS 72B ': {'mode': True, 'id': "bytedance-research/ui-tars-72b:free", 'name': "UI-TARS 72B "},
  541. 'Zephyr 7B': {'mode': True, 'id': "huggingfaceh4/zephyr-7b-beta:free", 'name': "Zephyr 7B"},
  542. # Pro
  543. 'Aion-1.0': {'mode': True, 'id': "aion-labs/aion-1.0", 'name': "Aion-1.0"},
  544. 'Aion-1.0-Mini': {'mode': True, 'id': "aion-labs/aion-1.0-mini", 'name': "Aion-1.0-Mini"},
  545. 'Aion-RP 1.0 (8B)': {'mode': True, 'id': "aion-labs/aion-rp-llama-3.1-8b", 'name': "Aion-RP 1.0 (8B)"},
  546. 'Airoboros 70B': {'mode': True, 'id': "jondurbin/airoboros-l2-70b", 'name': "Airoboros 70B"},
  547. 'Anubis Pro 105B V1': {'mode': True, 'id': "thedrummer/anubis-pro-105b-v1", 'name': "Anubis Pro 105B V1"},
  548. 'Arctic Instruct': {'mode': True, 'id': "snowflake/snowflake-arctic-instruct", 'name': "Arctic Instruct"},
  549. 'Auto Router': {'mode': True, 'id': "openrouter/auto", 'name': "Auto Router"},
  550. 'Bagel 34B v0.2': {'mode': True, 'id': "jondurbin/bagel-34b", 'name': "Bagel 34B v0.2"},
  551. 'Capybara 34B': {'mode': True, 'id': "nousresearch/nous-capybara-34b", 'name': "Capybara 34B"},
  552. 'Capybara 7B': {'mode': True, 'id': "nousresearch/nous-capybara-7b", 'name': "Capybara 7B"},
  553. 'ChatGPT-4o': {'mode': True, 'id': "openai/chatgpt-4o-latest", 'name': "ChatGPT-4o"},
  554. 'Chronos Hermes 13B v2': {'mode': True, 'id': "austism/chronos-hermes-13b", 'name': "Chronos Hermes 13B v2"},
  555. 'Cinematika 7B (alpha)': {'mode': True, 'id': "openrouter/cinematika-7b", 'name': "Cinematika 7B (alpha)"},
  556. 'Claude 3 Haiku': {'mode': True, 'id': "anthropic/claude-3-haiku", 'name': "Claude 3 Haiku"},
  557. 'Claude 3 Haiku (self-moderated)': {'mode': True, 'id': "anthropic/claude-3-haiku:beta", 'name': "Claude 3 Haiku (self-moderated)"},
  558. 'Claude 3 Opus': {'mode': True, 'id': "anthropic/claude-3-opus", 'name': "Claude 3 Opus"},
  559. 'Claude 3 Opus (self-moderated)': {'mode': True, 'id': "anthropic/claude-3-opus:beta", 'name': "Claude 3 Opus (self-moderated)"},
  560. 'Claude 3 Sonnet': {'mode': True, 'id': "anthropic/claude-3-sonnet", 'name': "Claude 3 Sonnet"},
  561. 'Claude 3 Sonnet (self-moderated)': {'mode': True, 'id': "anthropic/claude-3-sonnet:beta", 'name': "Claude 3 Sonnet (self-moderated)"},
  562. 'Claude 3.5 Haiku': {'mode': True, 'id': "anthropic/claude-3.5-haiku", 'name': "Claude 3.5 Haiku"},
  563. 'Claude 3.5 Haiku (2024-10-22)': {'mode': True, 'id': "anthropic/claude-3.5-haiku-20241022", 'name': "Claude 3.5 Haiku (2024-10-22)"},
  564. 'Claude 3.5 Haiku (2024-10-22) (self-moderated)': {'mode': True, 'id': "anthropic/claude-3.5-haiku-20241022:beta", 'name': "Claude 3.5 Haiku (2024-10-22) (self-moderated)"},
  565. 'Claude 3.5 Haiku (self-moderated)': {'mode': True, 'id': "anthropic/claude-3.5-haiku:beta", 'name': "Claude 3.5 Haiku (self-moderated)"},
  566. 'Claude 3.5 Sonnet': {'mode': True, 'id': "anthropic/claude-3.5-sonnet", 'name': "Claude 3.5 Sonnet"},
  567. 'Claude 3.5 Sonnet (2024-06-20)': {'mode': True, 'id': "anthropic/claude-3.5-sonnet-20240620", 'name': "Claude 3.5 Sonnet (2024-06-20)"},
  568. 'Claude 3.5 Sonnet (2024-06-20) (self-moderated)': {'mode': True, 'id': "anthropic/claude-3.5-sonnet-20240620:beta", 'name': "Claude 3.5 Sonnet (2024-06-20) (self-moderated)"},
  569. 'Claude 3.5 Sonnet (self-moderated)': {'mode': True, 'id': "anthropic/claude-3.5-sonnet:beta", 'name': "Claude 3.5 Sonnet (self-moderated)"},
  570. 'Claude 3.7 Sonnet': {'mode': True, 'id': "anthropic/claude-3.7-sonnet", 'name': "Claude 3.7 Sonnet"},
  571. 'Claude 3.7 Sonnet (self-moderated)': {'mode': True, 'id': "anthropic/claude-3.7-sonnet:beta", 'name': "Claude 3.7 Sonnet (self-moderated)"},
  572. 'Claude 3.7 Sonnet (thinking)': {'mode': True, 'id': "anthropic/claude-3.7-sonnet:thinking", 'name': "Claude 3.7 Sonnet (thinking)"},
  573. 'Claude Instant v1': {'mode': True, 'id': "anthropic/claude-instant-1", 'name': "Claude Instant v1"},
  574. 'Claude Instant v1.0': {'mode': True, 'id': "anthropic/claude-instant-1.0", 'name': "Claude Instant v1.0"},
  575. 'Claude Instant v1.1': {'mode': True, 'id': "anthropic/claude-instant-1.1", 'name': "Claude Instant v1.1"},
  576. 'Claude v1': {'mode': True, 'id': "anthropic/claude-1", 'name': "Claude v1"},
  577. 'Claude v1.2': {'mode': True, 'id': "anthropic/claude-1.2", 'name': "Claude v1.2"},
  578. 'Claude v2': {'mode': True, 'id': "anthropic/claude-2", 'name': "Claude v2"},
  579. 'Claude v2 (self-moderated)': {'mode': True, 'id': "anthropic/claude-2:beta", 'name': "Claude v2 (self-moderated)"},
  580. 'Claude v2.0': {'mode': True, 'id': "anthropic/claude-2.0", 'name': "Claude v2.0"},
  581. 'Claude v2.0 (self-moderated)': {'mode': True, 'id': "anthropic/claude-2.0:beta", 'name': "Claude v2.0 (self-moderated)"},
  582. 'Claude v2.1': {'mode': True, 'id': "anthropic/claude-2.1", 'name': "Claude v2.1"},
  583. 'Claude v2.1 (self-moderated)': {'mode': True, 'id': "anthropic/claude-2.1:beta", 'name': "Claude v2.1 (self-moderated)"},
  584. 'CodeLlama 34B Instruct': {'mode': True, 'id': "meta-llama/codellama-34b-instruct", 'name': "CodeLlama 34B Instruct"},
  585. 'CodeLlama 34B v2': {'mode': True, 'id': "phind/phind-codellama-34b", 'name': "CodeLlama 34B v2"},
  586. 'CodeLlama 70B Instruct': {'mode': True, 'id': "meta-llama/codellama-70b-instruct", 'name': "CodeLlama 70B Instruct"},
  587. 'CodeLLaMa 7B Instruct Solidity': {'mode': True, 'id': "alfredpros/codellama-7b-instruct-solidity", 'name': "CodeLLaMa 7B Instruct Solidity"},
  588. 'Codestral 2501': {'mode': True, 'id': "mistralai/codestral-2501", 'name': "Codestral 2501"},
  589. 'Codestral Mamba': {'mode': True, 'id': "mistralai/codestral-mamba", 'name': "Codestral Mamba"},
  590. 'Command': {'mode': True, 'id': "cohere/command", 'name': "Command"},
  591. 'Command A': {'mode': True, 'id': "cohere/command-a", 'name': "Command A"},
  592. 'Command R': {'mode': True, 'id': "cohere/command-r", 'name': "Command R"},
  593. 'Command R (03-2024)': {'mode': True, 'id': "cohere/command-r-03-2024", 'name': "Command R (03-2024)"},
  594. 'Command R (08-2024)': {'mode': True, 'id': "cohere/command-r-08-2024", 'name': "Command R (08-2024)"},
  595. 'Command R+': {'mode': True, 'id': "cohere/command-r-plus", 'name': "Command R+"},
  596. 'Command R+ (04-2024)': {'mode': True, 'id': "cohere/command-r-plus-04-2024", 'name': "Command R+ (04-2024)"},
  597. 'Command R+ (08-2024)': {'mode': True, 'id': "cohere/command-r-plus-08-2024", 'name': "Command R+ (08-2024)"},
  598. 'Command R7B (12-2024)': {'mode': True, 'id': "cohere/command-r7b-12-2024", 'name': "Command R7B (12-2024)"},
  599. 'DBRX 132B Instruct': {'mode': True, 'id': "databricks/dbrx-instruct", 'name': "DBRX 132B Instruct"},
  600. 'DeepSeek R1': {'mode': True, 'id': "deepseek/deepseek-r1", 'name': "DeepSeek R1"},
  601. 'DeepSeek V2.5': {'mode': True, 'id': "deepseek/deepseek-chat-v2.5", 'name': "DeepSeek V2.5"},
  602. 'DeepSeek V3': {'mode': True, 'id': "deepseek/deepseek-chat", 'name': "DeepSeek V3"},
  603. 'DeepSeek V3 0324': {'mode': True, 'id': "deepseek/deepseek-chat-v3-0324", 'name': "DeepSeek V3 0324"},
  604. 'DeepSeek-Coder-V2': {'mode': True, 'id': "deepseek/deepseek-coder", 'name': "DeepSeek-Coder-V2"},
  605. 'Dolphin 2.6 Mixtral 8x7B \uD83D\uDC2C': {'mode': True, 'id': "cognitivecomputations/dolphin-mixtral-8x7b", 'name': "Dolphin 2.6 Mixtral 8x7B \uD83D\uDC2C"},
  606. 'Dolphin 2.9.2 Mixtral 8x22B \uD83D\uDC2C': {'mode': True, 'id': "cognitivecomputations/dolphin-mixtral-8x22b", 'name': "Dolphin 2.9.2 Mixtral 8x22B \uD83D\uDC2C"},
  607. 'Dolphin Llama 3 70B \uD83D\uDC2C': {'mode': True, 'id': "cognitivecomputations/dolphin-llama-3-70b", 'name': "Dolphin Llama 3 70B \uD83D\uDC2C"},
  608. 'Eagle 7B': {'mode': True, 'id': "recursal/eagle-7b", 'name': "Eagle 7B"},
  609. 'EVA Llama 3.33 70B': {'mode': True, 'id': "eva-unit-01/eva-llama-3.33-70b", 'name': "EVA Llama 3.33 70B"},
  610. 'EVA Qwen2.5 14B': {'mode': True, 'id': "eva-unit-01/eva-qwen-2.5-14b", 'name': "EVA Qwen2.5 14B"},
  611. 'EVA Qwen2.5 32B': {'mode': True, 'id': "eva-unit-01/eva-qwen-2.5-32b", 'name': "EVA Qwen2.5 32B"},
  612. 'EVA Qwen2.5 72B': {'mode': True, 'id': "eva-unit-01/eva-qwen-2.5-72b", 'name': "EVA Qwen2.5 72B"},
  613. 'Fimbulvetr 11B v2': {'mode': True, 'id': "sao10k/fimbulvetr-11b-v2", 'name': "Fimbulvetr 11B v2"},
  614. 'FireLLaVA 13B': {'mode': True, 'id': "fireworks/firellava-13b", 'name': "FireLLaVA 13B"},
  615. 'Gemini 1.5 Flash ': {'mode': True, 'id': "google/gemini-flash-1.5", 'name': "Gemini 1.5 Flash "},
  616. 'Gemini 1.5 Flash 8B': {'mode': True, 'id': "google/gemini-flash-1.5-8b", 'name': "Gemini 1.5 Flash 8B"},
  617. 'Gemini 1.5 Flash 8B Experimental': {'mode': True, 'id': "google/gemini-flash-1.5-8b-exp", 'name': "Gemini 1.5 Flash 8B Experimental"},
  618. 'Gemini 1.5 Flash Experimental': {'mode': True, 'id': "google/gemini-flash-1.5-exp", 'name': "Gemini 1.5 Flash Experimental"},
  619. 'Gemini 1.5 Pro': {'mode': True, 'id': "google/gemini-pro-1.5", 'name': "Gemini 1.5 Pro"},
  620. 'Gemini 1.5 Pro Experimental': {'mode': True, 'id': "google/gemini-pro-1.5-exp", 'name': "Gemini 1.5 Pro Experimental"},
  621. 'Gemini 2.0 Flash': {'mode': True, 'id': "google/gemini-2.0-flash-001", 'name': "Gemini 2.0 Flash"},
  622. 'Gemini 2.0 Flash Lite': {'mode': True, 'id': "google/gemini-2.0-flash-lite-001", 'name': "Gemini 2.0 Flash Lite"},
  623. 'Gemini 2.5 Pro': {'mode': True, 'id': "google/gemini-2.5-pro-preview-03-25", 'name': "Gemini 2.5 Pro"},
  624. 'Gemini Experimental 1114': {'mode': True, 'id': "google/gemini-exp-1114", 'name': "Gemini Experimental 1114"},
  625. 'Gemini Experimental 1121': {'mode': True, 'id': "google/gemini-exp-1121", 'name': "Gemini Experimental 1121"},
  626. 'Gemini Pro 1.0': {'mode': True, 'id': "google/gemini-pro", 'name': "Gemini Pro 1.0"},
  627. 'Gemini Pro Vision 1.0': {'mode': True, 'id': "google/gemini-pro-vision", 'name': "Gemini Pro Vision 1.0"},
  628. 'Gemma 2 27B': {'mode': True, 'id': "google/gemma-2-27b-it", 'name': "Gemma 2 27B"},
  629. 'Gemma 2 9B': {'mode': True, 'id': "google/gemma-2-9b-it", 'name': "Gemma 2 9B"},
  630. 'Gemma 3 12B': {'mode': True, 'id': "google/gemma-3-12b-it", 'name': "Gemma 3 12B"},
  631. 'Gemma 3 27B': {'mode': True, 'id': "google/gemma-3-27b-it", 'name': "Gemma 3 27B"},
  632. 'Gemma 3 4B': {'mode': True, 'id': "google/gemma-3-4b-it", 'name': "Gemma 3 4B"},
  633. 'Gemma 7B': {'mode': True, 'id': "google/gemma-7b-it", 'name': "Gemma 7B"},
  634. 'Goliath 120B': {'mode': True, 'id': "alpindale/goliath-120b", 'name': "Goliath 120B"},
  635. 'GPT-3.5 Turbo': {'mode': True, 'id': "openai/gpt-3.5-turbo", 'name': "GPT-3.5 Turbo"},
  636. 'GPT-3.5 Turbo (older v0301)': {'mode': True, 'id': "openai/gpt-3.5-turbo-0301", 'name': "GPT-3.5 Turbo (older v0301)"},
  637. 'GPT-3.5 Turbo (older v0613)': {'mode': True, 'id': "openai/gpt-3.5-turbo-0613", 'name': "GPT-3.5 Turbo (older v0613)"},
  638. 'GPT-3.5 Turbo 16k': {'mode': True, 'id': "openai/gpt-3.5-turbo-16k", 'name': "GPT-3.5 Turbo 16k"},
  639. 'GPT-3.5 Turbo 16k': {'mode': True, 'id': "openai/gpt-3.5-turbo-0125", 'name': "GPT-3.5 Turbo 16k"},
  640. 'GPT-3.5 Turbo 16k (older v1106)': {'mode': True, 'id': "openai/gpt-3.5-turbo-1106", 'name': "GPT-3.5 Turbo 16k (older v1106)"},
  641. 'GPT-3.5 Turbo Instruct': {'mode': True, 'id': "openai/gpt-3.5-turbo-instruct", 'name': "GPT-3.5 Turbo Instruct"},
  642. 'GPT-4': {'mode': True, 'id': "openai/gpt-4", 'name': "GPT-4"},
  643. 'GPT-4 (older v0314)': {'mode': True, 'id': "openai/gpt-4-0314", 'name': "GPT-4 (older v0314)"},
  644. 'GPT-4 32k': {'mode': True, 'id': "openai/gpt-4-32k", 'name': "GPT-4 32k"},
  645. 'GPT-4 32k (older v0314)': {'mode': True, 'id': "openai/gpt-4-32k-0314", 'name': "GPT-4 32k (older v0314)"},
  646. 'GPT-4 Turbo': {'mode': True, 'id': "openai/gpt-4-turbo", 'name': "GPT-4 Turbo"},
  647. 'GPT-4 Turbo (older v1106)': {'mode': True, 'id': "openai/gpt-4-1106-preview", 'name': "GPT-4 Turbo (older v1106)"},
  648. 'GPT-4 Turbo Preview': {'mode': True, 'id': "openai/gpt-4-turbo-preview", 'name': "GPT-4 Turbo Preview"},
  649. 'GPT-4 Vision': {'mode': True, 'id': "openai/gpt-4-vision-preview", 'name': "GPT-4 Vision"},
  650. 'GPT-4.1': {'mode': True, 'id': "openai/gpt-4.1", 'name': "GPT-4.1"},
  651. 'GPT-4.1 Mini': {'mode': True, 'id': "openai/gpt-4.1-mini", 'name': "GPT-4.1 Mini"},
  652. 'GPT-4.1 Nano': {'mode': True, 'id': "openai/gpt-4.1-nano", 'name': "GPT-4.1 Nano"},
  653. 'GPT-4.5 (Preview)': {'mode': True, 'id': "openai/gpt-4.5-preview", 'name': "GPT-4.5 (Preview)"},
  654. 'GPT-4o': {'mode': True, 'id': "openai/gpt-4o", 'name': "GPT-4o"},
  655. 'GPT-4o (2024-05-13)': {'mode': True, 'id': "openai/gpt-4o-2024-05-13", 'name': "GPT-4o (2024-05-13)"},
  656. 'GPT-4o (2024-08-06)': {'mode': True, 'id': "openai/gpt-4o-2024-08-06", 'name': "GPT-4o (2024-08-06)"},
  657. 'GPT-4o (2024-11-20)': {'mode': True, 'id': "openai/gpt-4o-2024-11-20", 'name': "GPT-4o (2024-11-20)"},
  658. 'GPT-4o (extended)': {'mode': True, 'id': "openai/gpt-4o:extended", 'name': "GPT-4o (extended)"},
  659. 'GPT-4o Search Preview': {'mode': True, 'id': "openai/gpt-4o-search-preview", 'name': "GPT-4o Search Preview"},
  660. 'GPT-4o-mini': {'mode': True, 'id': "openai/gpt-4o-mini", 'name': "GPT-4o-mini"},
  661. 'GPT-4o-mini (2024-07-18)': {'mode': True, 'id': "openai/gpt-4o-mini-2024-07-18", 'name': "GPT-4o-mini (2024-07-18)"},
  662. 'GPT-4o-mini Search Preview': {'mode': True, 'id': "openai/gpt-4o-mini-search-preview", 'name': "GPT-4o-mini Search Preview"},
  663. 'Grok 2': {'mode': True, 'id': "x-ai/grok-2", 'name': "Grok 2"},
  664. 'Grok 2 1212': {'mode': True, 'id': "x-ai/grok-2-1212", 'name': "Grok 2 1212"},
  665. 'Grok 2 mini': {'mode': True, 'id': "x-ai/grok-2-mini", 'name': "Grok 2 mini"},
  666. 'Grok 2 Vision 1212': {'mode': True, 'id': "x-ai/grok-2-vision-1212", 'name': "Grok 2 Vision 1212"},
  667. 'Grok 3': {'mode': True, 'id': "x-ai/grok-3-beta", 'name': "Grok 3"},
  668. 'Grok 3 Mini Beta': {'mode': True, 'id': "x-ai/grok-3-mini-beta", 'name': "Grok 3 Mini Beta"},
  669. 'Grok Beta': {'mode': True, 'id': "x-ai/grok-beta", 'name': "Grok Beta"},
  670. 'Grok Vision Beta': {'mode': True, 'id': "x-ai/grok-vision-beta", 'name': "Grok Vision Beta"},
  671. 'Hermes 13B': {'mode': True, 'id': "nousresearch/nous-hermes-llama2-13b", 'name': "Hermes 13B"},
  672. 'Hermes 2 Mistral 7B DPO': {'mode': True, 'id': "nousresearch/nous-hermes-2-mistral-7b-dpo", 'name': "Hermes 2 Mistral 7B DPO"},
  673. 'Hermes 2 Mixtral 8x7B DPO': {'mode': True, 'id': "nousresearch/nous-hermes-2-mixtral-8x7b-dpo", 'name': "Hermes 2 Mixtral 8x7B DPO"},
  674. 'Hermes 2 Mixtral 8x7B SFT': {'mode': True, 'id': "nousresearch/nous-hermes-2-mixtral-8x7b-sft", 'name': "Hermes 2 Mixtral 8x7B SFT"},
  675. 'Hermes 2 Pro - Llama-3 8B': {'mode': True, 'id': "nousresearch/hermes-2-pro-llama-3-8b", 'name': "Hermes 2 Pro - Llama-3 8B"},
  676. 'Hermes 2 Theta 8B': {'mode': True, 'id': "nousresearch/hermes-2-theta-llama-3-8b", 'name': "Hermes 2 Theta 8B"},
  677. 'Hermes 2 Vision 7B (alpha)': {'mode': True, 'id': "nousresearch/nous-hermes-2-vision-7b", 'name': "Hermes 2 Vision 7B (alpha)"},
  678. 'Hermes 2 Yi 34B': {'mode': True, 'id': "nousresearch/nous-hermes-yi-34b", 'name': "Hermes 2 Yi 34B"},
  679. 'Hermes 3 405B Instruct': {'mode': True, 'id': "nousresearch/hermes-3-llama-3.1-405b", 'name': "Hermes 3 405B Instruct"},
  680. 'Hermes 3 70B Instruct': {'mode': True, 'id': "nousresearch/hermes-3-llama-3.1-70b", 'name': "Hermes 3 70B Instruct"},
  681. 'Hermes 70B': {'mode': True, 'id': "nousresearch/nous-hermes-llama2-70b", 'name': "Hermes 70B"},
  682. 'Inflection 3 Pi': {'mode': True, 'id': "inflection/inflection-3-pi", 'name': "Inflection 3 Pi"},
  683. 'Inflection 3 Productivity': {'mode': True, 'id': "inflection/inflection-3-productivity", 'name': "Inflection 3 Productivity"},
  684. 'Jamba 1.5 Large': {'mode': True, 'id': "ai21/jamba-1-5-large", 'name': "Jamba 1.5 Large"},
  685. 'Jamba 1.5 Mini': {'mode': True, 'id': "ai21/jamba-1-5-mini", 'name': "Jamba 1.5 Mini"},
  686. 'Jamba 1.6 Large': {'mode': True, 'id': "ai21/jamba-1.6-large", 'name': "Jamba 1.6 Large"},
  687. 'Jamba Instruct': {'mode': True, 'id': "ai21/jamba-instruct", 'name': "Jamba Instruct"},
  688. 'Jamba Mini 1.6': {'mode': True, 'id': "ai21/jamba-1.6-mini", 'name': "Jamba Mini 1.6"},
  689. 'L3.3 Electra R1 70B': {'mode': True, 'id': "steelskull/l3.3-electra-r1-70b", 'name': "L3.3 Electra R1 70B"},
  690. 'LFM 3B': {'mode': True, 'id': "liquid/lfm-3b", 'name': "LFM 3B"},
  691. 'LFM 40B MoE': {'mode': True, 'id': "liquid/lfm-40b", 'name': "LFM 40B MoE"},
  692. 'LFM 7B': {'mode': True, 'id': "liquid/lfm-7b", 'name': "LFM 7B"},
  693. 'Llama 2 13B Chat': {'mode': True, 'id': "meta-llama/llama-2-13b-chat", 'name': "Llama 2 13B Chat"},
  694. 'Llama 2 70B Chat': {'mode': True, 'id': "meta-llama/llama-2-70b-chat", 'name': "Llama 2 70B Chat"},
  695. 'Llama 3 70B (Base)': {'mode': True, 'id': "meta-llama/llama-3-70b", 'name': "Llama 3 70B (Base)"},
  696. 'Llama 3 70B Instruct': {'mode': True, 'id': "meta-llama/llama-3-70b-instruct", 'name': "Llama 3 70B Instruct"},
  697. 'Llama 3 8B (Base)': {'mode': True, 'id': "meta-llama/llama-3-8b", 'name': "Llama 3 8B (Base)"},
  698. 'Llama 3 8B Instruct': {'mode': True, 'id': "meta-llama/llama-3-8b-instruct", 'name': "Llama 3 8B Instruct"},
  699. 'Llama 3 8B Lunaris': {'mode': True, 'id': "sao10k/l3-lunaris-8b", 'name': "Llama 3 8B Lunaris"},
  700. 'Llama 3 Euryale 70B v2.1': {'mode': True, 'id': "sao10k/l3-euryale-70b", 'name': "Llama 3 Euryale 70B v2.1"},
  701. 'Llama 3 Lumimaid 70B': {'mode': True, 'id': "neversleep/llama-3-lumimaid-70b", 'name': "Llama 3 Lumimaid 70B"},
  702. 'Llama 3 Lumimaid 8B': {'mode': True, 'id': "neversleep/llama-3-lumimaid-8b", 'name': "Llama 3 Lumimaid 8B"},
  703. 'Llama 3 Lumimaid 8B (extended)': {'mode': True, 'id': "neversleep/llama-3-lumimaid-8b:extended", 'name': "Llama 3 Lumimaid 8B (extended)"},
  704. 'Llama 3 Soliloquy 7B v3 32K': {'mode': True, 'id': "lynn/soliloquy-v3", 'name': "Llama 3 Soliloquy 7B v3 32K"},
  705. 'Llama 3 Soliloquy 8B v2': {'mode': True, 'id': "lynn/soliloquy-l3", 'name': "Llama 3 Soliloquy 8B v2"},
  706. 'Llama 3 Stheno 8B v3.3 32K': {'mode': True, 'id': "sao10k/l3-stheno-8b", 'name': "Llama 3 Stheno 8B v3.3 32K"},
  707. 'Llama 3.1 405B (base)': {'mode': True, 'id': "meta-llama/llama-3.1-405b", 'name': "Llama 3.1 405B (base)"},
  708. 'Llama 3.1 405B Instruct': {'mode': True, 'id': "meta-llama/llama-3.1-405b-instruct", 'name': "Llama 3.1 405B Instruct"},
  709. 'Llama 3.1 70B Hanami x1': {'mode': True, 'id': "sao10k/l3.1-70b-hanami-x1", 'name': "Llama 3.1 70B Hanami x1"},
  710. 'Llama 3.1 70B Instruct': {'mode': True, 'id': "meta-llama/llama-3.1-70b-instruct", 'name': "Llama 3.1 70B Instruct"},
  711. 'Llama 3.1 8B Instruct': {'mode': True, 'id': "meta-llama/llama-3.1-8b-instruct", 'name': "Llama 3.1 8B Instruct"},
  712. 'Llama 3.1 Euryale 70B v2.2': {'mode': True, 'id': "sao10k/l3.1-euryale-70b", 'name': "Llama 3.1 Euryale 70B v2.2"},
  713. 'Llama 3.1 Nemotron 70B Instruct': {'mode': True, 'id': "nvidia/llama-3.1-nemotron-70b-instruct", 'name': "Llama 3.1 Nemotron 70B Instruct"},
  714. 'Llama 3.1 Swallow 70B Instruct V0.3': {'mode': True, 'id': "tokyotech-llm/llama-3.1-swallow-70b-instruct-v0.3", 'name': "Llama 3.1 Swallow 70B Instruct V0.3"},
  715. 'Llama 3.1 Swallow 8B Instruct V0.3': {'mode': True, 'id': "tokyotech-llm/llama-3.1-swallow-8b-instruct-v0.3", 'name': "Llama 3.1 Swallow 8B Instruct V0.3"},
  716. 'Llama 3.1 Tulu 3 405B': {'mode': True, 'id': "allenai/llama-3.1-tulu-3-405b", 'name': "Llama 3.1 Tulu 3 405B"},
  717. 'Llama 3.2 11B Vision Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-11b-vision-instruct", 'name': "Llama 3.2 11B Vision Instruct"},
  718. 'Llama 3.2 1B Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-1b-instruct", 'name': "Llama 3.2 1B Instruct"},
  719. 'Llama 3.2 3B Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-3b-instruct", 'name': "Llama 3.2 3B Instruct"},
  720. 'Llama 3.2 90B Vision Instruct': {'mode': True, 'id': "meta-llama/llama-3.2-90b-vision-instruct", 'name': "Llama 3.2 90B Vision Instruct"},
  721. 'Llama 3.3 70B Instruct': {'mode': True, 'id': "meta-llama/llama-3.3-70b-instruct", 'name': "Llama 3.3 70B Instruct"},
  722. 'Llama 3.3 Euryale 70B': {'mode': True, 'id': "sao10k/l3.3-euryale-70b", 'name': "Llama 3.3 Euryale 70B"},
  723. 'Llama 4 Maverick': {'mode': True, 'id': "meta-llama/llama-4-maverick", 'name': "Llama 4 Maverick"},
  724. 'Llama 4 Scout': {'mode': True, 'id': "meta-llama/llama-4-scout", 'name': "Llama 4 Scout"},
  725. 'Llama Guard 3 8B': {'mode': True, 'id': "meta-llama/llama-guard-3-8b", 'name': "Llama Guard 3 8B"},
  726. 'LlamaGuard 2 8B': {'mode': True, 'id': "meta-llama/llama-guard-2-8b", 'name': "LlamaGuard 2 8B"},
  727. 'LLaVA 13B': {'mode': True, 'id': "liuhaotian/llava-13b", 'name': "LLaVA 13B"},
  728. 'LLaVA v1.6 34B': {'mode': True, 'id': "liuhaotian/llava-yi-34b", 'name': "LLaVA v1.6 34B"},
  729. 'Llemma 7b': {'mode': True, 'id': "eleutherai/llemma_7b", 'name': "Llemma 7b"},
  730. 'Lumimaid v0.2 70B': {'mode': True, 'id': "neversleep/llama-3.1-lumimaid-70b", 'name': "Lumimaid v0.2 70B"},
  731. 'Lumimaid v0.2 8B': {'mode': True, 'id': "neversleep/llama-3.1-lumimaid-8b", 'name': "Lumimaid v0.2 8B"},
  732. 'lzlv 70B': {'mode': True, 'id': "lizpreciatior/lzlv-70b-fp16-hf", 'name': "lzlv 70B"},
  733. 'Mag Mell R1 12B': {'mode': True, 'id': "inflatebot/mn-mag-mell-r1", 'name': "Mag Mell R1 12B"},
  734. 'Magnum 72B': {'mode': True, 'id': "alpindale/magnum-72b", 'name': "Magnum 72B"},
  735. 'Magnum v2 72B': {'mode': True, 'id': "anthracite-org/magnum-v2-72b", 'name': "Magnum v2 72B"},
  736. 'Magnum v4 72B': {'mode': True, 'id': "anthracite-org/magnum-v4-72b", 'name': "Magnum v4 72B"},
  737. 'Midnight Rose 70B': {'mode': True, 'id': "sophosympatheia/midnight-rose-70b", 'name': "Midnight Rose 70B"},
  738. 'MiniMax-01': {'mode': True, 'id': "minimax/minimax-01", 'name': "MiniMax-01"},
  739. 'Ministral 3B': {'mode': True, 'id': "mistralai/ministral-3b", 'name': "Ministral 3B"},
  740. 'Ministral 8B': {'mode': True, 'id': "mistral/ministral-8b", 'name': "Ministral 8B"},
  741. 'Ministral 8B': {'mode': True, 'id': "mistralai/ministral-8b", 'name': "Ministral 8B"},
  742. 'Mistral 7B Instruct': {'mode': True, 'id': "mistralai/mistral-7b-instruct", 'name': "Mistral 7B Instruct"},
  743. 'Mistral 7B Instruct v0.1': {'mode': True, 'id': "mistralai/mistral-7b-instruct-v0.1", 'name': "Mistral 7B Instruct v0.1"},
  744. 'Mistral 7B Instruct v0.2': {'mode': True, 'id': "mistralai/mistral-7b-instruct-v0.2", 'name': "Mistral 7B Instruct v0.2"},
  745. 'Mistral 7B Instruct v0.3': {'mode': True, 'id': "mistralai/mistral-7b-instruct-v0.3", 'name': "Mistral 7B Instruct v0.3"},
  746. 'Mistral Large': {'mode': True, 'id': "mistralai/mistral-large", 'name': "Mistral Large"},
  747. 'Mistral Large 2407': {'mode': True, 'id': "mistralai/mistral-large-2407", 'name': "Mistral Large 2407"},
  748. 'Mistral Large 2411': {'mode': True, 'id': "mistralai/mistral-large-2411", 'name': "Mistral Large 2411"},
  749. 'Mistral Medium': {'mode': True, 'id': "mistralai/mistral-medium", 'name': "Mistral Medium"},
  750. 'Mistral Nemo': {'mode': True, 'id': "mistralai/mistral-nemo", 'name': "Mistral Nemo"},
  751. 'Mistral Nemo 12B Celeste': {'mode': True, 'id': "nothingiisreal/mn-celeste-12b", 'name': "Mistral Nemo 12B Celeste"},
  752. 'Mistral Nemo Inferor 12B': {'mode': True, 'id': "infermatic/mn-inferor-12b", 'name': "Mistral Nemo Inferor 12B"},
  753. 'Mistral OpenOrca 7B': {'mode': True, 'id': "open-orca/mistral-7b-openorca", 'name': "Mistral OpenOrca 7B"},
  754. 'Mistral Small': {'mode': True, 'id': "mistralai/mistral-small", 'name': "Mistral Small"},
  755. 'Mistral Small 3': {'mode': True, 'id': "mistralai/mistral-small-24b-instruct-2501", 'name': "Mistral Small 3"},
  756. 'Mistral Small 3.1 24B': {'mode': True, 'id': "mistralai/mistral-small-3.1-24b-instruct", 'name': "Mistral Small 3.1 24B"},
  757. 'Mistral Tiny': {'mode': True, 'id': "mistralai/mistral-tiny", 'name': "Mistral Tiny"},
  758. 'Mixtral 8x22B (base)': {'mode': True, 'id': "mistralai/mixtral-8x22b", 'name': "Mixtral 8x22B (base)"},
  759. 'Mixtral 8x22B Instruct': {'mode': True, 'id': "mistralai/mixtral-8x22b-instruct", 'name': "Mixtral 8x22B Instruct"},
  760. 'Mixtral 8x7B Instruct': {'mode': True, 'id': "mistralai/mixtral-8x7b-instruct", 'name': "Mixtral 8x7B Instruct"},
  761. 'Mythalion 13B': {'mode': True, 'id': "pygmalionai/mythalion-13b", 'name': "Mythalion 13B"},
  762. 'MythoMax 13B': {'mode': True, 'id': "gryphe/mythomax-l2-13b", 'name': "MythoMax 13B"},
  763. 'MythoMist 7B': {'mode': True, 'id': "gryphe/mythomist-7b", 'name': "MythoMist 7B"},
  764. 'Nemotron-4 340B Instruct': {'mode': True, 'id': "nvidia/nemotron-4-340b-instruct", 'name': "Nemotron-4 340B Instruct"},
  765. 'Neural Chat 7B v3.1': {'mode': True, 'id': "intel/neural-chat-7b", 'name': "Neural Chat 7B v3.1"},
  766. 'Noromaid 20B': {'mode': True, 'id': "neversleep/noromaid-20b", 'name': "Noromaid 20B"},
  767. 'Noromaid Mixtral 8x7B Instruct': {'mode': True, 'id': "neversleep/noromaid-mixtral-8x7b-instruct", 'name': "Noromaid Mixtral 8x7B Instruct"},
  768. 'Nova Lite 1.0': {'mode': True, 'id': "amazon/nova-lite-v1", 'name': "Nova Lite 1.0"},
  769. 'Nova Micro 1.0': {'mode': True, 'id': "amazon/nova-micro-v1", 'name': "Nova Micro 1.0"},
  770. 'Nova Pro 1.0': {'mode': True, 'id': "amazon/nova-pro-v1", 'name': "Nova Pro 1.0"},
  771. 'o1': {'mode': True, 'id': "openai/o1", 'name': "o1"},
  772. 'o1-mini': {'mode': True, 'id': "openai/o1-mini", 'name': "o1-mini"},
  773. 'o1-mini (2024-09-12)': {'mode': True, 'id': "openai/o1-mini-2024-09-12", 'name': "o1-mini (2024-09-12)"},
  774. 'o1-preview': {'mode': True, 'id': "openai/o1-preview", 'name': "o1-preview"},
  775. 'o1-preview (2024-09-12)': {'mode': True, 'id': "openai/o1-preview-2024-09-12", 'name': "o1-preview (2024-09-12)"},
  776. 'o1-pro': {'mode': True, 'id': "openai/o1-pro", 'name': "o1-pro"},
  777. 'o3 Mini': {'mode': True, 'id': "openai/o3-mini", 'name': "o3 Mini"},
  778. 'o3 Mini High': {'mode': True, 'id': "openai/o3-mini-high", 'name': "o3 Mini High"},
  779. 'Olmo 2 32B Instruct': {'mode': True, 'id': "allenai/olmo-2-0325-32b-instruct", 'name': "Olmo 2 32B Instruct"},
  780. 'OLMo 7B Instruct': {'mode': True, 'id': "allenai/olmo-7b-instruct", 'name': "OLMo 7B Instruct"},
  781. 'OpenChat 3.5 7B': {'mode': True, 'id': "openchat/openchat-7b", 'name': "OpenChat 3.5 7B"},
  782. 'OpenChat 3.6 8B': {'mode': True, 'id': "openchat/openchat-8b", 'name': "OpenChat 3.6 8B"},
  783. 'OpenHands LM 32B V0.1': {'mode': True, 'id': "all-hands/openhands-lm-32b-v0.1", 'name': "OpenHands LM 32B V0.1"},
  784. 'OpenHermes 2 Mistral 7B': {'mode': True, 'id': "teknium/openhermes-2-mistral-7b", 'name': "OpenHermes 2 Mistral 7B"},
  785. 'OpenHermes 2.5 Mistral 7B': {'mode': True, 'id': "teknium/openhermes-2.5-mistral-7b", 'name': "OpenHermes 2.5 Mistral 7B"},
  786. 'Optimus Alpha': {'mode': True, 'id': "openrouter/optimus-alpha", 'name': "Optimus Alpha"},
  787. 'PaLM 2 Chat': {'mode': True, 'id': "google/palm-2-chat-bison", 'name': "PaLM 2 Chat"},
  788. 'PaLM 2 Chat 32k': {'mode': True, 'id': "google/palm-2-chat-bison-32k", 'name': "PaLM 2 Chat 32k"},
  789. 'PaLM 2 Code Chat': {'mode': True, 'id': "google/palm-2-codechat-bison", 'name': "PaLM 2 Code Chat"},
  790. 'PaLM 2 Code Chat 32k': {'mode': True, 'id': "google/palm-2-codechat-bison-32k", 'name': "PaLM 2 Code Chat 32k"},
  791. 'Phi 4': {'mode': True, 'id': "microsoft/phi-4", 'name': "Phi 4"},
  792. 'Phi 4 Multimodal Instruct': {'mode': True, 'id': "microsoft/phi-4-multimodal-instruct", 'name': "Phi 4 Multimodal Instruct"},
  793. 'Phi-3 Medium 128K Instruct': {'mode': True, 'id': "microsoft/phi-3-medium-128k-instruct", 'name': "Phi-3 Medium 128K Instruct"},
  794. 'Phi-3 Medium 4K Instruct': {'mode': True, 'id': "microsoft/phi-3-medium-4k-instruct", 'name': "Phi-3 Medium 4K Instruct"},
  795. 'Phi-3 Mini 128K Instruct': {'mode': True, 'id': "microsoft/phi-3-mini-128k-instruct", 'name': "Phi-3 Mini 128K Instruct"},
  796. 'Phi-3.5 Mini 128K Instruct': {'mode': True, 'id': "microsoft/phi-3.5-mini-128k-instruct", 'name': "Phi-3.5 Mini 128K Instruct"},
  797. 'Pixtral 12B': {'mode': True, 'id': "mistralai/pixtral-12b", 'name': "Pixtral 12B"},
  798. 'Pixtral Large 2411': {'mode': True, 'id': "mistralai/pixtral-large-2411", 'name': "Pixtral Large 2411"},
  799. 'Psyfighter 13B': {'mode': True, 'id': "jebcarter/psyfighter-13b", 'name': "Psyfighter 13B"},
  800. 'Psyfighter v2 13B': {'mode': True, 'id': "koboldai/psyfighter-13b-2", 'name': "Psyfighter v2 13B"},
  801. 'Quasar Alpha': {'mode': True, 'id': "openrouter/quasar-alpha", 'name': "Quasar Alpha"},
  802. 'Qwen 1.5 110B Chat': {'mode': True, 'id': "qwen/qwen-110b-chat", 'name': "Qwen 1.5 110B Chat"},
  803. 'Qwen 1.5 14B Chat': {'mode': True, 'id': "qwen/qwen-14b-chat", 'name': "Qwen 1.5 14B Chat"},
  804. 'Qwen 1.5 32B Chat': {'mode': True, 'id': "qwen/qwen-32b-chat", 'name': "Qwen 1.5 32B Chat"},
  805. 'Qwen 1.5 4B Chat': {'mode': True, 'id': "qwen/qwen-4b-chat", 'name': "Qwen 1.5 4B Chat"},
  806. 'Qwen 1.5 72B Chat': {'mode': True, 'id': "qwen/qwen-72b-chat", 'name': "Qwen 1.5 72B Chat"},
  807. 'Qwen 1.5 7B Chat': {'mode': True, 'id': "qwen/qwen-7b-chat", 'name': "Qwen 1.5 7B Chat"},
  808. 'Qwen 2 72B Instruct': {'mode': True, 'id': "qwen/qwen-2-72b-instruct", 'name': "Qwen 2 72B Instruct"},
  809. 'Qwen 2 7B Instruct': {'mode': True, 'id': "qwen/qwen-2-7b-instruct", 'name': "Qwen 2 7B Instruct"},
  810. 'Qwen VL Max': {'mode': True, 'id': "qwen/qwen-vl-max", 'name': "Qwen VL Max"},
  811. 'Qwen VL Plus': {'mode': True, 'id': "qwen/qwen-vl-plus", 'name': "Qwen VL Plus"},
  812. 'Qwen-Max ': {'mode': True, 'id': "qwen/qwen-max", 'name': "Qwen-Max "},
  813. 'Qwen-Plus': {'mode': True, 'id': "qwen/qwen-plus", 'name': "Qwen-Plus"},
  814. 'Qwen-Turbo': {'mode': True, 'id': "qwen/qwen-turbo", 'name': "Qwen-Turbo"},
  815. 'Qwen2.5 32B Instruct': {'mode': True, 'id': "qwen/qwen2.5-32b-instruct", 'name': "Qwen2.5 32B Instruct"},
  816. 'Qwen2.5 72B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-72b-instruct", 'name': "Qwen2.5 72B Instruct"},
  817. 'Qwen2.5 7B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-7b-instruct", 'name': "Qwen2.5 7B Instruct"},
  818. 'Qwen2.5 Coder 32B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-coder-32b-instruct", 'name': "Qwen2.5 Coder 32B Instruct"},
  819. 'Qwen2.5 VL 32B Instruct': {'mode': True, 'id': "qwen/qwen2.5-vl-32b-instruct", 'name': "Qwen2.5 VL 32B Instruct"},
  820. 'Qwen2.5 VL 72B Instruct': {'mode': True, 'id': "qwen/qwen2.5-vl-72b-instruct", 'name': "Qwen2.5 VL 72B Instruct"},
  821. 'Qwen2.5-VL 72B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-vl-72b-instruct", 'name': "Qwen2.5-VL 72B Instruct"},
  822. 'Qwen2.5-VL 7B Instruct': {'mode': True, 'id': "qwen/qwen-2.5-vl-7b-instruct", 'name': "Qwen2.5-VL 7B Instruct"},
  823. 'QwQ 32B': {'mode': True, 'id': "qwen/qwq-32b", 'name': "QwQ 32B"},
  824. 'QwQ 32B Preview': {'mode': True, 'id': "qwen/qwq-32b-preview", 'name': "QwQ 32B Preview"},
  825. 'R1': {'mode': True, 'id': "deepseek/deepseek-r1", 'name': "R1"},
  826. 'R1 Distill Llama 70B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-llama-70b", 'name': "R1 Distill Llama 70B"},
  827. 'R1 Distill Llama 8B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-llama-8b", 'name': "R1 Distill Llama 8B"},
  828. 'R1 Distill Qwen 1.5B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-qwen-1.5b", 'name': "R1 Distill Qwen 1.5B"},
  829. 'R1 Distill Qwen 14B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-qwen-14b", 'name': "R1 Distill Qwen 14B"},
  830. 'R1 Distill Qwen 32B': {'mode': True, 'id': "deepseek/deepseek-r1-distill-qwen-32b", 'name': "R1 Distill Qwen 32B"},
  831. 'Reflection 70B': {'mode': True, 'id': "mattshumer/reflection-70b", 'name': "Reflection 70B"},
  832. 'ReMM SLERP 13B': {'mode': True, 'id': "undi95/remm-slerp-l2-13b", 'name': "ReMM SLERP 13B"},
  833. 'Rocinante 12B': {'mode': True, 'id': "thedrummer/rocinante-12b", 'name': "Rocinante 12B"},
  834. 'RWKV v5 3B AI Town': {'mode': True, 'id': "recursal/rwkv-5-3b-ai-town", 'name': "RWKV v5 3B AI Town"},
  835. 'RWKV v5 World 3B': {'mode': True, 'id': "rwkv/rwkv-5-world-3b", 'name': "RWKV v5 World 3B"},
  836. 'Saba': {'mode': True, 'id': "mistralai/mistral-saba", 'name': "Saba"},
  837. 'Skyfall 36B V2': {'mode': True, 'id': "thedrummer/skyfall-36b-v2", 'name': "Skyfall 36B V2"},
  838. 'SorcererLM 8x22B': {'mode': True, 'id': "raifle/sorcererlm-8x22b", 'name': "SorcererLM 8x22B"},
  839. 'Starcannon 12B': {'mode': True, 'id': "aetherwiing/mn-starcannon-12b", 'name': "Starcannon 12B"},
  840. 'StarCoder2 15B Instruct': {'mode': True, 'id': "bigcode/starcoder2-15b-instruct", 'name': "StarCoder2 15B Instruct"},
  841. 'StripedHyena Hessian 7B (base)': {'mode': True, 'id': "togethercomputer/stripedhyena-hessian-7b", 'name': "StripedHyena Hessian 7B (base)"},
  842. 'StripedHyena Nous 7B': {'mode': True, 'id': "togethercomputer/stripedhyena-nous-7b", 'name': "StripedHyena Nous 7B"},
  843. 'Synthia 70B': {'mode': True, 'id': "migtissera/synthia-70b", 'name': "Synthia 70B"},
  844. 'Toppy M 7B': {'mode': True, 'id': "undi95/toppy-m-7b", 'name': "Toppy M 7B"},
  845. 'Typhoon2 70B Instruct': {'mode': True, 'id': "scb10x/llama3.1-typhoon2-70b-instruct", 'name': "Typhoon2 70B Instruct"},
  846. 'Typhoon2 8B Instruct': {'mode': True, 'id': "scb10x/llama3.1-typhoon2-8b-instruct", 'name': "Typhoon2 8B Instruct"},
  847. 'Unslopnemo 12B': {'mode': True, 'id': "thedrummer/unslopnemo-12b", 'name': "Unslopnemo 12B"},
  848. 'Wayfarer Large 70B Llama 3.3': {'mode': True, 'id': "latitudegames/wayfarer-large-70b-llama-3.3", 'name': "Wayfarer Large 70B Llama 3.3"},
  849. 'Weaver (alpha)': {'mode': True, 'id': "mancer/weaver", 'name': "Weaver (alpha)"},
  850. 'WizardLM-2 7B': {'mode': True, 'id': "microsoft/wizardlm-2-7b", 'name': "WizardLM-2 7B"},
  851. 'WizardLM-2 8x22B': {'mode': True, 'id': "microsoft/wizardlm-2-8x22b", 'name': "WizardLM-2 8x22B"},
  852. 'Xwin 70B': {'mode': True, 'id': "xwin-lm/xwin-lm-70b", 'name': "Xwin 70B"},
  853. 'Yi 1.5 34B Chat': {'mode': True, 'id': "01-ai/yi-1.5-34b-chat", 'name': "Yi 1.5 34B Chat"},
  854. 'Yi 34B (base)': {'mode': True, 'id': "01-ai/yi-34b", 'name': "Yi 34B (base)"},
  855. 'Yi 34B 200K': {'mode': True, 'id': "01-ai/yi-34b-200k", 'name': "Yi 34B 200K"},
  856. 'Yi 34B Chat': {'mode': True, 'id': "01-ai/yi-34b-chat", 'name': "Yi 34B Chat"},
  857. 'Yi 6B (base)': {'mode': True, 'id': "01-ai/yi-6b", 'name': "Yi 6B (base)"},
  858. 'Yi Large': {'mode': True, 'id': "01-ai/yi-large", 'name': "Yi Large"},
  859. 'Yi Large FC': {'mode': True, 'id': "01-ai/yi-large-fc", 'name': "Yi Large FC"},
  860. 'Yi Large Turbo': {'mode': True, 'id': "01-ai/yi-large-turbo", 'name': "Yi Large Turbo"},
  861. 'Yi Vision': {'mode': True, 'id': "01-ai/yi-vision", 'name': "Yi Vision"},
  862. 'Zephyr 141B-A35B': {'mode': True, 'id': "huggingfaceh4/zephyr-orpo-141b-a35b", 'name': "Zephyr 141B-A35B"},
  863. # Default
  864. 'GPT-4o': {'mode': True, 'id': "GPT-4o", 'name': "GPT-4o"},
  865. 'Gemini-PRO': {'mode': True, 'id': "Gemini-PRO", 'name': "Gemini-PRO"},
  866. 'Claude-sonnet-3.7': {'mode': True, 'id': "Claude-sonnet-3.7", 'name': "Claude-sonnet-3.7"},
  867. 'Claude-sonnet-3.5': {'mode': True, 'id': "Claude-sonnet-3.5", 'name': "Claude-sonnet-3.5"},
  868. 'DeepSeek-V3': {'mode': True, 'id': "deepseek-chat", 'name': "DeepSeek-V3"},
  869. 'DeepSeek-R1': {'mode': True, 'id': "deepseek-reasoner", 'name': "DeepSeek-R1"},
  870. 'Meta-Llama-3.3-70B-Instruct-Turbo': {'mode': True, 'id': "meta-llama/Llama-3.3-70B-Instruct-Turbo", 'name': "Meta-Llama-3.3-70B-Instruct-Turbo"},
  871. 'Gemini-Flash-2.0': {'mode': True, 'id': "Gemini/Gemini-Flash-2.0", 'name': "Gemini-Flash-2.0"},
  872. 'Mistral-Small-24B-Instruct-2501': {'mode': True, 'id': "mistralai/Mistral-Small-24B-Instruct-2501", 'name': "Mistral-Small-24B-Instruct-2501"},
  873. 'DeepSeek-LLM-Chat-(67B)': {'mode': True, 'id': "deepseek-ai/deepseek-llm-67b-chat", 'name': "DeepSeek-LLM-Chat-(67B)"},
  874. 'DBRX-Instruct': {'mode': True, 'id': "databricks/dbrx-instruct", 'name': "DBRX-Instruct"},
  875. 'Qwen-QwQ-32B-Preview': {'mode': True, 'id': "Qwen/QwQ-32B-Preview", 'name': "Qwen-QwQ-32B-Preview"},
  876. 'Nous-Hermes-2-Mixtral-8x7B-DPO': {'mode': True, 'id': "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO", 'name': "Nous-Hermes-2-Mixtral-8x7B-DPO"},
  877. }
  878. # Trending agent modes
  879. trendingAgentMode = {
  880. 'blackboxai-pro': {'mode': True, 'id': "BLACKBOXAI-PRO"},
  881. "Gemini Agent": {'mode': True, 'id': 'gemini'},
  882. "llama-3.1-405 Agent": {'mode': True, 'id': "llama-3.1-405"},
  883. 'llama-3.1-70b Agent': {'mode': True, 'id': "llama-3.1-70b"},
  884. 'llama-3.1-8b Agent': {'mode': True, 'id': "llama-3.1-8b"},
  885. 'Python Agent': {'mode': True, 'id': "python"},
  886. 'HTML Agent': {'mode': True, 'id': "html"},
  887. 'Builder Agent': {'mode': True, 'id': "builder"},
  888. 'Java Agent': {'mode': True, 'id': "java"},
  889. 'JavaScript Agent': {'mode': True, 'id': "javascript"},
  890. 'React Agent': {'mode': True, 'id': "react"},
  891. 'Android Agent': {'mode': True, 'id': "android"},
  892. 'Flutter Agent': {'mode': True, 'id': "flutter"},
  893. 'Next.js Agent': {'mode': True, 'id': "next.js"},
  894. 'AngularJS Agent': {'mode': True, 'id': "angularjs"},
  895. 'Swift Agent': {'mode': True, 'id': "swift"},
  896. 'MongoDB Agent': {'mode': True, 'id': "mongodb"},
  897. 'PyTorch Agent': {'mode': True, 'id': "pytorch"},
  898. 'Xcode Agent': {'mode': True, 'id': "xcode"},
  899. 'Azure Agent': {'mode': True, 'id': "azure"},
  900. 'Bitbucket Agent': {'mode': True, 'id': "bitbucket"},
  901. 'DigitalOcean Agent': {'mode': True, 'id': "digitalocean"},
  902. 'Docker Agent': {'mode': True, 'id': "docker"},
  903. 'Electron Agent': {'mode': True, 'id': "electron"},
  904. 'Erlang Agent': {'mode': True, 'id': "erlang"},
  905. 'FastAPI Agent': {'mode': True, 'id': "fastapi"},
  906. 'Firebase Agent': {'mode': True, 'id': "firebase"},
  907. 'Flask Agent': {'mode': True, 'id': "flask"},
  908. 'Git Agent': {'mode': True, 'id': "git"},
  909. 'Gitlab Agent': {'mode': True, 'id': "gitlab"},
  910. 'Go Agent': {'mode': True, 'id': "go"},
  911. 'Godot Agent': {'mode': True, 'id': "godot"},
  912. 'Google Cloud Agent': {'mode': True, 'id': "googlecloud"},
  913. 'Heroku Agent': {'mode': True, 'id': "heroku"},
  914. }
  915. # Complete list of all models (for authorized users)
  916. _all_models = list(dict.fromkeys([
  917. *fallback_models, # Include all free models
  918. *premium_models, # Include all premium models
  919. *openrouter_pro_models, # Include all OpenRouter Pro models
  920. *image_models,
  921. *list(agentMode.keys()),
  922. *list(trendingAgentMode.keys())
  923. ]))
  924. # Initialize models with fallback_models
  925. models = fallback_models
  926. @classmethod
  927. async def get_models_async(cls) -> list:
  928. """
  929. Asynchronous version of get_models that checks subscription status.
  930. Returns a list of available models based on subscription status.
  931. Premium users get the full list of models.
  932. Free users get fallback_models.
  933. """
  934. # Check if there are valid session data in HAR files
  935. session_data = cls._find_session_in_har_files()
  936. if not session_data:
  937. # For users without HAR files - return free models
  938. debug.log(f"BlackboxPro: Returning free model list with {len(cls.fallback_models)} models")
  939. return cls.fallback_models
  940. # For accounts with HAR files, check subscription status
  941. if 'user' in session_data and 'email' in session_data['user']:
  942. subscription = await cls.check_subscription(session_data['user']['email'])
  943. if subscription['status'] == "PREMIUM":
  944. debug.log(f"BlackboxPro: Returning premium model list with {len(cls._all_models)} models")
  945. return cls._all_models
  946. # For free accounts - return free models
  947. debug.log(f"BlackboxPro: Returning free model list with {len(cls.fallback_models)} models")
  948. return cls.fallback_models
  949. @classmethod
  950. def get_models(cls) -> list:
  951. """
  952. Returns a list of available models based on authorization status.
  953. Authorized users get the full list of models.
  954. Free users get fallback_models.
  955. Note: This is a synchronous method that can't check subscription status,
  956. so it falls back to the basic premium access check.
  957. For more accurate results, use get_models_async when possible.
  958. """
  959. # Check if there are valid session data in HAR files
  960. session_data = cls._find_session_in_har_files()
  961. if not session_data:
  962. # For users without HAR files - return free models
  963. debug.log(f"BlackboxPro: Returning free model list with {len(cls.fallback_models)} models")
  964. return cls.fallback_models
  965. # For accounts with HAR files, check premium access
  966. has_premium_access = cls._check_premium_access()
  967. if has_premium_access:
  968. # For premium users - all models
  969. debug.log(f"BlackboxPro: Returning premium model list with {len(cls._all_models)} models")
  970. return cls._all_models
  971. # For free accounts - return free models
  972. debug.log(f"BlackboxPro: Returning free model list with {len(cls.fallback_models)} models")
  973. return cls.fallback_models
  974. @classmethod
  975. async def check_subscription(cls, email: str) -> dict:
  976. """
  977. Check subscription status for a given email using the Blackbox API.
  978. Args:
  979. email: The email to check subscription for
  980. Returns:
  981. dict: Subscription status information with keys:
  982. - status: "PREMIUM" or "FREE"
  983. - customerId: Customer ID if available
  984. - isTrialSubscription: Whether this is a trial subscription
  985. """
  986. if not email:
  987. return {"status": "FREE", "customerId": None, "isTrialSubscription": False, "lastChecked": None}
  988. headers = {
  989. 'accept': '*/*',
  990. 'accept-language': 'en',
  991. 'content-type': 'application/json',
  992. 'origin': 'https://www.blackbox.ai',
  993. 'referer': 'https://www.blackbox.ai/?ref=login-success',
  994. 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36'
  995. }
  996. try:
  997. async with ClientSession(headers=headers) as session:
  998. async with session.post(
  999. 'https://www.blackbox.ai/api/check-subscription',
  1000. json={"email": email}
  1001. ) as response:
  1002. if response.status != 200:
  1003. debug.log(f"BlackboxPro: Subscription check failed with status {response.status}")
  1004. return {"status": "FREE", "customerId": None, "isTrialSubscription": False, "lastChecked": None}
  1005. result = await response.json()
  1006. status = "PREMIUM" if result.get("hasActiveSubscription", False) else "FREE"
  1007. return {
  1008. "status": status,
  1009. "customerId": result.get("customerId"),
  1010. "isTrialSubscription": result.get("isTrialSubscription", False),
  1011. "lastChecked": result.get("lastChecked")
  1012. }
  1013. except Exception as e:
  1014. debug.log(f"BlackboxPro: Error checking subscription: {e}")
  1015. return {"status": "FREE", "customerId": None, "isTrialSubscription": False, "lastChecked": None}
  1016. @classmethod
  1017. def _check_premium_access(cls) -> bool:
  1018. """
  1019. Checks for an authorized session in HAR files.
  1020. Returns True if a valid session is found.
  1021. """
  1022. try:
  1023. session_data = cls._find_session_in_har_files()
  1024. if not session_data:
  1025. return False
  1026. # Check if this is a premium session
  1027. return True
  1028. except Exception as e:
  1029. debug.log(f"BlackboxPro: Error checking premium access: {e}")
  1030. return False
  1031. @classmethod
  1032. def _find_session_in_har_files(cls) -> Optional[dict]:
  1033. """
  1034. Search for valid session data in HAR files.
  1035. Returns:
  1036. Optional[dict]: Session data if found, None otherwise
  1037. """
  1038. try:
  1039. for file in get_har_files():
  1040. try:
  1041. with open(file, 'rb') as f:
  1042. har_data = json.load(f)
  1043. for entry in har_data['log']['entries']:
  1044. # Only look at blackbox API responses
  1045. if 'blackbox.ai/api' in entry['request']['url']:
  1046. # Look for a response that has the right structure
  1047. if 'response' in entry and 'content' in entry['response']:
  1048. content = entry['response']['content']
  1049. # Look for both regular and Google auth session formats
  1050. if ('text' in content and
  1051. isinstance(content['text'], str) and
  1052. '"user"' in content['text'] and
  1053. '"email"' in content['text'] and
  1054. '"expires"' in content['text']):
  1055. try:
  1056. # Remove any HTML or other non-JSON content
  1057. text = content['text'].strip()
  1058. if text.startswith('{') and text.endswith('}'):
  1059. # Replace escaped quotes
  1060. text = text.replace('\\"', '"')
  1061. har_session = json.loads(text)
  1062. # Check if this is a valid session object
  1063. if (isinstance(har_session, dict) and
  1064. 'user' in har_session and
  1065. 'email' in har_session['user'] and
  1066. 'expires' in har_session):
  1067. debug.log(f"BlackboxPro: Found session in HAR file: {file}")
  1068. return har_session
  1069. except json.JSONDecodeError as e:
  1070. # Only print error for entries that truly look like session data
  1071. if ('"user"' in content['text'] and
  1072. '"email"' in content['text']):
  1073. debug.log(f"BlackboxPro: Error parsing likely session data: {e}")
  1074. except Exception as e:
  1075. debug.log(f"BlackboxPro: Error reading HAR file {file}: {e}")
  1076. return None
  1077. except NoValidHarFileError:
  1078. pass
  1079. except Exception as e:
  1080. debug.log(f"BlackboxPro: Error searching HAR files: {e}")
  1081. return None
  1082. @classmethod
  1083. async def fetch_validated(cls, url: str = "https://www.blackbox.ai", force_refresh: bool = False) -> Optional[str]:
  1084. cache_file = Path(get_cookies_dir()) / 'blackbox.json'
  1085. if not force_refresh and cache_file.exists():
  1086. try:
  1087. with open(cache_file, 'r') as f:
  1088. data = json.load(f)
  1089. if data.get('validated_value'):
  1090. return data['validated_value']
  1091. except Exception as e:
  1092. debug.log(f"BlackboxPro: Error reading cache: {e}")
  1093. js_file_pattern = r'static/chunks/\d{4}-[a-fA-F0-9]+\.js'
  1094. uuid_pattern = r'["\']([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})["\']'
  1095. def is_valid_context(text: str) -> bool:
  1096. return any(char + '=' in text for char in 'abcdefghijklmnopqrstuvwxyz')
  1097. async with ClientSession() as session:
  1098. try:
  1099. async with session.get(url) as response:
  1100. if response.status != 200:
  1101. return None
  1102. page_content = await response.text()
  1103. js_files = re.findall(js_file_pattern, page_content)
  1104. for js_file in js_files:
  1105. js_url = f"{url}/_next/{js_file}"
  1106. async with session.get(js_url) as js_response:
  1107. if js_response.status == 200:
  1108. js_content = await js_response.text()
  1109. for match in re.finditer(uuid_pattern, js_content):
  1110. start = max(0, match.start() - 10)
  1111. end = min(len(js_content), match.end() + 10)
  1112. context = js_content[start:end]
  1113. if is_valid_context(context):
  1114. validated_value = match.group(1)
  1115. cache_file.parent.mkdir(exist_ok=True)
  1116. try:
  1117. with open(cache_file, 'w') as f:
  1118. json.dump({'validated_value': validated_value}, f)
  1119. except Exception as e:
  1120. debug.log(f"BlackboxPro: Error writing cache: {e}")
  1121. return validated_value
  1122. except Exception as e:
  1123. debug.log(f"BlackboxPro: Error retrieving validated_value: {e}")
  1124. return None
  1125. @classmethod
  1126. def generate_id(cls, length: int = 7) -> str:
  1127. chars = string.ascii_letters + string.digits
  1128. return ''.join(random.choice(chars) for _ in range(length))
  1129. @classmethod
  1130. async def create_async_generator(
  1131. cls,
  1132. model: str,
  1133. messages: Messages,
  1134. prompt: str = None,
  1135. proxy: str = None,
  1136. media: MediaListType = None,
  1137. top_p: float = None,
  1138. temperature: float = None,
  1139. max_tokens: int = None,
  1140. conversation: Conversation = None,
  1141. return_conversation: bool = True,
  1142. **kwargs
  1143. ) -> AsyncResult:
  1144. model = cls.get_model(model)
  1145. headers = {
  1146. 'accept': '*/*',
  1147. 'accept-language': 'en-US,en;q=0.9',
  1148. 'content-type': 'application/json',
  1149. 'origin': 'https://www.blackbox.ai',
  1150. 'referer': 'https://www.blackbox.ai/',
  1151. 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
  1152. }
  1153. async with ClientSession(headers=headers) as session:
  1154. if conversation is None or not hasattr(conversation, "chat_id"):
  1155. conversation = Conversation(model)
  1156. conversation.validated_value = await cls.fetch_validated()
  1157. conversation.chat_id = cls.generate_id()
  1158. conversation.message_history = []
  1159. current_messages = []
  1160. for i, msg in enumerate(render_messages(messages)):
  1161. msg_id = conversation.chat_id if i == 0 and msg["role"] == "user" else cls.generate_id()
  1162. current_msg = {
  1163. "id": msg_id,
  1164. "content": msg["content"],
  1165. "role": msg["role"]
  1166. }
  1167. current_messages.append(current_msg)
  1168. media = list(merge_media(media, messages))
  1169. if media:
  1170. current_messages[-1]['data'] = {
  1171. "imagesData": [
  1172. {
  1173. "filePath": f"/{image_name}",
  1174. "contents": to_data_uri(image)
  1175. }
  1176. for image, image_name in media
  1177. ],
  1178. "fileText": "",
  1179. "title": ""
  1180. }
  1181. # Get session data from HAR files
  1182. session_data = cls._find_session_in_har_files()
  1183. # Check if we have a valid session
  1184. if not session_data:
  1185. # No valid session found, raise an error
  1186. debug.log("BlackboxPro: No valid session found in HAR files")
  1187. raise NoValidHarFileError("No valid Blackbox session found. Please log in to Blackbox AI in your browser first.")
  1188. debug.log(f"BlackboxPro: Using session from HAR file (email: {session_data['user'].get('email', 'unknown')})")
  1189. # Check subscription status
  1190. subscription_status = {"status": "FREE", "customerId": None, "isTrialSubscription": False, "lastChecked": None}
  1191. if session_data.get('user', {}).get('email'):
  1192. subscription_status = await cls.check_subscription(session_data['user']['email'])
  1193. debug.log(f"BlackboxPro: Subscription status for {session_data['user']['email']}: {subscription_status['status']}")
  1194. # Determine if user has premium access based on subscription status
  1195. if subscription_status['status'] == "PREMIUM":
  1196. is_premium = True
  1197. else:
  1198. # For free accounts, check if the requested model is in fallback_models
  1199. is_premium = model in cls.fallback_models
  1200. if not is_premium:
  1201. debug.log(f"BlackboxPro: Model {model} not available in free account, falling back to default model")
  1202. model = cls.default_model
  1203. is_premium = True
  1204. data = {
  1205. "messages": current_messages,
  1206. "agentMode": cls.agentMode.get(model, {}) if model in cls.agentMode else {},
  1207. "id": conversation.chat_id,
  1208. "previewToken": None,
  1209. "userId": None,
  1210. "codeModelMode": True,
  1211. "trendingAgentMode": cls.trendingAgentMode.get(model, {}) if model in cls.trendingAgentMode else {},
  1212. "isMicMode": False,
  1213. "userSystemPrompt": None,
  1214. "maxTokens": max_tokens,
  1215. "playgroundTopP": top_p,
  1216. "playgroundTemperature": temperature,
  1217. "isChromeExt": False,
  1218. "githubToken": "",
  1219. "clickedAnswer2": False,
  1220. "clickedAnswer3": False,
  1221. "clickedForceWebSearch": False,
  1222. "visitFromDelta": False,
  1223. "isMemoryEnabled": False,
  1224. "mobileClient": False,
  1225. "userSelectedModel": model if model in cls.userSelectedModel else None,
  1226. "validated": conversation.validated_value,
  1227. "imageGenerationMode": model == cls.default_image_model,
  1228. "webSearchModePrompt": False,
  1229. "deepSearchMode": False,
  1230. "designerMode": False,
  1231. "domains": None,
  1232. "vscodeClient": False,
  1233. "codeInterpreterMode": False,
  1234. "customProfile": {
  1235. "name": "",
  1236. "occupation": "",
  1237. "traits": [],
  1238. "additionalInfo": "",
  1239. "enableNewChats": False
  1240. },
  1241. "session": session_data,
  1242. "isPremium": is_premium,
  1243. "subscriptionCache": {
  1244. "status": subscription_status['status'],
  1245. "customerId": subscription_status['customerId'],
  1246. "isTrialSubscription": subscription_status['isTrialSubscription'],
  1247. "lastChecked": int(datetime.now().timestamp() * 1000)
  1248. },
  1249. "beastMode": False,
  1250. "reasoningMode": False,
  1251. "webSearchMode": False
  1252. }
  1253. # Continue with the API request and async generator behavior
  1254. async with session.post(cls.api_endpoint, json=data, proxy=proxy) as response:
  1255. await raise_for_status(response)
  1256. # Collect the full response
  1257. full_response = []
  1258. async for chunk in response.content.iter_any():
  1259. if chunk:
  1260. chunk_text = chunk.decode()
  1261. if "You have reached your request limit for the hour" in chunk_text:
  1262. raise RateLimitError(chunk_text)
  1263. full_response.append(chunk_text)
  1264. # Only yield chunks for non-image models
  1265. if model != cls.default_image_model:
  1266. yield chunk_text
  1267. full_response_text = ''.join(full_response)
  1268. # For image models, check for image markdown
  1269. if model == cls.default_image_model:
  1270. image_url_match = re.search(r'!\[.*?\]\((.*?)\)', full_response_text)
  1271. if image_url_match:
  1272. image_url = image_url_match.group(1)
  1273. yield ImageResponse(urls=[image_url], alt=format_image_prompt(messages, prompt))
  1274. return
  1275. # Handle conversation history once, in one place
  1276. if return_conversation:
  1277. conversation.message_history.append({"role": "assistant", "content": full_response_text})
  1278. yield conversation
  1279. # For image models that didn't produce an image, fall back to text response
  1280. elif model == cls.default_image_model:
  1281. yield full_response_text