Installation and CS2 Setup
Installing pygsi
You’ll need Python 3.11 or newer. On PyPI the package is called pygsi-cs2, because the name pygsi was already taken, but you import it as pygsi:
pip install pygsi-cs2
# or
uv add pygsi-cs2
The Config File
CS2 looks for GSI config files in its cfg folder when it starts. Any file whose name starts with gamestate_integration_ and ends with .cfg counts. Create one called gamestate_integration_pygsi.cfg in the game/csgo/cfg/ folder of your CS2 install:
| OS | Folder |
|---|---|
| Windows | C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\game\csgo\cfg\ |
| macOS | ~/Library/Application Support/Steam/steamapps/common/Counter-Strike Global Offensive/game/csgo/cfg/ |
| Linux | ~/.steam/steam/steamapps/common/Counter-Strike Global Offensive/game/csgo/cfg/ |
Warning
CS:GO kept these files in
csgo/cfg/, and CS2 doesn’t read that folder anymore. If you installed CS2 in another Steam library folder, look under that folder’ssteamapps/common/instead.
Here’s what goes in the file:
"pygsi"
{
"uri" "http://127.0.0.1:4213"
"timeout" "5.0"
"buffer" "1.0"
"throttle" "1.0"
"heartbeat" "30.0"
"data"
{
"provider" "1"
"player_id" "1"
"player_state" "1"
"player_match_stats" "1"
"map" "1"
"map_round_wins" "1"
"round" "1"
}
}
The uri is where CS2 sends its payloads. Port 4213 is pygsi’s default, and 127.0.0.1 means the server runs on the same machine as the game. If it runs somewhere else, put that machine’s address here.
The four timing settings control how often CS2 sends updates, and they’re all in seconds:
| Setting | Meaning |
|---|---|
timeout | How long CS2 waits for the server to respond. |
buffer | How long CS2 collects changes before it sends them in one payload. |
throttle | The shortest time between two payloads. |
heartbeat | The longest time between two payloads, even when nothing changes. |
Lower buffer and throttle if events arrive too late for what you’re building.
The data block picks which parts of the game state CS2 sends:
| Component | What CS2 sends |
|---|---|
provider | The SteamID of the client that sent the payload |
player_id | The player’s name, SteamID, and team |
player_state | Health, armor, money, flashes, kills this round, and more |
player_match_stats | Kills, assists, deaths, MVPs, and score for the match |
map | The map’s name, mode, and phase, and each team’s score |
map_round_wins | How each round so far was won |
round | The round’s phase, the bomb’s status, and the winning team |
pygsi can’t work without provider, because that’s how it knows whose game a payload came from (see Multiple Players).
CS2 only reads these files when it starts, so restart it after you add or change one.
Your SteamID64
pygsi tracks players by their SteamID64, the 17-digit number that starts with 7656. To find yours, type status in the CS2 console, or look yourself up on steamid.io.