GPT-5 Thinking Autoselect

Automatically select GPT-5 Thinking model in new chats.

当前为 2025-10-05 提交的版本,查看 最新版本

// ==UserScript==
// @name         GPT-5 Thinking Autoselect
// @description  Automatically select GPT-5 Thinking model in new chats.
// @version      1.9
// @author       C89sd
// @namespace    https://greasyfork.org/users/1376767
// @match        https://chatgpt.com/*
// @run-at       document-body
// @noframes
// ==/UserScript==

'use strict';

const CONF_EXTENDED_THINKING = 0;


const THINKING = '?model=gpt-5-thinking'
const EXTENDED = (CONF_EXTENDED_THINKING ? '&effort=extended' : '&effort=standard');
if (location.pathname === '/' && location.search !== THINKING + EXTENDED) {
  location.search = THINKING + EXTENDED;
}

// Log prev/next for SPA navigations
const _pushState = history.pushState;
const _replaceState = history.replaceState;

function wrap(orig) {
  return function (state, title, url) {
    const prev = new URL(location.href);
    const next = url ? new URL(url, prev) : prev;
    const ret = orig.call(this, state, title, url);
    //console.log(orig.name, 'prev:', prev.href, 'next:', next.href, 'current:', location.href);
    if (next.pathname === '/' && prev.pathname !== '/') {
      location.search = THINKING + EXTENDED;
    }
    return ret;
  };
}

history.pushState = wrap(_pushState);
history.replaceState = wrap(_replaceState);