### Quick Start Docker Compose Setup Source: https://github.com/inference-gateway/cli/blob/main/examples/mcp/README.md Follow these steps to copy and configure environment variables, then start the services using Docker Compose. Ensure your API keys are added to the .env file. ```bash cp .env.example .env # Edit .env and add your DEEPSEEK_API_KEY, OPENAI_API_KEY, or ANTHROPIC_API_KEY docker compose up --build docker compose run --rm cli ``` -------------------------------- ### Example Workflow: Open and Use Firefox Source: https://github.com/inference-gateway/cli/blob/main/examples/computer-use/README.md A step-by-step guide to opening Firefox, navigating to a website, and interacting with it using the available tools. ```text Agent: Please help me open Firefox and navigate to example.com Steps: 1. Take a screenshot to see the current state 2. Click on Applications menu (top-left, ~10, 10) 3. Click on Web Browser 4. Wait for Firefox to open (take another screenshot) 5. Click on the address bar 6. Type "example.com" 7. Press Enter (send key combo "Return") ``` -------------------------------- ### Example Workflow: Run Terminal Commands Source: https://github.com/inference-gateway/cli/blob/main/examples/computer-use/README.md A step-by-step guide for opening a terminal, executing a command, and capturing the output via screenshots. ```text Agent: Please run "ls -la" in the terminal Steps: 1. Take a screenshot 2. Click on Applications menu 3. Click on Terminal Emulator 4. Type "ls -la" 5. Press Enter 6. Take a screenshot of the output ``` -------------------------------- ### Example Workflow: Create and Edit a Text File Source: https://github.com/inference-gateway/cli/blob/main/examples/computer-use/README.md A step-by-step guide for creating a new text file, typing content, saving it with a specific filename, and confirming the save operation. ```text Agent: Create a text file with some content Steps: 1. Take a screenshot 2. Click on Applications menu 3. Navigate to Accessories → Text Editor 4. Type "This is a test file created by the agent" 5. Press Ctrl+S to save 6. Type "/tmp/agent-test.txt" as filename 7. Press Enter to confirm ``` -------------------------------- ### Starting Inference Gateway Web Terminal Source: https://github.com/inference-gateway/cli/blob/main/README.md Provides examples for starting the web terminal server, including specifying custom ports and hosts, and configuring settings via a YAML file. ```bash # Start web terminal server infer chat --web # Open browser to http://localhost:3000 # Click "+" to create new terminal tabs # Each tab is an independent chat session # Custom port for remote access infer chat --web --port 8080 --host 0.0.0.0 # Configure via config file cat > .infer/config.yaml < ``` -------------------------------- ### Heartbeat Daemon Startup Log Source: https://github.com/inference-gateway/cli/blob/main/docs/heartbeat.md Example log output indicating the channels-manager has started and the heartbeat service is active with its configured interval and delay. ```text INFO Starting channels-manager INFO Heartbeat service started interval=1h0m0s initial_delay=1m0s INFO Daemon ready. Press Ctrl+C to stop. ``` -------------------------------- ### Install Skill and Overwrite Existing Source: https://github.com/inference-gateway/cli/blob/main/docs/skills.md Install a skill, replacing any existing skill folder of the same name. Without this flag, an existing folder will cause the install to fail. ```bash infer skills install --overwrite ``` -------------------------------- ### Configure Inference Gateway Environment Source: https://github.com/inference-gateway/cli/blob/main/examples/a2a/README.md Copy the example environment file to set up your Inference Gateway configuration. ```bash cp .env.example .env ``` -------------------------------- ### Docker Deployment: Basic Setup Source: https://github.com/inference-gateway/cli/blob/main/docs/web-terminal.md Defines a Dockerfile to build an image for the web terminal and exposes port 3000. The default command starts the chat interface with web access enabled. ```dockerfile FROM ghcr.io/inference-gateway/cli:latest EXPOSE 3000 CMD ["chat", "--web", "--host", "0.0.0.0"] ``` -------------------------------- ### Verify and Install Manually Downloaded Binary Source: https://github.com/inference-gateway/cli/blob/main/README.md Download the CLI binary and its checksums from the releases page, verify its integrity, and then install it to your system's PATH. ```bash # Download binary and checksums curl -L -o infer-darwin-amd64 \ https://github.com/inference-gateway/cli/releases/latest/download/infer-darwin-amd64 curl -L -o checksums.txt \ https://github.com/inference-gateway/cli/releases/latest/download/checksums.txt # Verify checksum shasum -a 256 infer-darwin-amd64 grep infer-darwin-amd64 checksums.txt # Install chmod +x infer-darwin-amd64 sudo mv infer-darwin-amd64 /usr/local/bin/infer ``` -------------------------------- ### Install Inference Gateway CLI from Source Source: https://github.com/inference-gateway/cli/blob/main/examples/basic/README.md Build and install the `infer` CLI from source using `flox`. This is recommended for development purposes. ```bash flox activate -- task build flox activate -- task install ``` -------------------------------- ### Create Custom MCP Server with Node.js SDK Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Use the `@modelcontextprotocol/sdk` to create a custom MCP server. This example demonstrates registering a tool and starting an HTTP SSE server. ```javascript import { MCPServer } from '@modelcontextprotocol/sdk'; import { createServer } from 'http'; const mcp = new MCPServer({ name: 'my-custom-server', version: '1.0.0' }); // Register tools mcp.tool('my_tool', { description: 'My custom tool', parameters: { type: 'object', properties: { input: { type: 'string' } } } }, async (params) => { return { result: `Processed: ${params.input}` }; }); // Start HTTP SSE server const server = createServer(mcp.createHTTPHandler()); server.listen(3000); ``` -------------------------------- ### Install Inference Gateway CLI with Install Script Source: https://github.com/inference-gateway/cli/blob/main/examples/basic/README.md Install the `infer` CLI using a provided shell script. This method downloads and installs the CLI to a specified directory. ```bash curl -fsSL https://raw.githubusercontent.com/inference-gateway/cli/main/install.sh | bash -s -- --install-dir $HOME/.local/bin ``` -------------------------------- ### Tree Tool Examples Source: https://github.com/inference-gateway/cli/blob/main/docs/tools-reference.md Demonstrates various ways to use the Tree tool to display directory structures with different options. ```shell # Basic tree (current directory, default settings) tree ``` ```shell # Tree with depth limit (2 levels) tree --max_depth 2 ``` ```shell # Tree with hidden files tree --show_hidden true ``` ```shell # Tree ignoring gitignore tree --respect_gitignore false ``` ```shell # JSON output tree --format json ``` -------------------------------- ### Start Docker Containers Source: https://github.com/inference-gateway/cli/blob/main/examples/a2a/README.md Bring all necessary Docker containers up for the Inference Gateway. ```bash docker compose up -d ``` -------------------------------- ### Install Skill from GitHub Source: https://github.com/inference-gateway/cli/blob/main/docs/skills.md Install a skill directly from a specified directory within a GitHub repository. The URL must point to a directory, not a file or the repo root. ```bash infer skills install https://github.com/anthropics/skills/tree/main/skills/pdf ``` -------------------------------- ### Running a Local Agent with Docker Source: https://github.com/inference-gateway/cli/blob/main/docs/agents-configuration.md This command starts a local agent as a Docker container. Ensure Docker is installed and running, and the OCI image is available. The agent must expose an HTTP endpoint. ```bash docker run -d -p 8081:8080 \ -e API_KEY=secret \ -e MODEL=gpt-4 \ ghcr.io/org/test-runner:latest ``` -------------------------------- ### Example System Prompt Section Source: https://github.com/inference-gateway/cli/blob/main/docs/agents-configuration.md This section shows how configured agents are listed in the system prompt, making them available for AI delegation. ```text Available A2A Agents: - https://code-review.example.com - https://security.example.com - https://perf.example.com You can delegate tasks to these agents using the A2A tools (A2A_SubmitTask, A2A_QueryAgent, A2A_QueryTask). ``` -------------------------------- ### Install whisper-cpp via Nix Source: https://github.com/inference-gateway/cli/blob/main/docs/speech-to-text.md Install the whisper-cpp transcription tool using Nix. This is an alternative installation method for Linux or macOS users who prefer Nix. ```bash nix profile install nixpkgs#openai-whisper-cpp ``` -------------------------------- ### View Migration Status Example Output Source: https://github.com/inference-gateway/cli/blob/main/docs/database-migrations.md An example of the output format when checking the status of SQLite database migrations. ```text SQLite Migration Status: ✅ Version 001: Initial schema - conversations table (Applied) ❌ Version 002: Add user preferences table (Pending) ``` -------------------------------- ### Start Docker Services with VNC Profile Source: https://github.com/inference-gateway/cli/blob/main/examples/telegram-channel/README.md To enable live VNC viewing of the browser agent, start the services with the 'vnc' profile. ```bash docker compose --profile vnc up -d browser-vnc ``` -------------------------------- ### Write Tool Examples Source: https://github.com/inference-gateway/cli/blob/main/docs/tools-reference.md Illustrates different scenarios for the Write tool, including creating new files, writing to subdirectories, and safe overwriting. ```shell # Create new file write --file_path "output.txt" --content "Hello, World!" ``` ```shell # Write to subdirectory (create directories if they don't exist) write --file_path "logs/app.log" --content "log entry" --create_dirs true ``` ```shell # Safe overwrite (do not overwrite if file exists) write --file_path "config.json" --content "{...}" --overwrite false ``` -------------------------------- ### Download Go Modules Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Downloads the necessary Go modules for the project. This is a common development setup task. ```bash flox activate -- task mod:download ``` -------------------------------- ### Build CLI from Source Source: https://github.com/inference-gateway/cli/blob/main/README.md Clone the repository, navigate to the directory, and build the CLI binary from the source code. This method requires Git and Go to be installed. ```bash git clone https://github.com/inference-gateway/cli.git cd cli go build -o infer cmd/infer/main.go sudo mv infer /usr/local/bin/ ``` -------------------------------- ### Start Channel Listener Source: https://github.com/inference-gateway/cli/blob/main/README.md Run this command to start the channels manager daemon, which listens for messages from configured channels. ```bash infer channels-manager ``` -------------------------------- ### Build Binary with Task Source: https://github.com/inference-gateway/cli/blob/main/README.md Use the `task build` command to compile the binary. Ensure Task is installed and configured. ```bash task build # Build binary ``` -------------------------------- ### Start Web Terminal Server Source: https://github.com/inference-gateway/cli/blob/main/docs/web-terminal.md Starts the web terminal server with default settings or custom port and host configurations. Use '0.0.0.0' for host to enable remote access, but be aware of security implications. ```bash # Start with default settings (localhost:3000) infer chat --web # Custom port infer chat --web --port 8080 # Bind to all interfaces for remote access (SECURITY WARNING: see below) infer chat --web --host 0.0.0.0 --port 8080 ``` -------------------------------- ### Start Inference Gateway Environment Source: https://github.com/inference-gateway/cli/blob/main/examples/computer-use/README.md Builds and starts the Inference Gateway environment using Docker Compose. This includes the GUI server, Inference Gateway, and screenshot streaming. ```bash docker-compose up -d --build ``` -------------------------------- ### RequestPlanApproval Tool Example Source: https://github.com/inference-gateway/cli/blob/main/docs/tools-reference.md This JSON object demonstrates the parameters for the RequestPlanApproval tool, including a title and the detailed plan in Markdown format. ```json { "title": "Add login flow", "plan": "## Context\n\nUsers can't sign in...\n\n## Files to Modify\n\n- internal/auth/login.go - add handler\n\n## Verification\n\nRun `task test`." } ``` -------------------------------- ### Basic MCP Server Configuration Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Example configuration for enabling an MCP server with connection and discovery timeouts. ```yaml enabled: true connection_timeout: 30 discovery_timeout: 30 servers: - name: "filesystem" url: "http://localhost:3000/sse" enabled: true description: "File system operations" ``` -------------------------------- ### Command-Line Override Example Source: https://github.com/inference-gateway/cli/blob/main/docs/web-terminal.md Demonstrates configuration precedence where command-line flags override settings from the config file. ```bash # Config file sets port to 3000 # Command-line overrides to 8080 infer chat --web --port 8080 # Uses 8080 ``` -------------------------------- ### Start Inference Gateway with Docker Compose Source: https://github.com/inference-gateway/cli/blob/main/examples/basic/README.md Use this command to start the Inference Gateway server using Docker Compose. Ensure you have copied and configured the `.env` file with your API keys. ```bash cp .env.example .env docker-compose up -d docker-compose ps ``` -------------------------------- ### Run MCP Server Standalone Source: https://github.com/inference-gateway/cli/blob/main/examples/mcp/mcp-server/README.md Navigate to the mcp-server directory and run the main Go program to start the server. ```bash cd mcp-server go run main.go ``` -------------------------------- ### Read Tool Configuration Source: https://github.com/inference-gateway/cli/blob/main/docs/tools-reference.md Configuration example for enabling the Read tool. Read operations do not require approval by default. ```yaml tools: read: enabled: true require_approval: false ``` -------------------------------- ### Start Web Terminal Server Source: https://github.com/inference-gateway/cli/blob/main/docs/web-terminal.md Starts the web terminal server on your workstation, binding to all network interfaces. Access it from any device on your network by navigating to the specified IP address and port. Be aware of the security implications of binding to 0.0.0.0. ```bash # Start server on your workstation infer chat --web --host 0.0.0.0 --port 8080 # Access from laptop, tablet, or phone # Navigate to: http://workstation-ip:8080 ``` -------------------------------- ### Install Cosign Source: https://github.com/inference-gateway/cli/blob/main/docs/security/binary-verification.md Install the Cosign tool on macOS using Homebrew, Linux using a release binary, or via Go. This is a prerequisite for signature verification. ```bash # macOS brew install cosign ``` ```bash # Linux (using release binary) wget https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64 chmod +x cosign-linux-amd64 sudo mv cosign-linux-amd64 /usr/local/bin/cosign ``` ```bash # Or install via go go install github.com/sigstore/cosign/v2/cmd/cosign@latest ``` -------------------------------- ### Install ffmpeg on Debian/Ubuntu Source: https://github.com/inference-gateway/cli/blob/main/docs/speech-to-text.md Install ffmpeg on Debian or Ubuntu systems using apt. This is necessary for audio processing tasks required by the speech-to-text feature. ```bash apt install ffmpeg ``` -------------------------------- ### Cron Syntax Examples Source: https://github.com/inference-gateway/cli/blob/main/docs/scheduling.md Examples of standard 5-field crontab expressions and extended descriptors for defining job schedules. Refer to robfig/cron documentation for the full grammar. ```text 0 8 * * * Every day at 08:00 */15 * * * * Every 15 minutes 0 9 * * 1-5 Weekdays at 09:00 0 0 1 * * First of every month at midnight @every 1h Every hour @every 30m Every 30 minutes @daily Equivalent to 0 0 * * * ``` -------------------------------- ### Example Discovery Log Output Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Illustrates log messages during tool discovery, showing successful discoveries and connection errors. ```text WARN Failed to discover tools from MCP server server=filesystem url=http://localhost:3000/sse error="connection refused" INFO Discovered tools from MCP server server=database tool_count=5 ``` -------------------------------- ### Write Tool Configuration Source: https://github.com/inference-gateway/cli/blob/main/docs/tools-reference.md Configuration example for enabling the Write tool. Write operations require approval by default for security. ```yaml tools: write: enabled: true require_approval: true ``` -------------------------------- ### List All Configured Agents Source: https://github.com/inference-gateway/cli/blob/main/docs/commands-reference.md Lists all agents that have been configured. This command helps in reviewing the current agent setup. ```bash infer agents list ``` -------------------------------- ### Start Web Terminal for LAN Access Source: https://github.com/inference-gateway/cli/blob/main/docs/web-terminal.md Starts the web terminal server, making it accessible on your local area network. Team members can connect to the specified IP address and port to share terminal access for collaboration or troubleshooting. Each user gets their own independent tab/session. ```bash # Start server accessible on LAN infer chat --web --host 0.0.0.0 # Team members connect to http://your-ip:3000 # Each person gets their own tab/session ``` -------------------------------- ### CI/CD Build Steps for FloatingWindow.app and Go Binary Source: https://github.com/inference-gateway/cli/blob/main/internal/display/macos/ComputerUse/README.md This script demonstrates the necessary steps for a CI/CD pipeline. It first builds the FloatingWindow.app on macOS and then proceeds to build the Go binary, which embeds the compiled app. ```bash # Build FloatingWindow.app (macOS only) if [ "$(uname)" = "Darwin" ]; then cd internal/display/macos/FloatingWindow ./build.sh cd - fi # Build Go binary (embeds FloatingWindow.app) go build -o infer . ``` -------------------------------- ### Example Plan File Listing Source: https://github.com/inference-gateway/cli/blob/main/docs/plan-mode.md Demonstrates the output of listing plan files in the user's configuration directory. Files are named with a timestamp and a slug, indicating different plan executions. ```bash $ ls ~/.infer/plans/ 2026-04-25-091230-rip-out-old-auth-middleware.md 2026-04-26-143015-add-login-flow.md 2026-04-27-103015-rename-config-loader.md ``` -------------------------------- ### Example Status Bar Display Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Shows different states of MCP server connection status in the UI's status bar. ```text MCP: 0/1 # 0 connected, 1 total (server down) MCP: 1/1 # 1 connected, 1 total (server healthy) MCP: 2/3 # 2 connected, 3 total (1 server down) ``` -------------------------------- ### Rename Go Installed Binary Source: https://github.com/inference-gateway/cli/blob/main/README.md After installing with 'go install', rename the binary from 'cli' to 'infer' for convenience. ```bash mv $(go env GOPATH)/bin/cli $(go env GOPATH)/bin/infer ``` -------------------------------- ### MCP Server Auto-Start Configuration Example Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Illustrates the YAML configuration for an auto-starting MCP server, specifying OCI image, host, scheme, port, path, and startup timeout. ```yaml servers: - name: "my-server" enabled: true run: true # Enable auto-start oci: "my-mcp-server:latest" # OCI/Docker image host: localhost # Default: localhost scheme: http # Default: http port: 3000 # Auto-assigned if omitted path: /mcp # Default: /mcp startup_timeout: 60 # Default: 30 seconds ``` -------------------------------- ### Install Pre-commit Hooks Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Command to install pre-commit hooks using flox. ```bash flox activate -- task precommit:install ``` -------------------------------- ### Conventional Commits Examples Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Examples of valid commit messages following the Conventional Commits specification. ```text feat: add chat command for interactive LLM sessions ``` ```text fix: resolve memory leak in tool execution ``` ```text docs: update README with installation instructions ``` ```text feat!: change default config file location ``` ```text fix(cli): handle missing config file gracefully ``` -------------------------------- ### Initialize Project with Migrations Source: https://github.com/inference-gateway/cli/blob/main/docs/database-migrations.md Initialize a new project, automatically running database migrations by default. Use --skip-migrations to prevent this. ```bash infer init --overwrite ``` ```bash infer init --overwrite --skip-migrations ``` -------------------------------- ### Initialize Project Configuration Source: https://github.com/inference-gateway/cli/blob/main/docs/commands-reference.md Use this command to start a new project with Inference Gateway CLI. It creates essential configuration files and directories. The `--overwrite` flag can be used to replace existing files, and `--userspace` initializes global fallback configuration in your home directory. ```bash infer init ``` ```bash infer init --overwrite ``` ```bash infer init --userspace ``` -------------------------------- ### Start a New Conversation with a Title Source: https://github.com/inference-gateway/cli/blob/main/docs/conversation-storage.md Use this command to start a new conversation and immediately assign it a title. ```bash /save My Important Discussion ``` -------------------------------- ### Initialize Project Configuration Source: https://github.com/inference-gateway/cli/blob/main/examples/basic/README.md Use `infer init` to set up the project's configuration. You can then set specific configuration values like the default chat model using `infer config set`. ```bash # Initialize project configuration infer init ``` ```bash # Set default model for chat sessions infer config set agent.model anthropic/claude-4.5-sonnet infer config set agent.model openai/gpt-4 infer config set agent.model google/gemini-pro ``` ```bash # Read a value back (or `infer config get` to dump everything) infer config get agent.model ``` -------------------------------- ### Configure Manually Started MCP Server Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md YAML configuration for a manually started MCP server, specifying its URL. ```yaml servers: - name: "demo-server" url: "http://localhost:3000/sse" enabled: true ``` -------------------------------- ### Install Custom Desktop Environment Source: https://github.com/inference-gateway/cli/blob/main/examples/computer-use/README.md Modify the Dockerfile to install a different desktop environment, such as MATE or LXDE, by replacing XFCE. ```dockerfile # Replace XFCE with MATE, LXDE, etc. RUN apt-get install -y ubuntu-mate-desktop ``` -------------------------------- ### Write Unit Tests for a New Tool Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Create a test file (e.g., `your_tool_test.go`) to verify your tool's functionality. Include tests for `Definition`, `Execute`, and `Validate` methods, covering both successful and error cases. ```go package tools import ( "context" "testing" "github.com/inference-gateway/cli/config" "github.com/stretchr/testify/assert" ) func TestYourTool_Definition(t *testing.T) { cfg := &config.Config{ Tools: config.ToolsConfig{Enabled: true}, } tool := NewYourTool(cfg) def := tool.Definition() assert.Equal(t, "YourTool", def.Function.Name) assert.Contains(t, *def.Function.Description, "your tool") } ``` ```go func TestYourTool_Execute(t *testing.T) { cfg := &config.Config{ Tools: config.ToolsConfig{Enabled: true}, } tool := NewYourTool(cfg) args := map[string]any{ "param1": "test value", } result, err := tool.Execute(context.Background(), args) assert.NoError(t, err) assert.NotNil(t, result) assert.Contains(t, result.Output, "test value") } ``` ```go func TestYourTool_Validate(t *testing.T) { cfg := &config.Config{ Tools: config.ToolsConfig{Enabled: true}, } tool := NewYourTool(cfg) // Test valid args validArgs := map[string]any{"param1": "value"} assert.NoError(t, tool.Validate(validArgs)) // Test invalid args invalidArgs := map[string]any{} assert.Error(t, tool.Validate(invalidArgs)) } ``` -------------------------------- ### Initialize and Manage Agents Source: https://github.com/inference-gateway/cli/blob/main/README.md Set up and manage agent configurations with `infer agents`. Use `init` to initialize, `add` to include agents from the registry or a custom URL, and `list` to view existing agents. ```bash infer agents init # Initialize agents configuration infer agents add browser-agent # Add an agent from the registry with defaults infer agents add custom https://... # Add a custom agent infer agents list # List all agents ``` -------------------------------- ### Set Up Environment Variables Source: https://github.com/inference-gateway/cli/blob/main/README.md Create a `.env` file to store your API keys for different services. This is essential for the CLI to authenticate with external APIs. ```env ANTHROPIC_API_KEY=your_key_here OPENAI_API_KEY=your_key_here DEEPSEEK_API_KEY=your_key_here ``` -------------------------------- ### Install whisper-cpp via Homebrew Source: https://github.com/inference-gateway/cli/blob/main/docs/speech-to-text.md Install the whisper-cpp transcription tool using Homebrew on macOS. This is a prerequisite for using the speech-to-text feature. ```bash brew install whisper-cpp ``` -------------------------------- ### Install Infer CLI Source: https://github.com/inference-gateway/cli/blob/main/README.md Install the Claude CLI globally using npm if it's not found. Alternatively, you can set a custom path in your configuration. ```bash which claude npm install -g @anthropic-ai/claude-code claude_code: cli_path: /full/path/to/claude ``` -------------------------------- ### Install Claude Code CLI Source: https://github.com/inference-gateway/cli/blob/main/README.md Install the official Claude Code CLI using npm. This is a prerequisite for using Claude Code mode. ```bash npm install -g @anthropic-ai/claude-code ``` -------------------------------- ### Install ffmpeg via Homebrew Source: https://github.com/inference-gateway/cli/blob/main/docs/speech-to-text.md Install ffmpeg using Homebrew on macOS. ffmpeg is required for microphone capture and decoding voice messages. ```bash brew install ffmpeg ``` -------------------------------- ### Initialize MCP Project Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Run this command in your project directory to initialize MCP configuration. ```bash cd your-project infer init ``` -------------------------------- ### Install CLI Globally with npm Source: https://github.com/inference-gateway/cli/blob/main/README.md Install the Inference Gateway CLI globally on your system for easy access. This makes the 'infer' command available system-wide. ```bash npm install -g @inference-gateway/cli infer --help ``` -------------------------------- ### Basic Inference Gateway CLI Workflow Source: https://github.com/inference-gateway/cli/blob/main/README.md Demonstrates the fundamental commands for initializing a project, starting an interactive chat, executing an agent task, and checking the gateway status. ```bash # Initialize project infer init # Start interactive chat infer chat # Execute autonomous task infer agent "Fix the bug in issue #42" # Check gateway status infer status ``` -------------------------------- ### Initialize Configuration File Source: https://github.com/inference-gateway/cli/blob/main/docs/commands-reference.md Initialize a new `.infer/config.yaml` file. Use `--overwrite` to replace an existing file or `--userspace` to create it in your home directory. ```bash infer config init infer config init --overwrite # Initialize userspace configuration (global fallback) infer config init --userspace ``` -------------------------------- ### Initialize Agent Configuration Source: https://github.com/inference-gateway/cli/blob/main/docs/commands-reference.md Initializes the agents.yaml configuration file. This is the first step before managing agents. ```bash infer agents init ``` -------------------------------- ### WebFetch Tool Source: https://github.com/inference-gateway/cli/blob/main/docs/tools-reference.md Fetch content from allowed URLs or GitHub references using the format `example.com`. ```APIDOC ## WebFetch Tool Fetch content from allowed URLs or GitHub references using the format `example.com`. **Configuration:** ```yaml tools: web_fetch: enabled: true allowed_domains: - golang.org - github.com safety: max_size: 8192 # 8KB timeout: 30 allow_redirect: true cache: enabled: true ttl: 3600 # 1 hour ``` ``` -------------------------------- ### Troubleshoot Container Startup Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Check container logs for errors or verify if the specified port is already in use on the host machine. ```bash docker logs inference-mcp- ``` ```bash lsof -i : ``` -------------------------------- ### Start Inference Gateway with Single Container Source: https://github.com/inference-gateway/cli/blob/main/examples/basic/README.md An alternative method to start the Inference Gateway using a single Docker container. This command maps port 8080 and uses the specified image. ```bash docker run --rm -it --env-file .env -p 8080:8080 ghcr.io/inference-gateway/inference-gateway:latest ``` -------------------------------- ### Add MCP Server with Auto-Start Source: https://github.com/inference-gateway/cli/blob/main/docs/mcp-integration.md Use this command to add a new MCP server with auto-start enabled. Requires an OCI/Docker image. Optional flags allow specifying a custom port, startup timeout, description, and immediate enablement. ```bash infer mcp add [flags] --run # Enable auto-start --oci # OCI/Docker image (required if --run) --port # Optional: specific port --startup-timeout # Optional: startup timeout (default: 60) --description # Optional: description --enabled # Optional: enable immediately (default: true) ``` ```bash # Minimal - automatic port assignment infer mcp add demo --run --oci=mcp-demo:latest ``` ```bash # With custom port infer mcp add api --run --oci=api-mcp:latest --port=8080 ``` ```bash # With startup timeout infer mcp add slow --run --oci=slow-mcp:latest --startup-timeout=120 ``` ```bash # Complete configuration infer mcp add custom \ --run \ --oci=custom-mcp:latest \ --port=3000 \ --startup-timeout=60 \ --description="Custom MCP server" \ --enabled ``` -------------------------------- ### Define Basic Project Shortcuts Source: https://github.com/inference-gateway/cli/blob/main/docs/shortcuts-guide.md Configure shortcuts for common project tasks like testing, building, and linting. Ensure the `command` and `args` fields accurately reflect the desired shell commands. ```yaml shortcuts: - name: tests description: "Run all tests in the project" command: go args: - test - "./..." working_dir: . # Optional: set working directory - name: build description: "Build the project" command: go args: - build - -o - infer - . - name: lint description: "Run linter on the codebase" command: golangci-lint args: - run ``` -------------------------------- ### Install Skill with GitHub Token Authentication Source: https://github.com/inference-gateway/cli/blob/main/docs/skills.md Authenticate GitHub requests using a GITHUB_TOKEN environment variable to increase API rate limits and enable installation from private repositories. The token should match the format expected by the 'gh' CLI. ```bash GITHUB_TOKEN="$MY_TOKEN" infer skills install acme/internal-comms ``` -------------------------------- ### get Source: https://github.com/inference-gateway/cli/blob/main/docs/scheduling.md Retrieves details for a specific scheduled job using its job ID. ```APIDOC ## get ### Description Retrieves the details of a specific scheduled job using its unique job ID. ### Method GET (Implied by tool operation) ### Endpoint /schedule/{job_id} ### Parameters #### Path Parameters - **job_id** (string) - Required - The ID of the job to retrieve. #### Request Body - **operation** (string) - Required - Must be "get". - **job_id** (string) - Required - The ID of the job to retrieve. ### Request Example ```json { "operation": "get", "job_id": "0a1b2c3d-..." } ``` ### Response #### Success Response (200) - **job** (object) - The details of the requested job. - **job_id** (string) - **cron_expression** (string) - **prompt** (string) - **run_once** (boolean) - **name** (string) - **description** (string) - **model** (string) - **last_run** (string, optional) - **last_error** (string, optional) #### Response Example ```json { "job_id": "0a1b2c3d-...", "cron_expression": "0 8 * * *", "prompt": "Find an inspiring quote for today...", "run_once": false, "name": "Daily morning quote", "description": "Wake-up quote", "last_run": "2023-10-27T08:00:00Z" } ``` ``` -------------------------------- ### Command Execution vs. Display Source: https://github.com/inference-gateway/cli/blob/main/docs/shortcuts-guide.md Demonstrates how to execute a template as a shell command using '!' prefix or just display the result. ```yaml template: "!git commit -m \"{llm}\" ``` ```yaml template: "{llm}" ``` -------------------------------- ### Enter Interactive CLI Chat Source: https://github.com/inference-gateway/cli/blob/main/examples/a2a/README.md Start an interactive chat session within the CLI container. ```bash docker compose run --rm cli ``` -------------------------------- ### A2A Debugger - Get Task Source: https://github.com/inference-gateway/cli/blob/main/examples/a2a/README.md Retrieve details for a specific A2A task using its ID. ```bash docker compose run --rm a2a-debugger tasks get ``` -------------------------------- ### Authenticate and Test Infer CLI Source: https://github.com/inference-gateway/cli/blob/main/README.md Re-authenticate your Infer CLI setup and test your authentication status. ```bash infer claude-code setup infer claude-code test ``` -------------------------------- ### Create New Tool File Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Defines the basic structure for a new tool, including necessary imports and the tool struct. This serves as a starting point for implementing custom tool functionality. ```go package tools import ( "context" "fmt" "github.com/inference-gateway/cli/config" "github.com/inference-gateway/cli/internal/domain" "github.com/inference-gateway/sdk" ) // YourTool handles your specific functionality type YourTool struct { config *config.Config enabled bool // Add any additional dependencies here } // NewYourTool creates a new instance of your tool func NewYourTool(cfg *config.Config /* add other dependencies */) *YourTool { return &YourTool{ config: cfg, enabled: cfg.Tools.Enabled, // or specific config section // Initialize dependencies } } ``` -------------------------------- ### Tool Architecture Overview Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Illustrates the directory structure for tool implementations within the CLI. This provides a visual guide to where new tools should be placed and their related files. ```text internal/services/tools/ ├── interfaces.go # Tool interface definitions ├── registry.go # Tool management and registration ├── bash.go # Example: Bash command execution tool ├── read.go # Example: File reading tool ├── grep.go # Example: Grep tool ├── fetch.go # Example: Content fetching tool ├── websearch.go # Example: Web search tool └── [your-tool].go # Your new tool implementation ``` -------------------------------- ### Breaking Change Footer Example Source: https://github.com/inference-gateway/cli/blob/main/CONTRIBUTING.md Illustrates how to denote a breaking change using the 'BREAKING CHANGE' footer. ```text BREAKING CHANGE: API interface has changed ``` -------------------------------- ### Get Specific Schedule Source: https://github.com/inference-gateway/cli/blob/main/docs/scheduling.md Use this operation to retrieve the details of a specific scheduled job using its `job_id`. ```json { "operation": "get", "job_id": "0a1b2c3d-..." } ``` -------------------------------- ### Initialize Infer Project Source: https://github.com/inference-gateway/cli/blob/main/README.md Use `infer init` to set up a new project. The `--userspace` flag initializes user-level configuration instead of project-specific configuration. ```bash infer init # Initialize project configuration infer init --userspace # Initialize user-level configuration ```