GPT跳短链支付脚本

1.3k 词

前言

解决GPT长连接无法使用0刀卡问题

使用方法

  1. 登录 ChatGPT 官网
  2. F12 打开浏览器开发者工具
  3. 切换到 Console(控制台)标签
  4. 复制下方脚本并粘贴到控制台
  5. 按回车执行,会自动跳转到支付页面

脚本代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(async function () {
try {
// 1. 获取会话信息
const t = await (await fetch("/api/auth/session")).json();

// 2. 检查是否已登录
if (!t.accessToken) {
alert("请先登录 ChatGPT!");
return;
}

// 3. 构建请求载荷
const p = {
plan_name: "chatgptteamplan",
team_plan_data: {
workspace_name: "XYe",
price_interval: "month",
seat_quantity: 5,
},
promo_campaign: {
promo_campaign_id: "team-1-month-free",
is_coupon_from_query_param: true,
},
checkout_ui_mode: "custom",
};

// 4. 发送支付/结账请求
const r = await fetch("https://chatgpt.com/backend-api/payments/checkout", {
method: "POST",
headers: {
Authorization: "Bearer " + t.accessToken,
"Content-Type": "application/json",
},
body: JSON.stringify(p),
});

// 5. 处理响应
const d = await r.json();
if (d.checkout_session_id) {
// 跳转短链接
window.location.href =
"https://chatgpt.com/checkout/openai_llc/" + d.checkout_session_id;
} else {
alert("提取失败:" + (d.detail || JSON.stringify(d)));
}
} catch (e) {
alert("发生错误:" + e);
}
})();

注意事项

  • 必须先登录 ChatGPT 账号
  • 如需订阅 Plus 请自行修改 plan_name 参数
  • 如遇到错误提示,请检查网络连接或重新登录后再试
留言