﻿FM LLM - talk to Football Manager 27 with a language model    version 0.30.17

1. What it is
Talk freely in the game with players, agents, the board, your staff and selling clubs. The answers come from the language
model you choose (a ChatGPT plan, or one of several APIs). Each person's mood, contract demands and relationship with you
are read live from the game.
  - Player pages get a "Private chat" button under "Actions". On a player page, F8 or the "AI Chat" button at the bottom
    right does the same: talk to that player.
  - When the game starts a conversation itself (a player comes to your office, an agent meeting), the chat picks it up;
    what you type is matched to the game's own options and picked for you.
    Don't want that: Preferences > "AI Plugin" tab > switch off "Join the chat when the game starts a talk" (it takes effect at once).
    Such talks then go on as in the game, and the chat appears only when you open it yourself ("Private chat" on a player page,
    F8, or "AI Chat" at the bottom right).
  - While the chat is open, the game's picture shrinks to about 76% to leave room for it, so the chat no longer covers the
    buttons on the right and at the bottom; closing the chat or dragging it into a floating window gives the full width
    back. If the text gets too small, switch off "Shrink the game to make room while the chat is open" in Preferences ->
    AI Plugin (the chat then covers the game again). On smaller screens the chat gets narrower; below about 1430 pixels
    the text would get too small, so the game isn't shrunk and the chat covers it as before (that tab says what yours gets).
  - Contract negotiations: terms agreed with the agent in the chat are filled into the negotiation table, and when you
    submit it the game accepts the contract you agreed. Terms the table doesn't have yet (yearly wage rise, goal bonuses,
    a Champions League bonus, a club extension option, ...) are added through "Add Bonus / Add Clause" as well.
  - Promises page (playing time, contract start date and other promises before the contract talks): talk it over with
    the agent in the chat. He holds on to what he asked for but can be talked round. Once he clearly accepts a version,
    the chat says it is registered: press "Suggest Promises" and the game's agent agrees to that version, then
    "Finalise Promises" to go on to the terms. Lower the table afterwards, or add a promise that wasn't talked about,
    and the game judges it by its own rules. (Tested in the Chinese game only so far.)
  - Staff profile pages (assistant, goalkeeping coach, scouts, physios, ...) get the same "Private chat" button, and F8
    works there too: the staff member talks from his own personality, attributes and job, and remembers earlier talks.
    After a talk with one of your own staff, what it did to your relationship is written back into the game. Other
    clubs' staff can be talked to as well, at a distance, and nothing about them changes.
  - Transfer offer form (player page > Actions > Make Offer): the "To" row gets a "Club" button and the selling club's
    representative haggles with you. He prices by value, contract and whether the player is a regular, and doesn't drop
    at the first push. Once you agree, the plugin fills the fee, add-ons and clauses into the form and registers the
    offer ("registered, the club will accept once you submit"). You submit it yourself, and the club accepts when the
    game next processes it (usually after you press Continue). Change the form after agreeing, leave terms on it that
    were never talked about, or have the player move elsewhere before the answer, and the game decides by its own
    rules. An offer with instalments (one plan, the up-front fee may be 0) is registered too, provided the club itself says the
    up-front fee, the 6- or 12-month interval, the number of payments and the instalment total in one sentence; if it only
    says "deal", or one figure does not match, the offer is filled in but not registered and the chat says what is missing.
    The registration lives only while the game is running: save, quit and reload before the answer and that
    offer is the game's to judge. Registration applies to permanent bids you make.
    Don't want the guaranteed acceptance? Switch off "Agreed transfer offers are accepted" on the "AI Plugin" tab: you
    still chat and the form is still filled, but the game decides. (Tested in the Chinese game only so far.)
  - Selling a player: open an incoming bid that awaits your response from Messages or Transfer Activity, then press
    F8 or open AI Chat. Once the buyer proposes terms, reply "accept this counteroffer". The plugin fills editable
    amounts and preserves existing instalments and other clauses. Check the form and submit the counteroffer in FM.
    Experimental "registered sale price" (off by default): add "sell_hook": true to "features" in the service's
    config.json and set SellHook under [Hooks] in BepInEx\config\fmllm.core.cfg (game folder) to true; it works only
    with both on. With it on, the buyer only agrees to what the game may accept: for small fees (under about £5,000)
    up to twice its bid, for normal fees (from about £5,000) about 20% above it.
    A counteroffer that changes only the fee is registered (not when the club's original bid already has add-ons or
    instalments of its own): the next day the club bids again at that price
    and you accept it; rules other than the price are still the game's. Off by default because the game's ~20% ceiling
    for normal fees has no in-game sample yet (only the "at most twice the bid" one was tested).
  - Loans in and out: open the loan offer form and talk to the other club. An agreed duration, playing and unused
    monthly fees, and the borrowing club's wage shares can be filled. Review and enter buyout or other additional terms
    in the game. You submit the offer and FM decides the club's response.
  - After a talk, the model judges what it did to morale and the relationship and writes that back into the game (capped
    each time, can be switched off). The profile page shows the new values after the next Continue.
  - It remembers earlier talks and promises, and checks promises when they fall due.
