Tampermonkey userscript that replaces Pax Historia's default AI backend with multiple providers. Use your own API keys or local proxies (Ollama, LM Studio, Copilot API) for AI chats and actions.
| Provider | API Key | Description |
|---|---|---|
| Google AI Studio | Yes | Gemini (including Thinking models) |
| OpenRouter | Yes | Multiple models via openrouter.ai |
| OpenAI | Yes | Direct OpenAI API (GPT-4, etc.) |
| Groq | Yes | Fast inference, free tier available |
| Ollama | No | Local models at http://localhost:11434 |
| LM Studio | No | Local models at http://localhost:1234 |
| Together AI | Yes | Open and fine-tuned models |
| Fireworks AI | Yes | Fast inference API |
| Mistral AI | Yes | Mistral models |
| Anthropic (Claude) | Yes | Claude models |
| Copilot API | No | Local proxy via copilot-api |
| Generic | Optional | Any OpenAI-compatible API (custom Base URL) |
- 12 providers: Google, OpenRouter, OpenAI, Groq, Ollama, LM Studio, Together, Fireworks, Mistral, Anthropic, Copilot, Generic
- Connection test: Verifies Base URL for Copilot, LM Studio, Ollama, Generic before saving
- Model selector: Auto-loads models from local proxies (Copilot, LM Studio)
- Thinking Budget: Configurable for Gemini models
- Indicator badge: Shows current provider and model in the header (click to open settings)
- Privacy: Prompts go to your chosen provider, not the game's default backend
- Install Tampermonkey in your browser (Chrome, Firefox, Edge).
- Create a new script in Tampermonkey.
- Copy and paste the contents of
PaxHistoriaAIHook.user.js. - Save (Ctrl+S).
- Open Pax Historia.
- Click Tampermonkey icon and select "Open AI Settings", or click the indicator badge in the header.
- Choose provider and configure:
- API Key: aistudio.google.com/app/apikey
- Model: e.g.
gemini-3-flash-preview - Thinking Budget: 4096 (recommended)
- API Key: openrouter.ai/keys
- Model: e.g.
google/gemini-2.0-flash-thinking-exp:free
- API Key: From each provider's dashboard
- Model: Provider-specific model ID
- Base URL:
http://localhost:11434(Ollama) orhttp://localhost:1234(LM Studio) - Model: Name of loaded model. Use "Test" to list available models (LM Studio).
- Provider: Copilot API (local)
- Base URL:
http://localhost:4141(default). The [copilot-api](https://github.com/ caozhiyuan/copilot-api) proxy must be running. - Model: Use "Test connection" to load
models and select one (e.g.
gpt-4.1,claude-opus-4.6).
- Base URL: e.g.
https://api.openai.com/v1or Azure/custom endpoint - Model: Model ID
- API Key (optional): Leave empty for local or public endpoints
- Save and reload the page.
- "No events" error: The model did not return valid JSON. Try a more capable model or increase the thinking budget.
- Copilot API: Network error or no connection: Ensure the proxy is running (
npx copilot-api@latest start) and the Base URL is correct. - Script not working: Check that the script is enabled in Tampermonkey and that you have accepted the requested permissions (including
GM_xmlhttpRequestfor Copilot API). - API errors: Check the browser console (F12) for logs tagged with
[PAX AI].
This script is for educational and personal use only. Use at your own risk.