Skip to content

Instantly share code, notes, and snippets.

@JKamsker
Created June 26, 2024 06:51
Show Gist options
  • Save JKamsker/6ab92d617b52a878c41796571b161ecd to your computer and use it in GitHub Desktop.
Save JKamsker/6ab92d617b52a878c41796571b161ecd to your computer and use it in GitHub Desktop.
OpenAI Chat GPT-4o enforce
// ==UserScript==
// @name OpenAI Chat GPT-4o enforce
// @version 1
// @grant none
// @description This script enforces the GPT-4o model on the OpenAI Chat website
// @match https://chatgpt.com/*
// @run-at document-end
// ==/UserScript==
(function() {
// Store a reference to the original JSON.stringify function
const originalStringify = JSON.stringify;
// Override JSON.stringify
JSON.stringify = function(data, ...args) {
if(isChatMessage(data)) {
data.model = 'gpt-4o';
}
// Call the original JSON.stringify function
return originalStringify.apply(JSON, [data, ...args]);
};
})();
function isChatMessage(data) {
return data.action === 'next' && data.messages && data.messages.length > 0 && data.model;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment