标签 API Gateway 下的文章

如果你不想看废话,请直接滚动到最后面,有两个 Pure 直接使用的方案。

Kiro 是什么

Kiro 是亚马逊云科技于 2025 年 7 月 16 日推出的专为 AI Agent 设计的集成开发环境(agentic IDE)。

新注册账号有 500 积分可以使用高级模型。

原理

把 kiro 账号 添加到 KiroGate ,转为 标准的 API,配置到 CodeSwitch , 可以在 claude codex 使用

前置准备

各软件配置

Kiro Account Manager 的配置

为什么要这个软件》》》》》最主要的原因是自动刷新 token,免得账号过期。

支持多种方式添加账号

  • 添加账号

KiroGate 配置

安装

GitHub - aliom-v/KiroGate: OpenAI & Anthropic 兼容的 Kiro IDE API 代理网关,支持 Claude Code CLI

  docker run -d -p 8000:8000
  -v kirogate_data:/app/data
  -e PROXY_API_KEY=
  -e ADMIN_PASSWORD="aadf5beb"
  -e USER_SESSION_SECRET=
  -e ADMIN_SECRET_KEY=
  --name kirogate  ghcr.io/awei84/kirogate:main

配置 Kirogate

注册普通用户

因为只有普通用户才能添加自己的 token


访问后台,审核账号

注意 管理员的密码 是 启动容器使用配置的 ADMIN_PASSWORD

KirGate 提供的是隐藏的管理后台,需要手动输入路由进入

比如:http://127.0.0.1:8000/admin/login

/admin/login  → 登录页面
/admin        → 管理面板(需登录)
/admin/logout → 退出登录

切换普通账号,添加 token

imageimage

这个 token 可以在 Kiro Account Manager 复制

添加 token 的时候 可以选择公开或者私有

使用

创建 API key

配置到 CodeSwitch

Kiro 的服务地址:ip:8000/v1/chat/completions

直接配置到 Claude 或者 codex

# OpenAI 格式
curl http://localhost:8000/v1/chat/completions \
  -H "Authorization: Bearer sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-5", "messages": [{"role": "user", "content": "你好"}]}'

# Anthropic 格式
curl http://localhost:8000/v1/messages \
  -H "x-api-key: sk-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-5", "max_tokens": 1024, "messages": [{"role": "user", "content": "你好"}]}' 

号池是啥

你家一个 token 我家一个 token,就变成了 token 池子了

如何获取账号

  • 方法一:google 直接登录
  • 方法二:github 直接登录
  • 方法三:qq 注册 github,然后继续方法二

偷懒方案 1

可以用下面两个现成的。

偷懒方案 2

安装这个软件 GitHub - awei84/KiroGate: issues pr 请去上游仓库

🔐
获取 Refresh Token
🌐 方式一:浏览器获取(推荐)

1打开 https://app.kiro.dev/account/usage 并登录 2F12 打开开发者工具
3点击 应用/Application → 存储/Storage  Cookie 4选择 https://app.kiro.dev 5复制 RefreshToken 的值

🛠️ 方式二:Kiro Account Manager

使用 Kiro Account Manager 可以轻松管理多个账号的 Refresh Token 

参考


📌 转载信息
原作者:
dream_bugless
转载时间:
2026/1/15 18:28:31

简要介绍:

一款专为 Claude Code 设计的智能 API 端点轮换代理工具。它可以帮助你管理多个 API 端点,实现自动故障转移、无感切换,并同时兼容 OpenAI 和 Gemini Api 格式,让你能够直接很方便的使用三大主流厂商的 API 服务。

主要功能:

  1. 自动多端点轮询:可同时配置多个 API 端点,当某个端点请求失败会自动切换到下一个可用端点
  2. 可兼容多格式 API:支持 Claude、OpenAI、Gemini 三种 API 格式互转
  3. 数据实时统计:实时监控请求数、错误数、Token 用量,并支持按月查看详细历史统计数据
  4. 数据同步备份:支持 WebDAV 同步功能,可将数据备份到云端,跨设备同步数据
  5. 跨平台多端应用:支持 Windows、macOS、Linux 系统使用
  6. 超多款主题皮肤:提供了 12 款主题皮肤自由选择,并支持昼夜皮肤自动切换
  7. 启动器功能:直接在程序中一键启动 CC
  8. 最新版已适配 CodeX:可以直接在 codex 中使用,无缝衔接
  9. 历史会话管理:可以查看每个历史会话详情,并一键启动终端继续会话

软件界面:

使用方式:

1. 修改对应配置文件中的 URL 地址 (端口默认 3000):

Claude Code 配置:

cc 配置文件路径 (Win 为例):C:\Users\xxx\.claude\settings.json

