ChatGPT随心飞教程
目录
- 电脑端打开 https://chatgpt.com/ ,并确保已经登陆
- 按F12打开开发者工具,点击 Console 或者 控制台
- 将以下内容复制输入,然后回车即可
js
javascript: (async function () {
const countries = {
"美国 (USD)": { country: "US", currency: "USD" },
"加拿大 (CAD)": { country: "CA", currency: "CAD" },
"澳大利亚 (AUD)": { country: "AU", currency: "AUD" },
"英国 (GBP)": { country: "GB", currency: "GBP" },
"欧元区 (EUR)": { country: "DE", currency: "EUR" },
"智利 (CLP)": { country: "CL", currency: "CLP" },
"日本 (JPY)": { country: "JP", currency: "JPY" },
"印度 (INR)": { country: "IN", currency: "INR" },
"印度尼西亚 (IDR)": { country: "ID", currency: "IDR" },
"巴基斯坦 (PKR)": { country: "PK", currency: "PKR" },
"泰国 (THB)": { country: "TH", currency: "THB" },
"马来西亚 (MYR)": { country: "MY", currency: "MYR" },
"台湾 (TWD)": { country: "TW", currency: "TWD" },
"越南 (VND)": { country: "VN", currency: "VND" },
"菲律宾 (PHP)": { country: "PH", currency: "PHP" },
"尼日利亚 (NGN)": { country: "NG", currency: "NGN" },
"南非 (ZAR)": { country: "ZA", currency: "ZAR" },
"哈萨克斯坦 (KZT)": { country: "KZ", currency: "KZT" },
"坦桑尼亚 (TZS)": { country: "TZ", currency: "TZS" },
"埃及 (EGP)": { country: "EG", currency: "EGP" },
"巴西 (BRL)": { country: "BR", currency: "BRL" },
"瑞典 (SEK)": { country: "SE", currency: "SEK" },
"捷克 (CZK)": { country: "CZ", currency: "CZK" },
"波兰 (PLN)": { country: "PL", currency: "PLN" },
"丹麦 (DKK)": { country: "DK", currency: "DKK" },
"挪威 (NOK)": { country: "NO", currency: "NOK" },
"韩国 (KRW)": { country: "KR", currency: "KRW" },
"哥伦比亚 (COP)": { country: "CO", currency: "COP" },
"墨西哥 (MXN)": { country: "MX", currency: "MXN" },
"秘鲁 (PEN)": { country: "PE", currency: "PEN" },
"匈牙利 (HUF)": { country: "HU", currency: "HUF" },
"卡塔尔 (QAR)": { country: "QA", currency: "QAR" },
"罗马尼亚 (RON)": { country: "RO", currency: "RON" },
"以色列 (ILS)": { country: "IL", currency: "ILS" },
"阿联酋 (AED)": { country: "AE", currency: "AED" },
"新加坡 (SGD)": { country: "SG", currency: "SGD" },
"新西兰 (NZD)": { country: "NZ", currency: "NZD" },
"瑞士 (CHF)": { country: "CH", currency: "CHF" },
"沙特 (SAR)": { country: "SA", currency: "SAR" },
};
// 删除旧窗口
const old = document.getElementById("chatgpt-pay-panel");
if (old) {
old.remove();
}
const panel = document.createElement("div");
panel.id = "chatgpt-pay-panel";
panel.innerHTML = `
<style>
#chatgpt-pay-panel select {
color:#111 !important;
background:#fff !important;
appearance:auto !important;
-webkit-appearance:auto !important;
width:100%;
height:42px;
padding:8px 10px;
border:1px solid #ccc;
border-radius:8px;
font-size:14px;
}
#chatgpt-pay-panel option {
color:#111 !important;
background:#fff !important;
}
#chatgpt-pay-panel button:hover {
opacity:.85;
}
</style>
<div style="
font-size:18px;
font-weight:700;
margin-bottom:15px;
color:#111;
">
ChatGPT付款选择
</div>
<select id="pay-country" style="
margin-bottom:16px;
">
${Object.keys(countries)
.map(
(x) => `
<option value="${x}">
${x}
</option>
`,
)
.join("")}
</select>
<div id="philippines-tax-free-tip" style="
display:none;
margin-top:-6px;
margin-bottom:16px;
padding:10px;
border-radius:8px;
background:#fff7e6;
color:#8a5700;
font-size:13px;
line-height:1.6;
">
选择菲律宾时,添加银行卡需要选择免税州。可使用
<a href="https://www.randaddress.com/zh/genaddress/tax-free-address/" target="_blank" rel="noopener noreferrer" style="color:#0969da;">
随机免税州地址生成器
</a>
生成地址。
</div>
<select id="pay-plan" style="
margin-bottom:16px;
">
<option value="chatgptplusplan">
ChatGPT Plus
</option>
<option value="chatgptgoplan">
ChatGPT Go
</option>
<option value="chatgptprolite">
ChatGPT Pro Lite
</option>
</select>
<br>
<button id="pay-start">
创建付款
</button>
<div id="pay-status">
等待操作...
</div>
<div style="
margin-top:14px;
padding-top:12px;
border-top:1px solid #eee;
color: #000;
font-size:13px;
line-height:1.6;
">
没有信用卡?:<a href="https://truraly.fun/%E4%B8%93%E9%A2%98/Harnless%E5%B7%A5%E7%A8%8B/AI%E8%AE%A2%E9%98%85/Roogoo%20%E8%99%9A%E6%8B%9F%E5%8D%A1%E7%94%B3%E8%AF%B7%E4%BD%BF%E7%94%A8.html" target="_blank" rel="noopener noreferrer" style="color:#0969da;">
Roogoo 虚拟卡申请使用
</a>
</div>
`;
panel.style.cssText = `
position:fixed;
right:25px;
bottom:25px;
z-index:999999;
width:330px;
background:white;
padding:20px;
border-radius:14px;
box-shadow:
0 10px 40px rgba(0,0,0,.25);
font-family:
Arial,
"Microsoft YaHei",
sans-serif;
`;
const button = panel.querySelector("#pay-start");
button.style.cssText = `
width:100%;
height:42px;
margin-top:15px;
border:none;
border-radius:8px;
background:#10a37f;
color:white;
font-size:15px;
cursor:pointer;
`;
const status = panel.querySelector("#pay-status");
status.style.cssText = `
margin-top:10px;
font-size:13px;
color:#666;
`;
document.body.appendChild(panel);
const countrySelect = panel.querySelector("#pay-country");
const philippinesTaxFreeTip = panel.querySelector(
"#philippines-tax-free-tip",
);
function updateCountryTip() {
philippinesTaxFreeTip.style.display =
countrySelect.value === "菲律宾 (PHP)" ? "block" : "none";
}
countrySelect.addEventListener("change", updateCountryTip);
updateCountryTip();
// 强制刷新状态
async function setStatus(text) {
status.innerText = text;
await new Promise((resolve) => {
requestAnimationFrame(resolve);
});
}
button.onclick = async () => {
try {
await setStatus("正在创建支付链接...");
const session = await (await fetch("/api/auth/session")).json();
if (!session.accessToken) {
alert("请先登录 ChatGPT!");
return;
}
await setStatus("正在读取账户信息...");
const countryName = panel.querySelector("#pay-country").value;
const countryInfo = countries[countryName];
const plan = panel.querySelector("#pay-plan").value;
await setStatus("正在请求支付服务器...");
const response = await fetch(
"https://chatgpt.com/backend-api/payments/checkout",
{
method: "POST",
headers: {
Authorization: "Bearer " + session.accessToken,
"Content-Type": "application/json",
},
body: JSON.stringify({
entry_point: "all_plans_pricing_modal",
plan_name: plan,
billing_details: {
country: countryInfo.country,
currency: countryInfo.currency,
},
checkout_ui_mode: "custom",
}),
},
);
await setStatus("正在解析支付链接...");
const data = await response.json();
if (data.checkout_session_id) {
await setStatus("跳转支付页面...");
location.href =
"https://chatgpt.com/checkout/openai_llc/" + data.checkout_session_id;
} else {
alert("创建失败:\n" + (data.detail || JSON.stringify(data)));
await setStatus("创建失败");
}
} catch (e) {
alert("发生错误:\n" + e);
await setStatus("发生错误");
}
};
})();报错

如果如上出现报错手动输入一下 allow pasting 即可
菲律宾免税州设置
选择菲律宾的时候需要注意添加银行卡时需要选择免税州,不然价格会贵一点
