Skip to main content

CLI for the OneFirewall AI Gateway — chat, stream, and build agents from your terminal

Project description

onefirewall-ai

CLI for the OneFirewall AI Gateway and any OpenAI-compatible provider — chat, stream, and run agent workflows from your terminal.

PyPI Python License: MIT

Installation

pip install onefirewall-ai

First-Time Setup

1. Login

onefirewall-ai login

The login wizard asks you to choose a provider first:

Select a provider:

  1) OneFirewall AI  (managed AI gateway)
  2) Other           (any OpenAI-compatible provider)

Option 1 — OneFirewall AI

  • Endpoint is pre-configured (https://onefirewall.ai)
  • Asks for your OneFirewall API key
  • Fetches your available workspaces / models from the gateway
  • Lets you pick one from a numbered list
  • Tests the connection, then saves

Option 2 — Custom OpenAI-compatible provider

Works with any provider that exposes an OpenAI-compatible API: OpenAI, Groq, Together AI, Ollama, Azure OpenAI, LM Studio, and others.

  • Asks for a provider label (e.g. OpenAI, Groq)
  • Asks for the API base URL (e.g. https://api.openai.com)
  • Asks for your API key
  • Tries to auto-fetch available models from /v1/models and lets you pick from a list
  • If models can't be fetched automatically, asks you to enter a model name manually
  • Tests the connection, then saves

Your config is saved to ~/.onefirewall-ai/access.json.
To switch providers or change your model, just run onefirewall-ai login again.

2. Start using it

onefirewall-ai

Running onefirewall-ai with no arguments opens the interactive REPL in agent mode.

Common Ways To Use It

Interactive agent REPL

onefirewall-ai
onefirewall-ai agent

Use this when you want the assistant to inspect files, run tools, and help across multiple turns in one session.

Interactive chat-only REPL

onefirewall-ai chat

Opens the REPL without agent tool execution.

One-shot chat message

onefirewall-ai "What is the capital of France?"
onefirewall-ai "Explain Kubernetes in simple terms"
onefirewall-ai chat "Summarize this error message"

Sends a single message and streams the answer back to your terminal.

One-shot agent task

onefirewall-ai agent "Fix the failing tests in this repo"
onefirewall-ai agent "Read the README and explain the project structure"

Use this when you want the assistant to act autonomously for one task.

Resume a session

onefirewall-ai --session my-task "continue"
onefirewall-ai --session my-task agent "add tests for the new endpoint"

Use --session to keep related work in the same saved conversation.

List and inspect sessions

onefirewall-ai sessions
onefirewall-ai sessions view <session-id>

Pipe input into the CLI

cat logs.txt | onefirewall-ai "Summarize the main errors"
cat diff.txt | onefirewall-ai agent "Review this patch"
echo "hello" | onefirewall-ai "Repeat this back"

Useful for logs, diffs, command output, or any text you want to send alongside a prompt.

REPL Guide

Agent mode vs chat mode

  • Agent mode — the assistant can use tools, inspect files, and take action.
  • Chat mode — conversation only, no tools.
  • Switch modes at any time with /agent inside the REPL.

Slash commands

Command Description
/help Show REPL help
/session Show current session ID
/new Clear the current conversation
/clear Clear the terminal screen
/agent Toggle agent / chat mode
/exit or /quit Leave the REPL

Multi-line input

  • Press Alt+Enter to insert a newline
  • Or end a line with \ to continue on the next line

Provider Configuration

The active provider and model are stored in ~/.onefirewall-ai/access.json.

OneFirewall AI example

{
  "provider": "onefirewall",
  "endpoint": "https://onefirewall.ai",
  "api_key": "YOUR_API_KEY",
  "model": "openai/gpt-4o",
  "strategy": "balanced"
}

Custom provider example (e.g. OpenAI)

{
  "provider": "custom",
  "provider_label": "OpenAI",
  "endpoint": "https://api.openai.com",
  "api_key": "sk-...",
  "model": "gpt-4o",
  "strategy": "balanced"
}

The provider field controls which API path is used:

Provider Chat completions path
onefirewall {endpoint}/api/v1/chat/completions
custom {endpoint}/v1/chat/completions

To change your provider or model at any time, run:

onefirewall-ai login

Command Reference

Command What it does
onefirewall-ai Open the REPL in agent mode
onefirewall-ai agent Open the REPL in agent mode explicitly
onefirewall-ai chat Open the REPL in chat-only mode
onefirewall-ai "<message>" Send one message and stream the reply
onefirewall-ai agent "<task>" Run one agent task
onefirewall-ai --session <id> "<message>" Resume a chat session
onefirewall-ai --session <id> agent "<task>" Resume an agent session
onefirewall-ai sessions List saved sessions
onefirewall-ai sessions view <id> Show a saved session
onefirewall-ai login Configure provider, API key, and model
onefirewall-ai help Show CLI help
onefirewall-ai version Show installed version

Where Data Is Stored

~/.onefirewall-ai/
├── access.json       ← provider, endpoint, API key, model
├── MEMORY.md         ← persistent context the assistant remembers
├── SOUL.md           ← persona and behavior guidance
└── sessions/
    └── <session_id>.md

Customizing The Assistant

SOUL.md

Edit ~/.onefirewall-ai/SOUL.md to shape the assistant's persona:

# Soul
You are a concise senior DevOps engineer. Always prefer CLI examples.

MEMORY.md

Edit ~/.onefirewall-ai/MEMORY.md to give the assistant persistent context:

# Memory
- My project uses Python 3.12 and FastAPI.
- Always prefer async/await patterns.

Note: MEMORY.md is synced to the OneFirewall AI gateway when using the onefirewall provider. For custom providers it is used as local context only.

License

MIT Copyright OneFirewall

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

onefirewall_ai-0.1.7.tar.gz (60.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

onefirewall_ai-0.1.7-py3-none-any.whl (52.2 kB view details)

Uploaded Python 3

File details

Details for the file onefirewall_ai-0.1.7.tar.gz.

File metadata

  • Download URL: onefirewall_ai-0.1.7.tar.gz
  • Upload date:
  • Size: 60.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for onefirewall_ai-0.1.7.tar.gz
Algorithm Hash digest
SHA256 dcedbef02211548de7039f9d5ded1ebe283a60dcd829cbcb3dcef698402e086d
MD5 7754d984a918388f668e79ebcb33c913
BLAKE2b-256 df7eec13833b5ccc0fcee9aacfaa2caabb9a98f135cbff506b1000c7f19bc8e4

See more details on using hashes here.

File details

Details for the file onefirewall_ai-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: onefirewall_ai-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 52.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for onefirewall_ai-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a9618e0c91baf34d5304654190068c624f50f763c454c07787ad4147ab9c227f
MD5 48c067fa453bc0df7dc5bdbabaad0773
BLAKE2b-256 88a64195a467cc93212fe3dc1b82cd9b9e0233aceaa979ae2c67e3e464625338

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page