{ "env": { "ANTHROPIC_AUTH_TOKEN": "随便写,不重要", "ANTHROPIC_BASE_URL": "http://127.0.0.1:3000", } // 其他配置 } 

Codex CLI 配置:

只需要配置 ~/.codex/config.toml

model_provider = "ccNexus" model = "gpt-5-codex" preferred_auth_method = "apikey" [model_providers.ccNexus] name = "ccNexus" base_url = "http://localhost:3000/v1" wire_api = "responses" # 或 "chat" # 其他配置 

~/.codex/auth.json 可以忽略了

2. 在 ccNexus 中添加可用端点,启用后到 cc 或 cx 中使用即可

软件开源地址:

软件下载地址直达:

感谢大家阅读,里面没有了
确实没有了
真的没有了
真的真的没有了

小调皮一下

本软件纯公益开源,希望能够帮助到大家更高效的使用 CC,提高开发效率,愿佬们喜欢!使用过程中遇到的问题欢迎大家反馈

最新版本增加了一些新功能,欢迎使用,喜欢的话记得点个


📌 转载信息
原作者:
hea7enn
转载时间:
2026/1/15 18:06:35

原本注册不绑卡有这些可以用

kimi-k2-thinking / glm-4.7 / MiniMax-M2.1 / deepseek-v3.2 / llama-4-maverick / llama-4-scout

现在新年全系列开放免费使用
大家来尽量蹬吧

注意一下 base url 是这个

总结

https://chat.chatsking.com/api/chat/completions


📌 转载信息
原作者:
josenlou
转载时间:
2026/1/1 15:48:28

说是单 key 能用十次具体自己研究

注册机源码如下

 import requests
import random
import string
import re
import time
import urllib.parse

def generate_random_email():
    """生成随机8位前缀的邮箱"""
    prefix = ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))
    return f"{prefix}@rccg-clf.org" def send_passwordless_init(email):
    """第一步:发送验证码"""
    url = "https://auth.privy.io/api/v1/passwordless/init"

    headers = {
        "accept": "application/json",
        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
        "cache-control": "no-cache",
        "content-type": "application/json",
        "origin": "https://beta.gatewayz.ai",
        "pragma": "no-cache",
        "priority": "u=1, i",
        "privy-app-id": "cmg8fkib300g3l40dbs6autqe",
        "privy-ca-id": ,
        "privy-client": "react-auth:3.0.1",
        "privy-ui": "t",
        "referer": "https://beta.gatewayz.ai/",
        "sec-ch-ua": '"Microsoft Edge";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": '"Windows"',
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "cross-site",
        "sec-fetch-storage-access": "active",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
    }

    data = {"email": email}

    try:
        response = requests.post(url, headers=headers, json=data)
        return response.json()
    except Exception as e:
        return {"error": str(e)}

def check_email(email):
    """查询邮箱收到的邮件"""
    encoded_email = urllib.parse.quote(email, safe='')
    url = f"https://mail.chatgpt.org.uk/api/emails?email={encoded_email}"

    headers = {
        "accept": "*/*",
        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
        "cache-control": "no-cache",
        "pragma": "no-cache",
        "priority": "u=1, i",
        "referer": f"https://mail.chatgpt.org.uk/{email}",
        "sec-ch-ua": '"Microsoft Edge";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": '"Windows"',
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
    }

    try:
        response = requests.get(url, headers=headers)
        return response.json()
    except Exception as e:
        return {"error": str(e)}

def extract_code(email_content):
    """从邮件内容中提取验证码""" match = re.search(r'\b(\d{6})\b', email_content)
    if match:
        return match.group(1)
    return None def wait_for_code(email, max_attempts=10, interval=2):
    """第二步:循环查询邮件直到获取验证码""" print(f"\n[2] 开始查询邮件 (最多{max_attempts}次,间隔{interval}秒)...")

    for attempt in range(1, max_attempts + 1):
        print(f"    第{attempt}次查询...", end=" ")

        mail_result = check_email(email)

        if mail_result.get("success"):
            emails = mail_result.get("data", {}).get("emails", [])
            if emails:
                for mail in emails:
                    if "privy" in mail.get("from_address", "").lower():
                        content = mail.get("content", "")
                        code = extract_code(content)
                        if code:
                            print(f"成功!")
                            return code
                print("未找到验证码邮件")
            else:
                print("暂无邮件")
        else:
            print(f"查询失败")

        if attempt < max_attempts:
            time.sleep(interval)

    return None def authenticate(email, code):
    """第三步:使用验证码登录获取token"""
    url = "https://auth.privy.io/api/v1/passwordless/authenticate"

    headers = {
        "accept": "application/json",
        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
        "cache-control": "no-cache",
        "content-type": "application/json",
        "origin": "https://beta.gatewayz.ai",
        "pragma": "no-cache",
        "priority": "u=1, i",
        "privy-app-id": "cmg8fkib300g3l40dbs6autqe",
        "privy-ca-id": ,
        "privy-client": "react-auth:3.0.1",
        "referer": "https://beta.gatewayz.ai/",
        "sec-ch-ua": '"Microsoft Edge";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": '"Windows"',
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "cross-site",
        "sec-fetch-storage-access": "active",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
    }

    data = {
        "email": email,
        "code": code,
        "mode": "login-or-sign-up"
    }

    try:
        response = requests.post(url, headers=headers, json=data)
        return response.json()
    except Exception as e:
        return {"error": str(e)}