Every feature can be switched on or off in Preferences > "AI Plugin".
The plugin's own text and the replies follow the plugin language setting on that tab. By default it follows the game:
Chinese or Korean when the game is in that language; with the game in English or another language, Chinese or Korean
when Windows is, else English.

2. What you need
  1. The Steam version of Football Manager 27, with the game in English, Simplified Chinese or Korean (the plugin reads
     the game's screens, e.g. the negotiation table; in other languages several features don't work).
  2. Windows 10 / 11.
  3. Python 3.11 or newer. The setup checks for it and tells you how to install it if it is missing.
  4. A language model: a ChatGPT plan, or an API key (see section 4).

3. Install
  1. Quit the game.
  2. Unzip the whole package and double-click "Install.bat" in the unzipped folder (the .bat files need the
     "files" folder next to them; don't drag one out on its own). It will:
       - find the game folder (or ask you to paste its path);
       - install BepInEx 6 (an open-source mod loader) if the game doesn't have it yet;
       - put the plugin into  <game folder>\BepInEx\plugins\FmLlm\
       - put the chat service into  C:\Users\<your user name>\FM-LLM\service\
       - check for Python.
     If Windows asks whether to run it, choose "Run".
  3. The first start of the game takes 1-3 minutes longer than usual; don't close the game meanwhile: BepInEx builds
     its files once (the Unity base libraries it needs come with this package, nothing to download). After that it
     starts normally.
     Right after a game update the first start may show a Denuvo activation window; that has nothing to do with the
     plugin, just activate as asked.

4. Pick a language model (A, B or C; you can set up several)
  A. Your ChatGPT plan (Plus / Pro etc.; the best results, no API key needed)
     In the game: Preferences > "AI Plugin", and on the "ChatGPT plan" row press "Continue with ChatGPT".
     Your browser opens OpenAI's page: confirm there and keep the "use your ChatGPT plan" item ticked.
     This is OpenAI's official sign-in for local apps. Usage counts against your ChatGPT plan; see it at
     chatgpt.com/settings/usage, where you can also set a weekly limit for FM LLM.
  B. An OpenAI API key or an OpenRouter key (pay as you go)
     Get a key at https://platform.openai.com/api-keys or https://openrouter.ai/keys, double-click
     "Set API key.bat", choose 1 (OpenAI) or 2 (OpenRouter) and paste the key. Restart the game, then pick
     it as the "Main model" on the "AI Plugin" tab (only models with a key show up in the list).
  C. Other API keys (DeepSeek, Claude, Gemini, Kimi, ...)
     Double-click "Set API key.bat" and pick it from the menu: 3 is Google Gemini
     (https://aistudio.google.com/apikey), 4 is DeepSeek; the variable name is filled in for you. For anything else
     choose 5 and enter the variable name yourself: it is the "key_env" of that model in
     C:\Users\<your user name>\FM-LLM\service\config.json. Type only the number at the first step; the key is pasted at
     the next one. Restart the game and pick it as the "Main model" (for Gemini: "Google Gemini 3.8 Flash (pay as you
     go)"). Gemini needs a network that can reach Google (a system proxy or TUN mode if Google is blocked where you are).
     Note: most "Coding Plan / Token Plan" subscriptions (Zhipu, Kimi, MiniMax, ...) say in their terms that they may
     only be used in coding tools, not in other programs; using them risks a suspended plan or key. The settings page
     warns you when you pick one.
  D. Your own relay or any third-party API site (type it in the game: no config.json editing, no .bat)
     In the game: Preferences > "AI Plugin", the "Third-party site (your own API)" part under "Models":
       Interface: most relays are "OpenAI-compatible"; the official Claude API, or a site that only offers the Claude
                  format, is "Claude format"; a site whose docs say /responses is "OpenAI Responses".
       Site address: e.g. https://api.example.com/v1 (an OpenAI-compatible address usually ends in /v1, and a bare host
                  gets /v1 added; a Claude-format address has no /v1). No user name, password or ? parameters in it.
       Model name: copy it from the site's own list.
       Key: just paste it (Ctrl+V); the box shows dots only. Local servers such as LM Studio or Ollama need no key:
                  type any letters or digits (local, say).
     "Save and test" has the chat service make one real call to the site; only if it works is the "Main model" switched
     to it. If not, it is saved but nothing is switched, and you are told why (wrong key / wrong address / wrong model name /
     can't connect). "Remove this site" deletes the entry and the saved key.
     The key is kept only in the Windows user variable FMLLM_CUSTOM_KEY on this PC: never in config.json, never in the
     chat, the logs or feedback. There is one third-party slot; saving again overwrites it. Like the other keys, the
     uninstaller does not remove that variable: press "Remove this site" first if you want it gone.
     A site that isn't yours receives what you chat: read its terms first.
  The default order: your ChatGPT plan first; if you are not signed in, the next model in the list that has a key.

5. Play
  1. In the game: Preferences > "AI Plugin", and on the service row press "Start".
     A black window opens: that is the chat service. Keep it open while you play; closing it stops the service.
  2. Open a player's page and press "Private chat" under "Actions" (or F8), then type.
  3. To switch a feature off (for example writing morale back into the game), use its switch on the "AI Plugin" tab.
  Tip: save your career under a new name before you try it. The plugin changes values such as morale and relationships
  (capped each time, can be switched off).

6. Common questions
  - The chat says it can't reach the chat service: press "Start" on the "AI Plugin" tab. If the black window shows an
    error, follow it (e.g. Python missing, not signed in).
  - Python is installed but "Start" still can't find it: the plugin searches the registry and the usual folders itself.
    If it still fails, quit Steam completely (tray icon, right-click, Exit) and start the game again: the game inherits
    Steam's environment, and Python installed while Steam was running is only found after Steam restarts. Also check
    that it is 3.11 or newer.
  - No "AI Plugin" tab in Preferences: it sits at the far right of the tab row at the top of Preferences, next to
    "Quick" and "Detailed", not in the list on the left. Still not there? Run the diagnosis tool
    https://fm.juyiba.com/FM-LLM-diag.zip and send its result to the author.
  - The "AI Plugin" tab says some self-checks are off: after a game update the plugin could not find the game code it
    needs, so those features switch themselves off and never break the game. Wait for a plugin update.
  - Logs: <game folder>\BepInEx\LogOutput.log; chat logs in C:\Users\<your user name>\FM-LLM\service\logs\
  - Privacy: what you type is sent to the model provider you chose. The ChatGPT login is stored in
    C:\Users\<your user name>\.fm-llm\, only on your PC.
    The plugin talks to the download site fm.juyiba.com once when the game starts, to look for a new version (only the
    plugin version goes along). With "Check for new versions at start" off it still looks once while "Anonymous usage
    statistics" or "Update automatically" is on, only to tell you about an important one; with all three off it does
    not connect at start.
  - Anonymous usage statistics (the "Anonymous usage statistics" switch on the "AI Plugin" tab, formerly "Count online
    players"). While it is on, the plugin sends two things:
    1) every 5 minutes while the game runs, "this copy is running", to count how many people are online;
    2) from 0.29.4, once a day, anonymous counts, so the author can see which problems players actually run into and
       how often. Only counts and fixed choices:
       - errors: failed model calls by reason (wrong key, timeout, can't connect, server error, rate limit, no key set,
         content refused) and by preset (a model you named yourself is only "custom"); plugin errors; repairs of the
         message area; index rebuilds after a wrong person; which self-check items failed;
       - features: how many lines to whom (player, agent, both, staff, board, selling club, team talk); contract
         auto-fill worked or not; how often the contract, promise, transfer and transfer-interest hooks let a deal
         through; persuasion results; feedback sent;
       - experience: how long model replies and the wait after loading a save took (only bands such as "under 3 s",
         "3-6 s"); the screen-width band; whether the chat makes room; the game's and the plugin's language;
       - updates: from which version to which, whether it worked, and the kind of reason when it didn't.
       Never sent: what you type or read, player or club names, saves, keys or environment variable values, file paths,
       your Windows user name, the computer's name, accounts. Online heartbeat: the server keeps only a salted hash of the
       IP and the country code, never the IP. Daily summary: the server keeps no IP, hash or country for it, only the
       counts added up per date and version (single summaries are not kept); against flooding it counts the summaries
       from one network that day in memory, under a hash whose salt changes daily, never written to disk.
       Counts not sent yet are in C:\Users\<your user name>\FM-LLM\metrics.json; you can open it.
    To switch it off: Preferences > "AI Plugin" > "Anonymous usage statistics". It applies at once: nothing more is
    sent, and counts not sent yet are deleted.
    The first time you open the chat after installing 0.29.4 (or later), a strip at its top explains this, with "Turn
    off" and "Got it". It shows once per computer, and not at all if the switch is already off. No daily summary is
    sent before the strip has been shown (the online heartbeat goes on as before); the days before it are never sent,
    and the day it appears goes out on the next day at the earliest.

7. Updating
  From 0.29.4 on, one click, without quitting the game or closing the chat service's window:
  - When a new version is out, a notice pops up above the "AI Chat" button at the bottom right: press "Update now".
    Or open the chat and press "Update now" next to "Version x is out" under the title, or Preferences > "AI Plugin" >
    "Update" on the plugin version row.
  - It runs in the background, with no window: it downloads the update, checks its signature and files, and replaces
    the plugin and the chat service; settings and chat memory are kept. Progress shows under the chat title and the
    chat says how it went; if it failed it says why (the full log: C:\Users\<your user name>\FM-LLM\update-last.log).
  - A running chat service restarts itself as the new version in its own window, so its fixes work at once. The
    plugin itself (the part inside the game) becomes the new version the next time you start the game.
  - A version marked "important" (red) fixes something serious: update soon. It is shown even with "Check for new
    versions at start" switched off (unless "Anonymous usage statistics" and "Update automatically" are off too).
  - "Update automatically" on the "AI Plugin" tab (on by default since 0.29.5; switch it off there if you don't want it) downloads new
    versions in the background, installs them once no talk is going on, and tells you in the chat.
    When upgrading from 0.29.4, a previously disabled automatic update setting is turned on once; switching it off
    yourself afterwards is respected.
  - If the updater stops with "certificate verify failed": check the date and time of the PC and switch off the antivirus
    HTTPS scanning; the updater itself retries with its own root certificates first. If certificate verification still
    fails, it downloads without verifying the certificate, but the release signature and package SHA-256 must pass
    before installation. Or download the full package from
    https://fm.juyiba.com/ and run "Install.bat" again.
  Coming from 0.29.3 or older, the first update works the old way: close the chat service's black window, press
  "Update" on the "AI Plugin" tab, wait for the window to say the update is done, then restart the game.
  The updater only installs versions signed by the author and refuses anything changed by someone else.
  Download page: https://fm.juyiba.com/ (you can also download the new package and run "Install.bat" again).

8. Uninstall
  Quit the game and double-click "Uninstall.bat". It removes the plugin, then asks you separately:
    - whether to remove BepInEx too (only asked if this setup installed it and no other plugin uses it; afterwards the
      game folder is exactly as it was; the game's own files are never changed);
    - whether to sign out of ChatGPT;
    - whether to delete the chat service and its long-term memory (C:\Users\<your user name>\FM-LLM).

BepInEx is an open-source project (LGPL-2.1), source at https://github.com/BepInEx/BepInEx ; this package contains
its original 6.0.0-be.793.

Author: Dale Dai (a1014689894@gmail.com · QQ 1014689894 · WeChat 1014689894, same number). Want to talk with the author? Feel free to add either one.

English package tools: after starting the service, Set API key.bat and Uninstall.bat are also in
C:\Users\<your user name>\FM-LLM\. The game settings page also offers Open folder once these tools exist.
