IsraelGPT API Docs Get an API key

Discord Bot

A complete reference client for the public API, written in Python. Lives in the /discord-bot folder of the IsraelGPT repo - not a hosted service, source you run yourself.

Important: this doesn't run on Vercel

A Discord bot needs a persistent WebSocket connection to Discord's gateway. Vercel serverless functions are short-lived and stateless and cannot host that. The bot is a completely separate, always-on process — a small VPS, Railway, Fly.io, or your own machine. It talks to the public API exactly like any other client, over plain HTTPS.

What it does

  • Responds when @mentioned in a server channel, DM'd directly, or when someone replies to one of its own messages.
  • Reads the real last 10 messages in the channel — from any author, via Discord's own message history, not a bot-maintained log — so the model sees actual multi-user conversation context. Non-bot messages are tagged with the author's display name, since the API's messages array only knows role: "user"|"assistant", not arbitrary usernames.
  • Per-channel settings (model, persona, effort, uncensored mode, whether to post resolved media) configured with slash commands, held in memory only — no database, reset on restart.
  • Strips bracket tags with no effect through the API before posting, and posts any resolved images/audio as follow-up messages.
  • Handles 429 responses gracefully — tells the channel how long to wait instead of erroring.

Slash commands

CommandWhat it does
/modelSet which model (israelbot-1 / 1.5 / 2) this channel uses
/personaSet which of the 10 personas this channel uses
/effortSet sampling temperature (low/medium/high/xhigh) for this channel
/uncensoredToggle uncensored mode on/off for this channel
/imagesAllow or block posting resolved images/audio in this channel
/settingsShow this channel's current settings
/resetReset this channel's settings back to defaults

Settings apply per-channel (shared by everyone in that channel), not per-user. Slash commands sync globally by default, which can take up to ~1 hour to appear in Discord's UI after the bot starts — set DISCORD_DEV_GUILD_ID in .env to sync instantly to one test server instead.

Setup

  1. Create a Discord application + bot at the Discord Developer Portal. Under Bot, enable the Message Content privileged intent. Invite it to your server with Send Messages / Read Message History permissions.
  2. Get a free API key from the dashboard.
  3. Copy discord-bot/.env.example to .env and fill in DISCORD_BOT_TOKEN and ISRAELGPT_API_KEY.
  4. Install and run:
cd discord-bot
pip install -r requirements.txt
python bot.py

The core request pattern

This is the exact request-building code the bot uses (mirrored verbatim in Examples, so the two never drift apart):

async def call_israelgpt(messages: list[dict], settings: dict) -> dict:
    async with httpx.AsyncClient(timeout=60) as http:
        response = await http.post(
            f"{ISRAELGPT_API_BASE_URL}/chat",
            headers={"Authorization": f"Bearer {ISRAELGPT_API_KEY}"},
            json={
                "messages": messages,
                "personaId": settings["persona_id"],
                "selectedModel": settings["model"],
                "effort": settings["effort"],
                "uncensoredMode": settings["uncensored"],
            },
        )
    if response.status_code == 429:
        body = response.json()
        raise RateLimited(body["error"].get("retry_after_seconds", 30))
    response.raise_for_status()
    return response.json()

Forking it

The bot is meant as a real, complete starting point — not a toy. Fork discord-bot/, swap in whatever framework or language you prefer, and point it at the same API Reference. Nothing about the public API is bot-specific.