def create_api_key(auth_result, max_retries=3):
    """第四步:使用token创建API Key"""
    url = "https://beta.gatewayz.ai/api/auth"

    headers = {
        "accept": "*/*",
        "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
        "cache-control": "no-cache",
        "content-type": "application/json",
        "origin": "https://beta.gatewayz.ai",
        "pragma": "no-cache",
        "priority": "u=1, i",
        "referer": "https://beta.gatewayz.ai/onboarding",
        "sec-ch-ua": '"Microsoft Edge";v="143", "Chromium";v="143", "Not A(Brand";v="24"',
        "sec-ch-ua-mobile": "?0",
        "sec-ch-ua-platform": '"Windows"',
        "sec-fetch-dest": "empty",
        "sec-fetch-mode": "cors",
        "sec-fetch-site": "same-origin",
        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
    }

    cookies = {
        "privy-token": auth_result.get("token", ""),
        "privy-session": "t"
    }

    data = {
        "user": auth_result.get("user", {}),
        "token": auth_result.get("token", ""),
        "auto_create_api_key": True,
        "is_new_user": auth_result.get("is_new_user", True),
        "has_referral_code": False,
        "referral_code": None,
        "privy_user_id": auth_result.get("user", {}).get("id", ""),
        "trial_credits": 10
    }

    for attempt in range(1, max_retries + 1):
        try:
            response = requests.post(url, headers=headers, cookies=cookies, json=data, timeout=30)
            result = response.json()
            if result.get("success") or "api_key" in result:
                return result
            # 如果返回错误但不是超时,直接返回 if "error" in result and "timeout" not in result.get("error", "").lower():
                return result
            # 如果是超时或其他错误,继续重试 if attempt < max_retries:
                print(f"    尝试 {attempt}/{max_retries} 失败,3秒后重试...")
                time.sleep(3)
        except requests.exceptions.Timeout:
            if attempt < max_retries:
                print(f"    请求超时 ({attempt}/{max_retries}),3秒后重试...")
                time.sleep(3)
            else:
                return {"error": "Request timeout after retries"}
        except Exception as e:
            if attempt < max_retries:
                print(f"    请求失败 ({attempt}/{max_retries}): {str(e)},3秒后重试...")
                time.sleep(3)
            else:
                return {"error": str(e)}
    
    return {"error": "Max retries reached"}

def run():
    """运行完整流程""" print("=" * 50)
    print("Gatewayz 自动注册/登录")
    print("=" * 50)

    # 第一步:生成邮箱并发送验证码
    email = generate_random_email()
    print(f"\n[1] 生成邮箱: {email}")

    result = send_passwordless_init(email)
    if not result.get("success"):
        print(f"    发送验证码失败: {result}")
        return None print(f"    发送验证码成功!")

    # 第二步:获取验证码
    code = wait_for_code(email, max_attempts=10, interval=2)
    if not code:
        print(f"\n获取验证码失败,请手动查看: https://mail.chatgpt.org.uk/{email}")
        return None print(f"    验证码: {code}")

    # 第三步:登录认证 print(f"\n[3] 正在登录认证...")
    auth_result = authenticate(email, code)

    if "error" in auth_result:
        print(f"    登录失败: {auth_result}")
        return None if "token" not in auth_result:
        print(f"    登录失败: {auth_result}")
        return None print(f"    登录成功!")

    # 第四步:创建API Key print(f"\n[4] 正在创建API Key...")
    api_result = create_api_key(auth_result)

    if "error" in api_result:
        print(f"    创建API Key失败: {api_result}")
        return None if not api_result.get("success"):
        print(f"    创建API Key失败: {api_result}")
        return None

    api_key = api_result.get("api_key", "")
    if not api_key:
        print(f"    创建API Key失败: 未返回API Key")
        return None print(f"    创建成功!")

    # 保存API Key到文件 with open("api_keys.txt", "a", encoding="utf-8") as f:
        f.write(f"{api_key}\n")

    # 输出结果 print("\n" + "=" * 50)
    print("账号创建成功!")
    print("=" * 50)
    print(f"邮箱: {email}")
    print(f"用户ID: {api_result.get('user_id', 'N/A')}")
    print(f"Privy用户ID: {api_result.get('privy_user_id', 'N/A')}")
    print(f"试用积分: {api_result.get('credits', 'N/A')}")
    print(f"订阅状态: {api_result.get('subscription_status', 'N/A')}")
    print(f"试用到期时间: {api_result.get('trial_expires_at', 'N/A')}")
    print(f"\nAPI Key:\n{api_key}")
    print(f"\n已保存到: api_keys.txt")
    print("=" * 50)

    return {
        "email": email,
        "user_id": api_result.get('user_id'),
        "privy_user_id": api_result.get('privy_user_id'),
        "api_key": api_key,
        "credits": api_result.get('credits'),
        "subscription_status": api_result.get('subscription_status'),
        "trial_expires_at": api_result.get('trial_expires_at')
    }

if __name__ == "__main__":
    run()

📌 转载信息
原作者:
ZeroLiya
转载时间:
2025/12/27 20:48:40