modeloc: 26 verified live models, guard + full-catalog probe
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
update channels set models='Agents-A1,agnes-2.5-flash,MiniMax-M2.7-highspeed,agnes-3.0-flash,cx/gpt-5.6-luna-review,Atria-Dawn-Preview,cx/gpt-6-luna,cx/gpt-5.6-luna,SenseNova-6.8-Flash-Lite,gemini-auto,intern-s2,glm-5.2,deepseek-v4.1-flash,grok-chat-fast,grok-4.5,openai/gpt-oss-20b,z-ai/glm-5.3-flash,kr/claude-sonnet-4.5,Qwen3.8-Flash-Next,kr/glm-5,nvidia/nemotron-3-ultra-550b-a55b:free,grok-4.6,grok-4.7,glm-4.5-air,spark-x2.6-4b,deepseek-v4-flash' where tag='modeloc';
|
||||||
|
delete from abilities a using channels c where a.channel_id=c.id and c.tag='modeloc';
|
||||||
|
insert into abilities ("group",model,channel_id,enabled,priority,weight,tag) select g.grp, trim(m.model), c.id, true, c.priority, 0, c.tag from channels c cross join lateral unnest(string_to_array(c."group",',')) g(grp) cross join lateral unnest(string_to_array(c.models,',')) m(model) where c.tag='modeloc' and c.status=1 and trim(m.model)<>'';
|
||||||
|
select 'ch='||count(*)||' models='||count(distinct models) from channels where tag='modeloc' and status=1;
|
||||||
|
select 'abil='||count(*) from abilities a join channels c on c.id=a.channel_id where c.tag='modeloc' and a.enabled;
|
||||||
@@ -39,15 +39,7 @@ GROUPS = ['default', 'premium', 't1', 't2', 't3', 't4']
|
|||||||
|
|
||||||
# Честно проверено живым запросом на trial-аккаунте ($10): остальные 130 имён
|
# Честно проверено живым запросом на trial-аккаунте ($10): остальные 130 имён
|
||||||
# каталога /pool/v1/models отдают 422 invalid_model_error (витрина).
|
# каталога /pool/v1/models отдают 422 invalid_model_error (витрина).
|
||||||
DEFAULT_MODELS = ('Agents-A1,Atria-Dawn-Preview,LongCat-2.0,LongCat-2.5-Preview,Qwen3.8-F'
|
DEFAULT_MODELS = ('Agents-A1,agnes-2.5-flash,MiniMax-M2.7-highspeed,agnes-3.0-flash,cx/gpt-5.6-luna-review,Atria-Dawn-Preview,cx/gpt-6-luna,cx/gpt-5.6-luna,SenseNova-6.8-Flash-Lite,gemini-auto,intern-s2,glm-5.2,deepseek-v4.1-flash,grok-chat-fast,grok-4.5,openai/gpt-oss-20b,z-ai/glm-5.3-flash,kr/claude-sonnet-4.5,Qwen3.8-Flash-Next,kr/glm-5,nvidia/nemotron-3-ultra-550b-a55b:free,grok-4.6,grok-4.7,glm-4.5-air,spark-x2.6-4b,deepseek-v4-flash')
|
||||||
'lash-Next,SenseNova-6.8-Flash-Lite,agnes-2.5-flash,agnes-3.0-flash,cx/'
|
|
||||||
'gpt-5.6-luna,cx/gpt-5.6-luna-review,cx/gpt-6-luna,deepseek-v4-flash,de'
|
|
||||||
'epseek-v4.1-flash,gemini-auto,glm-4.5-air,gpt-6.1-terra,grok-4.5,grok-'
|
|
||||||
'4.6,grok-4.7,grok-chat-fast,grok-imagine-image,grok-imagine-image-2.0,'
|
|
||||||
'hy4-preview,intern-s2,kimi-k3,kr/claude-sonnet-4.5,kr/glm-5,nvidia/lla'
|
|
||||||
'ma-3.1-nemotron-safety-guard-8b-v3,nvidia/riva-translate-4b-instruct-v'
|
|
||||||
'2,openai/gpt-oss-20b,qwen/qwen3.8-max:free,qwen3.8-27b,spark-x2.6-4b,z'
|
|
||||||
'-ai/glm-5.3-flash,zai-org/GLM-5.3-Flash')
|
|
||||||
MODELS = [m.strip() for m in os.environ.get('INJECT_MODELS', DEFAULT_MODELS).split(',') if m.strip()]
|
MODELS = [m.strip() for m in os.environ.get('INJECT_MODELS', DEFAULT_MODELS).split(',') if m.strip()]
|
||||||
|
|
||||||
SCM = '{"400":429,"401":429,"403":429}' # ретрай вместо клиентской ошибки
|
SCM = '{"400":429,"401":429,"403":429}' # ретрай вместо клиентской ошибки
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
[
|
||||||
|
"Agents-A1",
|
||||||
|
"agnes-2.5-flash",
|
||||||
|
"MiniMax-M2.7-highspeed",
|
||||||
|
"agnes-3.0-flash",
|
||||||
|
"cx/gpt-5.6-luna-review",
|
||||||
|
"Atria-Dawn-Preview",
|
||||||
|
"cx/gpt-6-luna",
|
||||||
|
"cx/gpt-5.6-luna",
|
||||||
|
"SenseNova-6.8-Flash-Lite",
|
||||||
|
"gemini-auto",
|
||||||
|
"intern-s2",
|
||||||
|
"glm-5.2",
|
||||||
|
"deepseek-v4.1-flash",
|
||||||
|
"nvidia/ising-calibration-1.5-31b",
|
||||||
|
"grok-chat-fast",
|
||||||
|
"grok-4.5",
|
||||||
|
"openai/gpt-oss-20b",
|
||||||
|
"z-ai/glm-5.3-flash",
|
||||||
|
"kr/claude-sonnet-4.5",
|
||||||
|
"Qwen3.8-Flash-Next",
|
||||||
|
"kr/glm-5",
|
||||||
|
"nvidia/nemotron-3-ultra-550b-a55b:free",
|
||||||
|
"grok-imagine-image-2.0",
|
||||||
|
"grok-4.6",
|
||||||
|
"grok-4.7",
|
||||||
|
"nvidia/riva-translate-4b-instruct-v2",
|
||||||
|
"glm-4.5-air",
|
||||||
|
"spark-x2.6-4b",
|
||||||
|
"nvidia/llama-3.1-nemotron-safety-guard-8b-v3",
|
||||||
|
"deepseek-v4-flash"
|
||||||
|
]
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Сторож каналов modeloc: возвращает status=1 и abilities.enabled=true.
|
||||||
|
|
||||||
|
Гарды new-api (и ручные чистки) ставят каналам status=0 — при этом abilities
|
||||||
|
выпадают из роутинга и модель отвечает 503. Сторож возвращает их каждые 5 мин
|
||||||
|
и печатает строку только когда что-то реально восстановил.
|
||||||
|
"""
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
SQL = """
|
||||||
|
WITH fixed AS (
|
||||||
|
UPDATE channels SET status=1 WHERE tag='modeloc' AND status=0 RETURNING id
|
||||||
|
), ab AS (
|
||||||
|
UPDATE abilities a SET enabled=true FROM channels c
|
||||||
|
WHERE c.id=a.channel_id AND c.tag='modeloc' AND c.status=1 AND NOT a.enabled
|
||||||
|
RETURNING a.channel_id
|
||||||
|
)
|
||||||
|
SELECT (SELECT count(*) FROM fixed) || ' ' || (SELECT count(*) FROM ab);
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def run(sql):
|
||||||
|
p = subprocess.run(["su", "postgres", "-c", "psql -d newapi -At -c \"%s\"" % sql.replace('"', '\\"')],
|
||||||
|
capture_output=True, text=True, timeout=120)
|
||||||
|
return (p.stdout or '').strip(), p.returncode
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
out, rc = run(SQL)
|
||||||
|
if rc != 0:
|
||||||
|
print('MODELOC GUARD FAIL rc=%d' % rc, file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
parts = out.split()
|
||||||
|
if len(parts) >= 2:
|
||||||
|
ch, ab = int(parts[0] or 0), int(parts[1] or 0)
|
||||||
|
if ch or ab:
|
||||||
|
print('MODELOC GUARD: restored channels=%d abilities=%d' % (ch, ab))
|
||||||
|
subprocess.run(["systemctl", "restart", "new-api"], check=False, timeout=120)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
PATH = '/opt/grok-bot/iishko/catalog.py'
|
||||||
|
src = open(PATH, encoding='utf-8').read()
|
||||||
|
if '[MODELOC 1103]' in src:
|
||||||
|
print('ALREADY')
|
||||||
|
raise SystemExit
|
||||||
|
|
||||||
|
block = '''# [MODELOC 1103] проверенный живой набор modeloc
|
||||||
|
for _t, _ms in ((1, ['glm-4.5-air', 'nvidia/nemotron-3-ultra-550b-a55b:free']),
|
||||||
|
(3, ['MiniMax-M2.7-highspeed', 'glm-5.2'])):
|
||||||
|
TIER_MODELS[_t] += [m for m in _ms if m not in TIER_MODELS[_t]]
|
||||||
|
MODEL_DESCS.update({
|
||||||
|
'glm-4.5-air': 'GLM 4.5 Air · лёгкая, быстрые ответы',
|
||||||
|
'nvidia/nemotron-3-ultra-550b-a55b:free': 'Nemotron 3 Ultra 550B (free) · тяжёлые задачи',
|
||||||
|
'MiniMax-M2.7-highspeed': 'MiniMax M2.7 Highspeed · быстрый чат и код',
|
||||||
|
'glm-5.2': 'GLM 5.2 · тексты, код, анализ',
|
||||||
|
})
|
||||||
|
|
||||||
|
'''
|
||||||
|
anchor = 'CHAT_MODELS = list(dict.fromkeys('
|
||||||
|
i = src.index(anchor)
|
||||||
|
src = src[:i] + block + src[i:]
|
||||||
|
open(PATH, 'w', encoding='utf-8').write(src)
|
||||||
|
print('PATCHED')
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import re, sys
|
||||||
|
|
||||||
|
MODELS = ['Agents-A1','agnes-2.5-flash','MiniMax-M2.7-highspeed','agnes-3.0-flash',
|
||||||
|
'cx/gpt-5.6-luna-review','Atria-Dawn-Preview','cx/gpt-6-luna','cx/gpt-5.6-luna',
|
||||||
|
'SenseNova-6.8-Flash-Lite','gemini-auto','intern-s2','glm-5.2','deepseek-v4.1-flash',
|
||||||
|
'grok-chat-fast','grok-4.5','openai/gpt-oss-20b','z-ai/glm-5.3-flash',
|
||||||
|
'kr/claude-sonnet-4.5','Qwen3.8-Flash-Next','kr/glm-5','grok-4.6','grok-4.7',
|
||||||
|
'glm-4.5-air','spark-x2.6-4b','deepseek-v4-flash',
|
||||||
|
'nvidia/nemotron-3-ultra-550b-a55b:free']
|
||||||
|
|
||||||
|
block = "# [MODELOC 1103] проверенный живой набор\nMODELS += [m for m in %r if m not in MODELS]\n\n" % (MODELS,)
|
||||||
|
|
||||||
|
for path in ('/root/sso_limits.py', '/opt/grok-bot/iishko/legacy.py'):
|
||||||
|
try:
|
||||||
|
src = open(path, encoding='utf-8').read()
|
||||||
|
except Exception as e:
|
||||||
|
print('SKIP', path, e)
|
||||||
|
continue
|
||||||
|
if '[MODELOC 1103]' in src:
|
||||||
|
print('ALREADY', path)
|
||||||
|
continue
|
||||||
|
if path.endswith('sso_limits.py'):
|
||||||
|
marker = "apply = '--apply' in sys.argv"
|
||||||
|
if marker not in src:
|
||||||
|
print('NO MARKER', path)
|
||||||
|
continue
|
||||||
|
src = src.replace(marker, block + marker, 1)
|
||||||
|
else:
|
||||||
|
# legacy.py: добавляем в конец функции rank_models через якорь IMG_ALWAYS
|
||||||
|
m = re.search(r'^(\s*)models \+= IMG_MODELS \+ IMG_ALWAYS\s*$', src, re.M)
|
||||||
|
if not m:
|
||||||
|
print('NO ANCHOR', path)
|
||||||
|
continue
|
||||||
|
ind = m.group(1)
|
||||||
|
add = m.group(0) + '\n' + ind + '# [MODELOC 1103]\n' + ind + 'models += [m for m in %r if m not in models]' % (MODELS,)
|
||||||
|
src = src[:m.start()] + add + src[m.end():]
|
||||||
|
open(path, 'w', encoding='utf-8').write(src)
|
||||||
|
print('PATCHED', path)
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
"""Проба ВСЕХ моделей modeloc на живых ключах."""
|
||||||
|
import json, sys, time, threading
|
||||||
|
import requests
|
||||||
|
|
||||||
|
HERE = r'C:/Users/User/tmp/modeloc-autoreg'
|
||||||
|
URL = 'https://modeloc.com/pool/v1/chat/completions'
|
||||||
|
|
||||||
|
|
||||||
|
def load_keys(n=4):
|
||||||
|
keys = []
|
||||||
|
for f in ('bank_c.jsonl', 'bank_d.jsonl', 'bank_a.jsonl', 'bank_b.jsonl'):
|
||||||
|
try:
|
||||||
|
for line in open(HERE + '/' + f, encoding='utf-8'):
|
||||||
|
try:
|
||||||
|
b = json.loads(line)
|
||||||
|
except Exception:
|
||||||
|
continue
|
||||||
|
if b.get('key') and str(b.get('credits', '')).startswith('1000') and b['key'] not in keys:
|
||||||
|
keys.append(b['key'])
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
return keys[:n]
|
||||||
|
|
||||||
|
|
||||||
|
def probe(key, model):
|
||||||
|
t0 = time.time()
|
||||||
|
try:
|
||||||
|
r = requests.post(URL, headers={'Authorization': 'Bearer ' + key, 'Content-Type': 'application/json'},
|
||||||
|
json={'model': model, 'messages': [{'role': 'user', 'content': 'say ok'}],
|
||||||
|
'max_tokens': 30}, timeout=70)
|
||||||
|
code = r.status_code
|
||||||
|
txt = ''
|
||||||
|
if code == 200:
|
||||||
|
try:
|
||||||
|
txt = (r.json()['choices'][0]['message'].get('content') or '')[:40]
|
||||||
|
except Exception:
|
||||||
|
txt = 'parse'
|
||||||
|
except Exception as e:
|
||||||
|
code, txt = 0, type(e).__name__
|
||||||
|
return code, txt, round(time.time() - t0, 1)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
models = json.load(open(HERE + '/mc_all_models.json', encoding='utf-8'))
|
||||||
|
keys = load_keys(4)
|
||||||
|
jobs = [(i % len(keys), m) for i, m in enumerate(models * len(keys))]
|
||||||
|
jobs = [(keys[ki], m) for ki, m in jobs]
|
||||||
|
results = {}
|
||||||
|
lock = threading.Lock()
|
||||||
|
out = open(HERE + '/probe_all.log', 'w', encoding='utf-8')
|
||||||
|
|
||||||
|
def work(chunk):
|
||||||
|
for key, m in chunk:
|
||||||
|
code, txt, el = probe(key, m)
|
||||||
|
with lock:
|
||||||
|
results.setdefault(m, []).append(code)
|
||||||
|
out.write('%s\t%d\t%s\t%s\n' % (m, code, el, txt.replace('\n', ' ')))
|
||||||
|
out.flush()
|
||||||
|
print('%s %d %s' % (m, code, el), flush=True)
|
||||||
|
|
||||||
|
nw = 12
|
||||||
|
chunks = [jobs[i::nw] for i in range(nw)]
|
||||||
|
th = [threading.Thread(target=work, args=(c,)) for c in chunks]
|
||||||
|
for t in th:
|
||||||
|
t.start()
|
||||||
|
for t in th:
|
||||||
|
t.join()
|
||||||
|
|
||||||
|
good = []
|
||||||
|
for m, codes in results.items():
|
||||||
|
ok = sum(1 for c in codes if c == 200)
|
||||||
|
if ok >= 2:
|
||||||
|
good.append((m, ok, len(codes)))
|
||||||
|
good.sort(key=lambda x: -x[1])
|
||||||
|
json.dump([g[0] for g in good], open(HERE + '/mc_good_models.json', 'w'), ensure_ascii=False, indent=0)
|
||||||
|
print('\n=== GOOD (200 on >=2 keys): %d' % len(good))
|
||||||
|
for m, ok, tot in good:
|
||||||
|
print('%2d/%d %s' % (ok, tot, m))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
@@ -50,12 +50,14 @@ def done_set():
|
|||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
def worker(batch, wid, delay, retries):
|
def worker(batch, wid, delay, retries, proxies=None):
|
||||||
for acc in batch:
|
proxies = proxies or []
|
||||||
|
for pos, acc in enumerate(batch):
|
||||||
tries = 0
|
tries = 0
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
res = reg.reg(acc)
|
px = proxies[(wid + pos) % len(proxies)] if proxies else None
|
||||||
|
res = reg.reg(acc, proxy=px)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
res = {'login': acc['login'], 'ok': False, 'error': 'exc ' + str(e)[:100]}
|
res = {'login': acc['login'], 'ok': False, 'error': 'exc ' + str(e)[:100]}
|
||||||
err = res.get('error') or ''
|
err = res.get('error') or ''
|
||||||
@@ -96,6 +98,9 @@ def main():
|
|||||||
ap.add_argument('--workers', type=int, default=3)
|
ap.add_argument('--workers', type=int, default=3)
|
||||||
ap.add_argument('--delay', type=float, default=4)
|
ap.add_argument('--delay', type=float, default=4)
|
||||||
ap.add_argument('--retries', type=int, default=2)
|
ap.add_argument('--retries', type=int, default=2)
|
||||||
|
ap.add_argument('--proxy', default='', help='список прокси через ; (ротация по кругу)')
|
||||||
|
ap.add_argument('--skip-prefix', default='baradok609', help='логины с этим префиксом не берём')
|
||||||
|
ap.add_argument('--allow-no-totp', action='store_true', help='брать и аккаунты без TOTP (2FA может быть выключен)')
|
||||||
a = ap.parse_args()
|
a = ap.parse_args()
|
||||||
# argv важнее env: в фоне на Windows env-префиксы теряются
|
# argv важнее env: в фоне на Windows env-префиксы теряются
|
||||||
KEYS = a.bank
|
KEYS = a.bank
|
||||||
@@ -106,7 +111,9 @@ def main():
|
|||||||
picked = []
|
picked = []
|
||||||
for i in range(a.start, len(pool)):
|
for i in range(a.start, len(pool)):
|
||||||
acc = pool[i]
|
acc = pool[i]
|
||||||
if acc['login'] in seen or not acc.get('totp'):
|
if acc['login'] in seen or (not acc.get('totp') and not a.allow_no_totp):
|
||||||
|
continue
|
||||||
|
if a.skip_prefix and acc['login'].startswith(a.skip_prefix):
|
||||||
continue
|
continue
|
||||||
acc = dict(acc)
|
acc = dict(acc)
|
||||||
acc['_idx'] = i
|
acc['_idx'] = i
|
||||||
@@ -115,8 +122,10 @@ def main():
|
|||||||
break
|
break
|
||||||
print(json.dumps({'picked': len(picked), 'start': a.start,
|
print(json.dumps({'picked': len(picked), 'start': a.start,
|
||||||
'workers': a.workers, 'delay': a.delay}), flush=True)
|
'workers': a.workers, 'delay': a.delay}), flush=True)
|
||||||
|
proxies = [x.strip() for x in a.proxy.split(';') if x.strip()]
|
||||||
|
print(json.dumps({'proxies': len(proxies)}), flush=True)
|
||||||
chunks = [picked[i::a.workers] for i in range(a.workers)]
|
chunks = [picked[i::a.workers] for i in range(a.workers)]
|
||||||
th = [threading.Thread(target=worker, args=(c, i, a.delay, a.retries)) for i, c in enumerate(chunks)]
|
th = [threading.Thread(target=worker, args=(c, i, a.delay, a.retries, proxies)) for i, c in enumerate(chunks)]
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
for t in th:
|
for t in th:
|
||||||
t.start()
|
t.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user