GitHub Copilot - Unhide MiniMax Models

Injects MiniMax M2.5 models into GitHub Copilot model picker

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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