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.
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.
messages array only knows role: "user"|"assistant", not arbitrary usernames.429 responses gracefully — tells the channel how long to wait instead of erroring.| Command | What it does |
|---|---|
| /model | Set which model (israelbot-1 / 1.5 / 2) this channel uses |
| /persona | Set which of the 10 personas this channel uses |
| /effort | Set sampling temperature (low/medium/high/xhigh) for this channel |
| /uncensored | Toggle uncensored mode on/off for this channel |
| /images | Allow or block posting resolved images/audio in this channel |
| /settings | Show this channel's current settings |
| /reset | Reset 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.
Send Messages / Read Message History permissions.discord-bot/.env.example to .env and fill in DISCORD_BOT_TOKEN and ISRAELGPT_API_KEY.cd discord-bot
pip install -r requirements.txt
python bot.pyThis 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()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.