A FastAPI wrapper that turns Go Text Protocol engines into REST APIs.
Project description
fastgtp
Fast-track your Go engine to the web! fastgtp wraps any Go Text Protocol (GTP) engine in a blazing-fast FastAPI service so you can ship HTTP-ready endpoints without taming stdin/stdout pipes by hand.
Why fastgtp?
- ⚫ Built for Go AI – GTP is the language of top-tier Go engines, but it speaks only through stdio.
fastgtp translates it into REST so your engine can join modern platforms, dashboards, and MLOps stacks. - 🌐 HTTP-first – Turn
genmove,play,printsgf, and custom commands into HTTPS endpoints in minutes.
No more glue scripts or brittle shell wrappers. - 🚀 Developer-friendly – Powered by FastAPI, Pydantic models, and async I/O, it scales from hackathon prototypes to production bots.
Quick Start
from fastgtp import create_app, GTPTransportManager, SubprocessGTPTransport
transport = SubprocessGTPTransport("katago gtp -config /path/to/fastgtp.cfg -model /path/to/network.bin.gz")
manager = GTPTransportManager(transport)
app = create_app(manager)
# run with: uvicorn fastgtp.server.main:app --reload
Once the app is running:
curl -X POST http://localhost:8000/open_session
# => {"session_id": "..."}
curl http://localhost:8000/<session_id>/name
# => {"name": "KataGo"}
## Run with Docker Compose
Launch the full stack (fastgtp + KataGo) with one command:
```bash
docker compose up --build
By default the service listens on localhost:8000 and persists KataGo networks/logs in managed volumes.
Need to tweak ports or engine arguments? Drop overrides in .env:
FASTGTP_PORT=9000
FASTGTP_ENGINE="katago gtp -config /opt/katago/configs/fastgtp.cfg -model /opt/katago/networks/kata1-b28c512nbt-s11233360640-d5406293331.bin.gz"
The compose file ships with a KataGo command for convenience, but you can point FASTGTP_ENGINE to any GTP-compatible binary—Leela Zero, ELF, your homebrew bot, you name it.
Mount custom configs or networks via docker-compose.yml:
volumes:
- ./my-fastgtp.cfg:/opt/katago/configs/fastgtp.cfg:ro
- ./my-network.bin.gz:/opt/katago/networks/my-network.bin.gz:ro
Then rerun docker compose up and you’re ready to curl.
Still Cooking – Contributions Welcome!
fastgtp is under active development. Have ideas, issues, or wishlists?
Open an issue and let’s build the ultimate GTP gateway together.
If this project sparks joy, drop us a ⭐️. It helps more Go developers discover fastgtp!
LICENSE
This project is licensed under the PolyForm Noncommercial License 1.0.0.
You may use it freely for personal or noncommercial purposes.
Commercial use is prohibited.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastgtp-0.0.1.tar.gz.
File metadata
- Download URL: fastgtp-0.0.1.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.12 Linux/5.15.0-144-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d641ec7903f46709dbaf50e265bfff6797d6d7c4cffa34aef86468603df1c5f
|
|
| MD5 |
164c0b72e1bcf09415e92fffc601d8fd
|
|
| BLAKE2b-256 |
bd7815e408058834f102246d9f99e50bfb0887223575b668682dd210d941b956
|
File details
Details for the file fastgtp-0.0.1-py3-none-any.whl.
File metadata
- Download URL: fastgtp-0.0.1-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.10.12 Linux/5.15.0-144-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ad4d0fde425cf15130eb770a10452fb92356c40a9da9e848a487cf985cbb1d0
|
|
| MD5 |
d353a1bbcac3d7b5430d71b23e9dc951
|
|
| BLAKE2b-256 |
ef8909451a5fc2ae18391aa0327b7b300a3d83fefeec31d85813fdd4b2044f80
|