Repos and models on the same box — self-hosted AI for self-hosted Git
Plot twist: Gitea now hosts AI models alongside your repos. Self-hosted, OpenAI-compatible API, Ollama backend. If you've been wanting a GitHub Copilot equivalent that lives entirely on your own metal — behold.
The Setup
Gitea AI is a new opt-in module that bundles an Ollama runtime, a model registry, and an OpenAI-compatible inference endpoint into the existing Gitea container. Pull a model, point your IDE at the endpoint, profit.
# docker-compose.yml
services:
gitea:
image: gitea/gitea:1.24-ai
environment:
- GITEA__ai__ENABLED=true
- GITEA__ai__BACKEND=ollama
- GITEA__ai__DEFAULT_MODEL=qwen2.5-coder:7b
volumes:
- ./gitea:/data
- ./models:/var/lib/ollama
ports:
- "3000:3000"
- "11434:11434" # ollama
deploy:
resources:
reservations:
devices:
- capabilities: [gpu]The Money Pattern
Once it's up, the inference endpoint speaks the OpenAI dialect. Point Cursor, Continue, or any SDK at it:
curl http://gitea.local:3000/api/ai/v1/chat/completions \
-H "Authorization: Bearer $GITEA_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2.5-coder:7b",
"messages": [{"role":"user","content":"review this diff"}]
}'The Catch
It's separate from Forgejo. The Gitea/Forgejo fork is already a sore subject and this widens the gap — Forgejo isn't shipping the AI module and probably never will. If you care about the open-governance fork, you're stuck running a second service. Ecosystem fragmentation is real.
The Verdict
For a small team running everything on-prem — think a Rebuild Relief-style internal tooling setup — Gitea AI is a stupidly good zero-config win. One box, your repos and your code-completion model. If you're already on GitHub, ignore this. If you're already on Gitea, upgrade tonight.