- tools/scripts/llm-key-hunter: GitHub leak hunting pipeline (hunt_*, pivot miner, two-layer verify/content caches, per-provider verification) - usable_keys: verified key vault across 12 providers (deepseek, minimax, volcanoark, longcat, codingplan, zhipu free-tier, mimo, siliconflow, etc.) - .grok/skills/llm-key-hunter: operator skill for the hunt/verify/vault flow - NewAPI channel import scripts and CDP capture helpers - Result verdict buckets (excluding multi-GB blob caches and dedup dumps)
78 lines
3.1 KiB
Python
78 lines
3.1 KiB
Python
#!/usr/bin/env python3
|
|
"""Delete and recreate NewAPI channels with correct type and base_url.
|
|
|
|
Usage:
|
|
python recreate_channels.py # type 1 (OpenAI), base URLs without /chat/completions
|
|
python recreate_channels.py --custom # type 8 (Custom), base URLs with /chat/completions
|
|
"""
|
|
|
|
import argparse
|
|
|
|
from newapi_client import (
|
|
add_channel, delete_channel, get_channel, list_channels, test_channel,
|
|
TYPE_OPENAI, TYPE_CUSTOM,
|
|
)
|
|
from channels_config import (
|
|
build_zhipuai, build_volcano_ark, build_minimax,
|
|
)
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description="Recreate NewAPI channels")
|
|
parser.add_argument("--custom", action="store_true",
|
|
help="Use type 8 (Custom) with full endpoint URLs")
|
|
args = parser.parse_args()
|
|
|
|
channel_type = TYPE_CUSTOM if args.custom else TYPE_OPENAI
|
|
full_url = args.custom
|
|
type_label = "type 8 (Custom)" if args.custom else "type 1 (OpenAI)"
|
|
|
|
# ─── Delete failing channels ─────────────────────────────────
|
|
print("=== Deleting failing channels ===")
|
|
for cid in [6, 7, 8, 9, 10, 12]:
|
|
success, msg = delete_channel(cid)
|
|
print(f" Delete ID={cid:2d} {'✅' if success else '❌'} {msg}")
|
|
|
|
# ─── Recreate ────────────────────────────────────────────────
|
|
print(f"\n=== Recreating channels with {type_label} ===\n")
|
|
|
|
# 1. ZhipuAI
|
|
print("--- ZhipuAI ---")
|
|
ch, n_keys = build_zhipuai(channel_type=channel_type, full_url=full_url)
|
|
success, msg = add_channel(ch, mode="multi_to_single")
|
|
print(f" ZhipuAI-Pool ({n_keys} keys) {'✅' if success else '❌'} {msg}")
|
|
|
|
# 2. VolcanoArk
|
|
print("\n--- VolcanoArk ---")
|
|
for ch in build_volcano_ark(channel_type=channel_type, full_url=full_url):
|
|
success, msg = add_channel(ch)
|
|
print(f" {ch['name']} {'✅' if success else '❌'} {msg}")
|
|
|
|
# 3. MiniMax
|
|
print("\n--- MiniMax ---")
|
|
ch = build_minimax(channel_type=channel_type, full_url=full_url)
|
|
success, msg = add_channel(ch)
|
|
print(f" MiniMax {'✅' if success else '❌'} {msg}")
|
|
|
|
# ─── Verify base_url was set correctly ───────────────────────
|
|
print("\n=== Verifying base_urls ===")
|
|
for ch in list_channels():
|
|
if ch["id"] >= 6:
|
|
print(f" ID={ch['id']:2d} type={ch['type']:2d} name={ch['name']:30s} "
|
|
f"base_url={ch['base_url']}")
|
|
|
|
# ─── Test all new channels ───────────────────────────────────
|
|
print("\n=== Testing channels ===")
|
|
new_ids = [ch["id"] for ch in list_channels() if ch["id"] >= 6]
|
|
for cid in new_ids:
|
|
ch = get_channel(cid)
|
|
name = ch["name"]
|
|
first_model = ch["models"].split(",")[0]
|
|
print(f" ID={cid:2d} {name:30s} (model: {first_model})...", end=" ", flush=True)
|
|
success, msg, _ = test_channel(cid)
|
|
print(f"{'✅' if success else '❌'} {msg[:80]}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|