Sign inSign up

wrongname/mautrix-chatgpt

By wrongname

•Updated 14 days ago

Matrix bridge for OpenAI ChatGPT. Chat with GPT-4o, GPT-4 Turbo, and more from any Matrix client.

Image
0

10K+

wrongname/mautrix-chatgpt repository overview

⁠mautrix-chatgpt

A Matrix⁠ bridge for OpenAI ChatGPT⁠ built on the mautrix bridgev2⁠ framework in Go.

Chat with ChatGPT models directly from any Matrix client, without leaving the messaging platform.

⁠Features

  • Multi-model support — GPT-4o, GPT-4 Turbo, GPT-3.5 Turbo, o1, o1-mini, and any new OpenAI models
  • Vision API — send images (JPEG, PNG, GIF, WebP) for analysis and description
  • Streaming responses — real-time message streaming with typing indicators
  • Per-room configuration — model, system prompt, and temperature configurable per conversation
  • Conversation context — automatic history management with token-aware compaction
  • E2E encryption — optional end-to-bridge encryption support
  • Rate limiting — per-user rate limiting to prevent API quota exhaustion
  • Metrics — per-model request tracking, token usage accounting, and error categorization

⁠Quick Start

⁠1. Generate config
docker run --rm -v ./data:/data wrongname/mautrix-chatgpt

Edit data/config.yaml — set homeserver.address, homeserver.domain, and bridge.permissions.

⁠2. Generate registration
docker run --rm -v ./data:/data wrongname/mautrix-chatgpt

Register the generated data/registration.yaml with your homeserver.

⁠3. Run
docker run -d --restart unless-stopped \
  -v ./data:/data \
  wrongname/mautrix-chatgpt

Or with docker compose:

services:
  mautrix-chatgpt:
    image: wrongname/mautrix-chatgpt:latest
    restart: unless-stopped
    volumes:
      - ./data:/data
    deploy:
      resources:
        limits:
          memory: 512M
        reservations:
          memory: 128M
⁠4. Log in
  1. Start a direct chat with the bridge bot (e.g. @chatgptbot:yourdomain.com)
  2. Send !chatgpt login
  3. Enter your OpenAI API key (from platform.openai.com/api-keys⁠)
⁠5. Start a conversation

Invite the bot to a room and send:

!chatgpt join

ChatGPT will now respond to messages in that room.

⁠Commands

All commands use the !chatgpt prefix (configurable).

CommandDescription
loginAuthenticate with your OpenAI API key
logoutClear stored credentials
join [model]Add ChatGPT to the current room
model [name]View or change the model for the current room
modelsList available OpenAI models
system [prompt]View or set the system prompt
temperature [0-2]Adjust response randomness
clearClear conversation history
statsShow conversation stats and token usage
helpShow all available commands

⁠Configuration

Key options in config.yaml under the network section:

OptionDefaultDescription
default_modelgpt-4oDefault OpenAI model
max_tokens4096Maximum tokens per response
temperature1.0Response randomness (0.0 - 2.0)
system_prompt(empty)Default system prompt for all conversations
conversation_max_age_hours24Hours before context expires (0 = unlimited)
rate_limit_per_minute60Maximum requests per user per minute

⁠Supported Databases

  • SQLite (default) — no additional setup needed
  • PostgreSQL — for larger deployments

⁠Architecture

Matrix Client → Homeserver → mautrix-chatgpt (Go) → OpenAI API

Each ChatGPT model appears as a separate ghost user in Matrix (e.g. @chatgpt_gpt_4o:yourdomain.com).

⁠Health Check

The bridge exposes a readiness endpoint at /_matrix/mau/ready on port 29350 (default).

⁠Runtime Details

  • Base image: Debian Bookworm (slim)
  • Runs as: unprivileged bridge user (UID 1337)
  • Default port: 29350

⁠Volume

PathDescription
/dataConfig, registration, and database files

⁠Source

https://dev.web.wr0ng.name/wrongname/mautrix-chatgpt⁠

Tag summary

Content type

Image

Digest

sha256:9830df60b…

Size

48.2 MB

Last updated

14 days ago

docker pull wrongname/mautrix-chatgpt