油猴脚本- ChatGPT Regional Checkout 仅支持free账户


// ==UserScript==
// @name         ChatGPT Regional Checkout
// @namespace    https://chatgpt.com
// @version      1.0.0
// @description  Subscribe to ChatGPT Plus/Pro at regional prices
// @author       Terry33
// @match        https://chatgpt.com/*
// @grant        none
// @run-at       document-idle
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  const PLANS = [
    { label: 'Plus · 菲律賓 PHP ≈$16', plan: 'chatgptplusplan',  country: 'PH',  currency: 'PHP' },
    { label: 'Pro 5x · 菲律賓 PHP ≈$95', plan: 'chatgptprolite', country: 'PH',  currency: 'PHP' },
    { label: 'Pro 5x · 埃及   EGP ≈$89', plan: 'chatgptprolite', country: 'EG',  currency: 'EGP' },
    { label: 'Pro 20x · 菲律賓 PHP ≈$146', plan: 'chatgptpro',   country: 'PH',  currency: 'PHP' },
    { label: 'Pro 20x · 埃及   EGP ≈$164', plan: 'chatgptpro',   country: 'EG',  currency: 'EGP' },
    { label: 'Pro 20x · 加拿大 CAD ≈$184', plan: 'chatgptpro',   country: 'CA',  currency: 'CAD' },
    { label: 'Pro 20x · 巴基斯坦 PKR ≈$176', plan: 'chatgptpro', country: 'PK',  currency: 'PKR' },
    { label: 'Pro 20x · 日本  JPY ≈$174', plan: 'chatgptpro',    country: 'JP',  currency: 'JPY' },
    { label: 'Pro 20x · 越南  VND ≈$180', plan: 'chatgptpro',    country: 'VN',  currency: 'VND' },
  ];

  // --- UI ---
  const btn = document.createElement('div');
  btn.textContent = '🌏';
  Object.assign(btn.style, {
    position: 'fixed', bottom: '80px', right: '20px', zIndex: 99999,
    width: '36px', height: '36px', lineHeight: '36px', textAlign: 'center',
    background: '#10a37f', borderRadius: '50%', cursor: 'pointer',
    fontSize: '18px', boxShadow: '0 2px 8px rgba(0,0,0,.35)',
    userSelect: 'none',
  });

  const panel = document.createElement('div');
  Object.assign(panel.style, {
    position: 'fixed', bottom: '122px', right: '20px', zIndex: 99999,
    background: '#1e1e2e', border: '1px solid #333', borderRadius: '10px',
    padding: '10px 0', width: '260px', display: 'none',
    boxShadow: '0 4px 20px rgba(0,0,0,.5)', fontFamily: 'monospace',
  });

  const title = document.createElement('div');
  title.textContent = 'Regional Checkout';
  Object.assign(title.style, {
    color: '#aaa', fontSize: '11px', textAlign: 'center',
    padding: '0 0 8px', borderBottom: '1px solid #333', marginBottom: '6px',
  });
  panel.appendChild(title);

  PLANS.forEach(p => {
    const row = document.createElement('div');
    row.textContent = p.label;
    Object.assign(row.style, {
      padding: '7px 16px', color: '#e0e0e0', fontSize: '12px',
      cursor: 'pointer', whiteSpace: 'nowrap',
    });
    row.onmouseenter = () => row.style.background = '#2a2a3e';
    row.onmouseleave = () => row.style.background = '';
    row.onclick = () => checkout(p);
    panel.appendChild(row);
  });

  let open = false;
  btn.onclick = () => {
    open = !open;
    panel.style.display = open ? 'block' : 'none';
  };

  document.body.appendChild(btn);
  document.body.appendChild(panel);

  // --- Core ---
  async function checkout({ plan, country, currency }) {
    try {
      const sess = await fetch('/api/auth/session').then(r => r.json());
      if (!sess.accessToken) { alert('請先登入 ChatGPT'); return; }

      const body = {
        entry_point: 'all_plans_pricing_modal',
        plan_name: plan,
        billing_details: { country, currency },
        checkout_ui_mode: 'custom',
      };

      const res = await fetch('https://chatgpt.com/backend-api/payments/checkout', {
        method: 'POST',
        headers: {
          Authorization: 'Bearer ' + sess.accessToken,
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(body),
      }).then(r => r.json());

      if (res.checkout_session_id) {
        window.location.href = 'https://chatgpt.com/checkout/openai_llc/' + res.checkout_session_id;
      } else {
        alert('失敗:' + (res.detail || JSON.stringify(res)));
      }
    } catch (e) {
      alert('錯誤:' + e);
    }
  }
})();

2 个赞

老哥 github 什么的都不上一下吗?

竟然最便宜能便宜到 146 啊 :yaoming:

害怕github账号被端

这样

发泥潭就没这个顾虑了

Have to put in gpt to figure out how to run it, lol :rofl:

可惜还不够便宜