Chabeau - Terminal Chat Interface

Chabeau is a full-screen terminal chat interface that connects to various AI APIs for real-time conversations. Chabeau brings the convenience of modern chat UIs to the terminal with a focus on speed, ergonomics, and sensible defaults. It is not a coding agent, but preliminary support for the Model Context Protocol is in development. This makes it possible to connect Chabeau with various local and remote services as well.

Table of Contents
- Features
- Getting Started
- Working with Providers and Models
- Configuration
- MCP Servers
- Character Cards
- Personas
- Presets
- Appearance and Rendering
- Keyboard and Workflow Tips
- Architecture Overview
- Development
- License
Features
See it in action
- Message retry
- Presets
- Themes
- User message editing
- Assistant response editing
- Character cards
- In-place refinement
- Syntax highlighting
- Code block selection
- Complex tables
Full feature list
- Full-screen terminal UI with real-time streaming responses
- Markdown rendering in the chat area (headings, lists, quotes, tables, callouts, horizontal rules, superscript/subscript, inline/fenced code) with clickable OSC 8 hyperlinks
- Modal pickers and inspectors temporarily suspend hyperlink rendering to keep the screen clean
- Built-in support for many common providers (OpenAI, OpenRouter, Poe, Anthropic, Venice AI, Groq, Mistral, Cerebras)
- Support for quick custom configuration of new OpenAI-compatible providers
- Interactive dialogs for selecting models and providers
- Character card support (v2 format) with in-app picker and defaults per provider/model
- Persona system for defining reusable user identities with variable substitution support
- Reusable preset instructions with picker and CLI toggles for quick context switching
- Extensible theming system that degrades gracefully to terminals with limited color support
- Secure API key storage in system keyring with config-based provider management
- Multi-line input (IME-friendly) with compose mode that can expand to half the terminal for longer responses
- Message retry and message editing
- On-demand refinements of the last assistant response with
/refine <prompt> - Slash command registry with inline help for faster command discovery
- Conversation logging with pause/resume; quick
/dumpof contents to a file - Syntax highlighting for fenced code blocks (Python, Bash, JavaScript, and more)
- Inline block selection (Ctrl+B) to copy or save fenced code blocks
- User message selection (Ctrl+P) to revisit and copy prior prompts
- Assistant message editing (Ctrl+X) to revise or truncate assistant responses without resending, with compose-mode shortcuts available while refining replies
- Prettified API error output with Markdown summaries for easier troubleshooting
For features under consideration, see WISHLIST.md.
Getting Started
Install
Configure Providers
Launch
Inside the TUI, use /provider and /model to switch, and /help to see a full breakdown of commands and keyboard shortcuts.
Working with Providers and Models
Discover available options:
Manage providers from the CLI:
Most users only need provider add; it can either attach a token to a
built-in provider or create a custom provider and prompt for a token.
Use chabeau provider token ... commands later when rotating or removing
credentials.
Environment variables are used only if no providers are configured, or when you pass --env.
# Optional
Quick, Single-Turn Chats
For quick, one-off questions without launching the full TUI, use the say command:
This command sends a single-turn message to the configured model, streams the response directly to your terminal, and exits. It respects your markdown settings, emits OSC8 hyperlinks when your terminal supports them, and uses a monochrome theme for clean, readable output.
MCP is disabled in chabeau say mode.
When you omit the prompt argument, chabeau say will read from piped or redirected stdin (trimming trailing whitespace) before showing the usage message, so cat prompt.txt | chabeau say works as expected.
When stdout is redirected to a file or piped into another program, Chabeau automatically falls back to a plain-text streaming mode. This mode skips OSC8 hyperlinks and cursor control so captured output stays free of escape codes.
If you have multiple providers configured but no default set, Chabeau will prompt you to specify a provider with the -p flag. The -p and other global flags can be placed before or after the prompt.
Environment variable values can make their way into shell histories or other places they shouldn't, so using the keyring is generally advisable.
Configuration
Chabeau stores its configuration in config.toml.
- Linux:
~/.config/chabeau/config.toml - macOS:
~/Library/Application Support/org.permacommons.chabeau/config.toml
Generally, you can rely on the UI: when you use interactive commands like /model, /provider, /theme, or /character, press Alt+Enter (or Ctrl+J) to persist the selection.
chabeau set / chabeau unset
chabeau set handles scalar values and selection defaults — anything that's a single value or a provider/model mapping. Run chabeau set with no arguments to print the current configuration and see which values are explicitly set versus inherited defaults.
Every set key has a matching unset to clear the value:
Editing config.toml by hand
The following structured definitions need to be edited in config.toml
directly:
- Custom themes — multi-field color/style definitions under
[[custom_themes]] - Personas — id, display name, and bio under
[[personas]] - Presets — id, pre, and post instructions under
[[presets]]
You can also edit the following in config.toml, but you don't strictly need to:
- Custom providers — can be configured via
chabeau providersubcommands - MCP servers — can be configured via
chabeau mcpsubcommands
Copy examples/config.toml.sample to your config directory for a starting point.
Both the CLI and TUI run mutations through the same configuration orchestrator. Chabeau caches the parsed file based on its last-modified timestamp, skipping redundant reloads when nothing has changed, and persists updates atomically so a failed write never clobbers your existing config.toml.
MCP Servers
Chabeau lets you connect MCP servers (HTTP or stdio) and use their tools/resources from the TUI.
- Manage servers from the CLI:
chabeau mcp list,chabeau mcp add,chabeau mcp add -a,chabeau mcp edit <server-id>, andchabeau mcp remove <server-id>. chabeau mcp addruns in basic mode and prompts only for required settings; use-a/--advancedto configure optional fields during add.- HTTP servers can use bearer tokens with
chabeau mcp token list [server-id],chabeau mcp token add <server-id>, andchabeau mcp token remove <server-id>. chabeau mcp addprobes OAuth discovery for HTTP/HTTPS servers and starts browser auth when available. You can also runchabeau mcp oauth list [server-id],chabeau mcp oauth add <server-id>, andchabeau mcp oauth remove <server-id>directly. Usechabeau mcp oauth add <server-id> -ato provide an OAuth client id manually.- Stdio servers run a local command with optional
argsandenv. - In the TUI,
/mcplists servers and/mcp <server-id>shows server info. Toggle with/mcp <server-id> on|off(orchabeau set mcp <server-id> on|off). To also clear session runtime MCP state, use/mcp <server-id> forgetinstead. - If a tool requires approval, Chabeau prompts you; use
/yolo <server-id> on|off(orchabeau set mcp <server-id> yolo on|off) for per-server auto-approve. --disable-mcpturns MCP off for a session.--debug-mcpwrites verbose MCP logs tomcp.log.
Character Cards
Chabeau supports character cards in the v2 format, letting you chat with AI personas that define tone, background, and greeting. Cards can be JSON or PNG files (with embedded metadata).
Import and Manage Cards
Cards are stored in the Chabeau configuration directory. Use chabeau -c to print the directory name and any cards Chabeau discovers.
Use Characters in Chat
In the TUI, /character opens the character picker (↑↓ to navigate, Ctrl+O to inspect full definitions, Enter to select, Alt+Enter to set as default). You can also run /character <name> for quick switches.
Defaults and Directories
Set defaults for provider/model combinations via Alt+Enter (or Ctrl+J) in the picker, or on the CLI:
To use a separate cards directory, set the CHABEAU_CARDS_DIR environment variable before launching Chabeau.
Example cards live in examples/hypatia.json and examples/darwin.json.
Troubleshooting
- "Character not found": ensure the card is in
~/.config/chabeau/cards/(or its equivalent on macOS or Windows) or provide the full path. - "Invalid card format": verify the JSON structure matches the v2 spec with required fields (name, description, personality, scenario, first_mes, mes_example).
- "PNG missing metadata": PNG files must contain a
charatEXt chunk with base64-encoded JSON. - Cards not appearing in picker: check file permissions and ensure files have
.jsonor.pngextensions.
Format Reference
Character cards follow the v2 specification.
Personas
Personas allow you to define different user identities for conversations, each with their own name and optional biographical context. Unlike character cards (which define AI personas), personas define who you are in the conversation.
Configure Personas
Add personas to your config.toml:
[[]]
= "developer"
= "Alex"
= "You are talking to Alex, a senior software developer with expertise in Rust and distributed systems."
[[]]
= "student"
= "Sam"
= "Sam is a computer science student learning about AI and machine learning."
[[]]
= "casual"
= "Jordan"
# bio is optional - persona will just change the display name
Assign defaults per provider/model from the CLI or in config.toml:
[]
= "developer"
Use Personas in Chat
In the TUI, /persona opens the persona picker (↑↓ to navigate, Ctrl+O to read the persona text, Enter to select, Alt+Enter to set as default). You can also run /persona <id> for quick switches, or select "[Turn off persona]" to return to anonymous mode.
When a persona is active:
- Your messages are labeled with the persona's name instead of "You"
- The persona's bio (if provided) is prepended to the system prompt
Variable Substitutions
Both personas and character cards support {{user}} and {{char}} variable substitutions:
{{user}}is replaced with the active persona's display name (or "Anon" if no persona is active){{char}}is replaced with the character's name (or "Assistant" if no character is active)
Persona vs Character Integration
Personas and character cards work together seamlessly:
- Character cards define the AI's personality, background, and behavior
- Personas define your identity and context in the conversation
- Both support
{{user}}and{{char}}variable substitutions - The persona's bio is added to the system prompt before the character's instructions
Presets
Presets let you inject reusable system instructions into the first and last system messages that Chabeau sends to the model. They are ideal for lightweight tone or formatting tweaks that you want to toggle quickly.
Chabeau ships with three built-in presets (short, roleplay, and casual) so you can experiment without editing your config. Set builtin_presets = false in config.toml to hide them from /preset, /preset <id>, and the --preset flag. If you define a preset with the same ID, your version overrides the built-in automatically.
Configure Presets
Add presets to your config.toml:
[[]]
= "focus"
= """
You are collaborating with {{user}}. Keep responses focused and direct.
"""
= """
Before finishing, list any follow-up actions.
"""
[[]]
= "roleplay"
= """
- Engage in roleplay with the user.
- Two paragraphs per turn max.
- Don't be shy to perform actions. Format these in italics, like this: *{{char}} frowns at {{user}}.*
- Be creative! Feel free to take the roleplay into new directions.
"""
pretext is wrapped in blank lines and prepended to the very first system message.posttext is wrapped in blank lines and appended to the final system message. If no system message exists at either position, Chabeau creates one automatically.- Presets support the same
{{user}}and{{char}}substitutions as personas and character cards.
Assign defaults per provider/model from the CLI or in config.toml:
[]
= "focus"
Use Presets in Chat
Launch with an ID like --preset focus, or pick interactively with /preset. Use Ctrl+O in the picker to review the preset instructions. The picker includes a "Turn off preset" option to clear the active preset.
The status bar shows the current preset when one is active so you can confirm the context you're using at a glance.
Appearance and Rendering
Themes
Chabeau ships with built-in themes and supports custom ones. Use /theme in the TUI to preview and Alt+Enter (or Ctrl+J) to persist the choice. On the CLI, run:
When no explicit theme is set, Chabeau tries to infer a sensible default from your OS preference (e.g., macOS, Windows, GNOME). If no hint is available, it defaults to the dark theme.
Custom themes belong in config.toml under [[custom_themes]]. See src/builtins/themes.toml for color references and examples/config.toml.sample for structure.
Themes can also set a cursor_color to change the terminal cursor via OSC 12 when the theme is applied.
Input uses a steady bar cursor inside the chat box so the insertion point stays easy to see while typing.
App messages—Chabeau’s own informational banners, warnings, and errors—use dedicated theme knobs so they’re easy to distinguish from assistant replies. Customize them with the app_info_*, app_warning_*, and app_error_* keys in your theme to control the prefix text, prefix styling, and message styling independently.
Markdown and Syntax Highlighting
Toggle these features at runtime:
/markdown on|off|toggle/syntax on|off|toggle
Chabeau persists these preferences to the config file automatically. Syntax colors adapt to the active theme and use the theme’s code block background for consistent contrast.
When markdown is enabled, image ALT text is rendered as an OSC hyperlink pointing to the underlying image URL so you can open assets directly from the transcript.
Color Support
Chabeau detects terminal color depth and adapts themes accordingly:
- Truecolor: if
COLORTERMcontainstruecoloror24bit, Chabeau uses 24-bit RGB. - 256 colors: if
TERMcontains256color, RGB colors are quantized to the xterm-256 palette. - ANSI 16: otherwise, colors map to the nearest 16 ANSI colors.
Force a mode when needed with CHABEAU_COLOR=truecolor|256|16.
Keyboard and Workflow Tips
Interface Controls
See the built-in help for a full list of keyboard controls. A few highlights:
- Alt+Enter (or Ctrl+J) to start a new line; Enter sends. Arrow keys always act on the focused area.
- Compose mode (F4) flips the newline/send defaults; focus behavior stays the same.
- Home/End and Ctrl+A/Ctrl+E jump to the start or end of the visible line in the focused pane, even when text is soft-wrapped.
- PgUp/PgDn scroll the focused area — the transcript or the multi-line input — by a page at a time.
- Ctrl+N repeats your most recent
/refineprompt on the latest assistant reply. - Tab switches focus between the transcript and input unless the current input starts with
/. When it does, Tab autocompletes slash commands. The active region shows a›; the inactive one shows a·. - Ctrl+O opens the inspect view for picker items—providers include their ID, base URL, and auth mode; themes show their ID and every color override; character cards expand to the full v2 definition.
- Ctrl+D on an empty input prints the transcript and exits; Ctrl+C exits immediately.
Mousewheel
Chabeau avoids capturing the mouse so selection operations (copy/paste) work as expected. Some terminals treat mousewheel events as cursor key input, so scrolling moves the conversation. Others reveal terminal history; in that case, use the cursor keys or PgUp/PgDn instead.
External Editor
Set the EDITOR environment variable to compose longer responses in your favorite editor:
# or vim, code, etc.
# VS Code with wait
Once set, press Ctrl+T in the TUI to launch the external editor.
Architecture Overview
See ARCHITECTURE.md for a high-level walkthrough aligned with the current repository state.
Chabeau uses a modular design with focused components:
main.rs– Entry pointapi/– API data structures and model-related helpersmod.rs– API data structuresmodels.rs– Model fetching and sorting functionality
auth/– Authentication and provider managementmod.rs– Authentication manager implementationui.rs– Interactive prompts and input helpers for auth flows
builtins/– Build-time assets embedded into the binaryhelp.md– In-app keyboard shortcut and command referencemodels.toml– Supported provider definitionspresets.toml– Built-in system instruction presetsthemes.toml– Built-in UI themes
character/– Character card support (v2 format)cache.rs– In-memory caching with invalidationcard.rs– Character card data structures and v2 spec parsingimport.rs– Import command and validation logicloader.rs– Card file loading (JSON and PNG with metadata extraction)mod.rs– Module exports and public APIpng_text.rs– PNG tEXt chunk reader/writerservice.rs– Shared character cache and resolution helpers for the TUI and CLI
cli/– Command-line interface parsing and handlingcharacter_list.rs– Character card listing functionalitymod.rs– CLI argument parsing and command dispatchingmodel_list.rs– Model listing functionalityprovider_list.rs– Provider listing functionalitysettings/– Trait-basedset/unsethandler registrytheme_list.rs– Theme listing functionality
commands/– Chat command processing and registry-driven dispatchmod.rs– Command handlers and dispatcherrefine.rs– Message refinement logicregistry.rs– Static command metadata registry
core/– Core application componentsapp/– Application state and controllersactions/– Internal action definitions and dispatcher for chat loop updatesapp.rs– MainAppstruct and event loop integrationconversation.rs– Conversation controller for chat flow, retries, and streaming helpersmod.rs– App struct and module exportspicker/– Generic picker that powers all TUI selection dialogspickers.rs– Picker constructors and helpers for each picker typesession.rs– Session bootstrap and provider/model statesettings.rs– Theme and provider controllersstreaming.rs– Handles streaming responses from the APIui_helpers.rs– UI state transition helpersui_state.rs– UI state management and text input helpersbuiltin_presets.rs– Built-in preset loader
builtin_providers.rs– Built-in provider configuration (loads frombuiltins/models.toml)chat_stream.rs– Shared streaming service that feeds responses to the app, UI, and loggersconfig/– Configuration data, defaults, caching, and persistencedata.rs– Configuration data types and pure helpersdefaults.rs– Default selection helpers andConfigimplementationsio.rs– Config path resolution and persistence routinesmod.rs– Public exports for configuration helpersorchestrator.rs– Cached config loader, mutation orchestrator, and test isolationtests.rs– Configuration module tests
keyring.rs– Secure storage for API keys
message.rs– Message data structuresmcp/– Model Context Protocol client integrationclient.rs– MCP transport and connection handling for HTTP and stdioevents.rs– MCP server request envelopesmod.rs– MCP module exports and tool name constantspermissions.rs– Per-tool permission decision storeregistry.rs– Enabled MCP server registry
mcp_auth.rs– Keyring-backed MCP token storagepersona.rs– Persona management and variable substitutionpreset.rs– System instruction preset managementtext_wrapping.rs– Text wrapping utilities
ui/– Terminal interface renderingappearance.rs– Theme and style definitionschat_loop/– Mode-aware chat loop orchestrating UI flows, keybindings, and command routingevent_loop.rs– Async terminal loop orchestration, event polling, and stream dispatchkeybindings/– Mode-aware keybinding registry and handlerslifecycle.rs– Terminal setup/teardown helpers and resource guardsmodes.rs– Mode-aware key handlers and text interaction utilities
help.rs– Help text renderinglayout.rs– Shared width-aware layout engine for Markdown and plain textmarkdown/– Markdown renderer and wrapping helpers that emit span metadatamod.rs– UI module declarationsosc/– Crossterm backend wrapper that emits OSC 8 hyperlinkspicker.rs– Picker controls and renderingrenderer.rs– Terminal interface rendering (chat area, input, pickers)span.rs– Span metadata for clickable linkstheme.rs– Theme loading and managementtitle.rs– Header bar rendering
utils/– Utility functions and helpersclipboard.rs– Cross-platform clipboard helpercolor.rs– Terminal color detection and palette quantizationeditor.rs– External editor integrationlogging.rs– Chat logging functionalitymod.rs– Utility module declarationsscroll.rs– Text wrapping and scroll calculations
Development
Running Tests
Performance
Chabeau includes lightweight performance checks in the unit test suite and supports optional Criterion benches.
- Built-in perf checks (unit tests):
- Short history prewrap (50 iters, ~60 lines): warns at ≥ 90ms; fails at ≥ 200ms.
- Large history prewrap (20 iters, ~400 lines): warns at ≥ 400ms; fails at ≥ 1000ms.
- Run with:
cargo test(warnings print to stderr; tests only fail past the fail thresholds).
- Optional benches (release mode) using Criterion 0.7:
- A
render_cachebench validates the cached prewrapped rendering path. - Run:
cargo bench - Reports live in
target/criterion/(HTML underreport/index.html). - To add new benches, create files under
benches/(e.g.,benches/my_bench.rs) and use Criterion’scriterion_group!/criterion_main!. - Benches import internal modules via
src/lib.rs(e.g.,use chabeau::...).
- A
License
CC0 1.0 Universal (Public Domain)