GitHub Copilot - Unhide MiniMax Models

Injects MiniMax M2.5 models into GitHub Copilot model picker

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

You will need to install an extension such as Tampermonkey to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         GitHub Copilot - Unhide MiniMax Models
// @namespace    creos
// @version      1.3
// @description  Injects MiniMax M2.5 models into GitHub Copilot model picker
// @match        https://github.com/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  const script = document.createElement('script');
  script.textContent = `
(function () {
  const MINIMAX_MODELS = [
    {
      "id": "minimax-m2p5-fw",
      "name": "MiniMax M2.5",
      "object": "model",
      "vendor": "Fireworks",
      "version": "minimax-m2p5-fw",
      "preview": false,
      "model_picker_enabled": true,
      "model_picker_category": "powerful",
      "is_chat_default": false,
      "is_chat_fallback": false,
      "policy": { "state": "enabled", "terms": "" },
      "supported_endpoints": ["/chat/completions"],
      "capabilities": {
        "family": "minimax-m2p5-fw",
        "object": "model_capabilities",
        "type": "chat",
        "tokenizer": "o200k_base",
        "limits": {
          "max_context_window_tokens": 196608,
          "max_output_tokens": 32000,
          "max_prompt_tokens": 164000
        },
        "supports": {
          "streaming": true,
          "tool_calls": true,
          "parallel_tool_calls": true,
          "structured_outputs": true,
          "reasoning_effort": ["low", "medium", "high"]
        }
      },
      "billing": { "is_premium": false, "multiplier": 1 }
    },
    {
      "id": "minimax-m2p5-cb",
      "name": "MiniMax M2.5 (Fast)",
      "object": "model",
      "vendor": "Cerebras",
      "version": "minimax-m2p5-cb",
      "preview": false,
      "model_picker_enabled": true,
      "model_picker_category": "powerful",
      "is_chat_default": false,
      "is_chat_fallback": false,
      "policy": { "state": "enabled", "terms": "" },
      "supported_endpoints": ["/chat/completions"],
      "capabilities": {
        "family": "minimax-m2p5-cb",
        "object": "model_capabilities",
        "type": "chat",
        "tokenizer": "o200k_base",
        "limits": {
          "max_context_window_tokens": 196608,
          "max_output_tokens": 32000,
          "max_prompt_tokens": 164000
        },
        "supports": {
          "streaming": true,
          "tool_calls": true,
          "parallel_tool_calls": true,
          "structured_outputs": true,
          "reasoning_effort": ["low", "medium", "high"]
        }
      },
      "billing": { "is_premium": false, "multiplier": 1 }
    }
  ];

  function injectOrPatch(json) {
    const list = json?.data ?? (Array.isArray(json) ? json : null);
    if (!list) return null;

    // Patch existing MiniMax entries, or inject if missing
    const existingIds = new Set(list.map(m => m.id));
    const patched = list.map(m =>
      m.id?.includes('minimax') || m.id?.includes('m2p5')
        ? { ...m, model_picker_enabled: true, preview: false }
        : m
    );

    MINIMAX_MODELS.forEach(m => {
      if (!existingIds.has(m.id)) {
        console.log('[MiniMax Unhide] Injecting:', m.name);
        patched.push(m);
      }
    });

    return Array.isArray(json) ? patched : { ...json, data: patched };
  }

  const MODELS_URL = 'api.individual.githubcopilot.com/models';

  const _fetch = window.fetch;
  window.fetch = async function (...args) {
    const url = (typeof args[0] === 'string' ? args[0] : args[0]?.url) ?? '';
    const res = await _fetch.apply(this, args);

    if (url.includes(MODELS_URL)) {
      console.log('[MiniMax Unhide] Intercepted models API');
      try {
        const json = await res.clone().json();
        const result = injectOrPatch(json);
        if (result) {
          console.log('[MiniMax Unhide] Injected MiniMax models successfully');
          return new Response(JSON.stringify(result), {
            status: res.status,
            statusText: res.statusText,
            headers: res.headers,
          });
        }
      } catch (e) {
        console.error('[MiniMax Unhide] Error:', e);
      }
    }
    return res;
  };

  console.log('[MiniMax Unhide] v1.3 ready — watching for models API call');
})();
  `;

  (document.head || document.documentElement).appendChild(script);
  script.remove();
})();