Matrix bridge for Perplexity AI. Chat with Sonar models and web search from any Matrix client.
2.2K
A Matrix bridge for Perplexity AI built on the mautrix bridgev2 framework.
Chat with Perplexity AI models directly from any Matrix client, with built-in web search, conversation history, and multi-user support.
The container runs two processes:
| Component | Language | Role |
|---|---|---|
| Bridge (port 29321) | Go | Matrix appservice, command handling, ghost management |
| Sidecar (port 8090) | Python | Perplexity SDK wrapper, session management, metrics |
The Python sidecar is required because the official Perplexity SDK is Python-only. Both processes start automatically via the container entrypoint.
Matrix Client → Homeserver → Go Bridge (port 29321) → Python Sidecar (port 8090) → Perplexity API
Each Perplexity model appears as a separate ghost user in Matrix (e.g. @perplexity_sonar:yourdomain.com).
docker run --rm -v ./data:/data wrongname/mautrix-perplexity
Edit data/config.yaml — set homeserver.address, homeserver.domain, and bridge.permissions.
docker run --rm -v ./data:/data wrongname/mautrix-perplexity
Register the generated data/registration.yaml with your homeserver:
app_service_config_files in homeserver.yamlapp_service_api.config_files in dendrite.yamldocker run -d --restart unless-stopped \
-v ./data:/data \
wrongname/mautrix-perplexity
Or with Docker Compose:
services:
mautrix-perplexity:
image: wrongname/mautrix-perplexity:latest
restart: unless-stopped
volumes:
- ./data:/data
deploy:
resources:
limits:
memory: 1G
reservations:
memory: 256M
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:29321/_matrix/mau/ready"]
interval: 30s
timeout: 10s
retries: 3
@perplexitybot:yourdomain.com)!perplexity loginInvite the bot to a room and send:
!perplexity join
Perplexity AI will now respond to messages in that room.
All commands use the !perplexity prefix (configurable).
| Command | Description |
|---|---|
login | Authenticate with your Perplexity API key |
logout | Clear stored credentials |
join [model] | Add Perplexity AI to the current room |
model [name] | View or change the model for the current room |
models | List available Perplexity models |
system [prompt] | View or set the system prompt |
temperature [0-2] | Adjust response randomness |
conversation [on|off] | Toggle multi-turn conversation mode |
mention [on|off] | Respond only when @mentioned |
web [option] [value] | Configure web search settings |
clear | Clear conversation history |
stats | Show token usage and conversation statistics |
help | Show all available commands |
!perplexity web domains docs.python.org,stackoverflow.com
!perplexity web recency week
!perplexity web after 01/01/2025
!perplexity web before 06/01/2025
!perplexity web mode academic
!perplexity web location Berlin,Berlin,Germany
!perplexity web images on
!perplexity web context high
Key options in config.yaml under the network section:
| Option | Default | Description |
|---|---|---|
default_model | sonar | Default Perplexity model |
max_tokens | 4096 | Maximum tokens per response |
temperature | 1.0 | Response randomness (0.0 - 2.0) |
system_prompt | You are a helpful AI assistant. | Default system prompt |
conversation_max_age_hours | 24 | Hours before conversation context expires |
rate_limit_per_minute | 60 | Maximum requests per user per minute |
Bridge permissions:
bridge:
permissions:
"*": relay
"example.com": user
"@admin:example.com": admin
appservice.database to a postgres:// URI| Variable | Default | Description |
|---|---|---|
PERPLEXITY_SIDECAR_PORT | 8090 | Sidecar listen port |
PERPLEXITY_SIDECAR_QUERY_TIMEOUT | 300 | Query timeout in seconds |
PERPLEXITY_SIDECAR_MODEL | sonar | Default model override |
PERPLEXITY_SIDECAR_SESSION_TIMEOUT | 3600 | Session timeout in seconds |
| Endpoint | Port | Purpose |
|---|---|---|
/_matrix/mau/ready | 29321 | Bridge readiness |
/health | 8090 | Sidecar readiness (internal) |
| Path | Description |
|---|---|
/data | Config, registration, database, and log files |
| Port | Description |
|---|---|
| 29321 | Matrix appservice (must be reachable by your homeserver) |
| 8090 | Python sidecar (internal only, not exposed by default) |
bridge user (UID 1337)Content type
Image
Digest
sha256:3f912b1a1…
Size
79.8 MB
Last updated
14 days ago
docker pull wrongname/mautrix-perplexity