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 για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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();
})();