Modern Textual chat client for OpenRouter with sessions, MCP search, and model selection
Project description
tx-ai
Modern terminal chat UI built with Textual, uv, OpenRouter, and the OpenAI Python client.
Requirements
- Python 3.11+
- OpenRouter API key via
OPENROUTER_API_KEY, saved local config, or the startup prompt
Install
From this checkout:
python -m pip install .
Or with uv:
uv sync
Run With An Env Key
uv run --env-file .env tx-ai
If installed with pip:
OPENROUTER_API_KEY=your_key_here tx-ai
Run Without An Env Key
tx-ai
If OPENROUTER_API_KEY is not set, the app asks for your OpenRouter API key in the input box. The key is saved to your local user config at ~/.config/tx-ai/config.json with file mode 0600, so tx-ai will not ask again after reopening. If OpenRouter rejects the key as expired or invalid, tx-ai clears the saved key and asks for a new one.
UI Features
- Chat interface with Markdown rendering.
- Loading spinner while OpenRouter is generating.
- Model selector in the terminal UI.
- Slash commands for common chat actions.
- English replies by default unless you explicitly ask for another language.
- Parallel Search MCP-backed web search.
- Cleaner internal structure split across config, commands, OpenRouter API, and UI modules.
Slash Commands
/helpshows available commands./newstarts a fresh in-memory conversation./sessionsshows saved sessions so you can select one and continue it./mcpsshows configured MCP servers, connection status, and exposed tools./modelslists preset models./model <model>switches model by exact name or unique substring./search <query>searches the web with Parallel Search MCP and adds results to chat context./copyor/copy lastcopies the last assistant reply./copy allcopies the full current session transcript./copy usercopies your last message./clearclears the visible chat log./exitquits the app.
Keyboard shortcuts:
Ctrl+Ycopies the last assistant reply.Ctrl+Lclears the visible chat log.Ctrl+Qquits the app.
Web Search
tx-ai includes /search, backed by the Parallel Search MCP endpoint documented at https://docs.parallel.ai/integrations/mcp/search-mcp.
Normal messages that ask to search the web, use the internet/MCP, or answer current/latest/today/live questions automatically run Parallel Search MCP before the model replies. If the model first replies that it does not know, cannot browse, or lacks current information, tx-ai automatically runs a fallback Parallel Search MCP lookup and regenerates the answer.
/search latest OpenRouter model updates
The project also includes opencode.json so OpenCode can use the same MCP server by default:
{
"mcp": {
"parallel-search": {
"type": "remote",
"url": "https://search.parallel.ai/mcp",
"enabled": true
}
}
}
Use /mcps inside tx-ai to verify which MCP servers are configured and connected.
Sessions
tx-ai saves conversations locally under ~/.config/tx-ai/sessions/. Session titles are created from the first user message.
Use this command in the app:
/sessions
Select a saved session from the list to reopen it. The chat history and model are restored so you can continue the conversation.
Model Selection
Use the model selector in the top bar, or run:
/model deepseek
To set a custom default model before launch:
OPENROUTER_MODEL=anthropic/claude-3.5-sonnet tx-ai
Build A Wheel
uv build
python -m pip install dist/tx_ai-0.1.0-py3-none-any.whl
Publish
uv build
uv publish --token YOUR_PYPI_TOKEN
Notes
- Default model is
deepseek/deepseek-v4-flashunlessOPENROUTER_MODELis set. - Replies default to English through a system instruction.
- Conversations are saved locally and can be reopened with
/sessions. - If no API key is set or saved, the app prompts for one at startup.
- Assistant replies and model thinking are rendered as Markdown.
- Runtime logs are written to
logs/tx-ai.log.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tx_ai-0.1.1.tar.gz.
File metadata
- Download URL: tx_ai-0.1.1.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
97c9f8b849904d56e5413ac32000c34a7336484f6cd7b3657284b82b4a676993
|
|
| MD5 |
294d4f4a6e7cb24ad9a25f416e9da302
|
|
| BLAKE2b-256 |
072b4913e7bbd0045bc67ac3b0dba9ed49cd8707989ef7781e9106448662a398
|
File details
Details for the file tx_ai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tx_ai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f691f1da13a809325997041d4b0f0008ea27194df23cf814f253201d14b2457
|
|
| MD5 |
97a03e699542ee7f53cbc63e099ade59
|
|
| BLAKE2b-256 |
497115cdf828241812c267deccf8abfcc61e0f51856634f153d6d9ab957db097
|