# FeloAPI CLI

Install FeloAPI CLI with npm and run feloapi setup to configure Codex or Claude Code with your Felo API key.

FeloAPI CLI connects your AI coding tool to Felo. Follow the steps below; it takes about 3 minutes, and you do not need to know how to code.

## Install the Felo Skill (existing model)

If you already have an AI model and only need Felo data/tools:

Run the command below. It installs the CLI and runs onboarding: it shows the key page, saves the key you paste, and installs the Skill. One Felo API key works for model calls, Data API, search, and image/video; if you use another model provider, that account stays unchanged.

```bash
npm install -g feloapi-cli@latest; feloapi onboard
```

`feloapi onboard` shows the key page, asks you to paste the key, detects installed agents, and installs the bundled Skill. It does not write a model profile or change your default model. Use `--agent pi,opencode` to target specific agents, or `--dry-run` to preview.

## Set up Felo models (Codex / Claude Code)

Only needed if you want Felo to provide the model. For the Skill-only path, see above.

### Step 1: Install Node.js and open a terminal

1. Open [nodejs.org/en/download](https://nodejs.org/en/download), download the **LTS** installer, and click **Next** until it finishes. You do not need to open Node.js after installing.
2. Open a terminal:
   - **Mac:** press `Command (⌘) + Space`, type `Terminal`, press Return.
   - **Windows:** open the Start menu, type `PowerShell`, press Enter.
   - **Linux:** press `Ctrl + Alt + T`.

### Step 2: Install Felo

Copy this line, paste it into the terminal, and press Enter:

```bash
npm install -g feloapi-cli@latest
```

Wait until it stops. If you do not see red `error` text, continue. If you see `command not found`, close the terminal, open it again, and repeat this step.

### Step 3: Create your key

1. Open the [Felo API Keys page](https://openapi.felo.ai/console/api-keys).
2. Sign in, or create a Felo account.
3. Click **Create Key**, give it any name, and confirm.
4. Copy the **whole key shown on the result screen**. Keep it somewhere safe. The list only shows a hidden version, so if you lose it, create a new one.

> Do not send the key to anyone or paste it into a chat. Treat it like a password.

### Step 4: Connect Felo to your AI tool

Copy this line into the terminal and press Enter:

```bash
feloapi setup
```

Then choose with the arrow keys and press Enter:

1. **AI tool:** choose **Claude Code** or **Codex** (recommended). If you use Cursor, Cline, or another tool, choose that instead.
2. **What to set up:** choose **Models + Skills**.
3. **Key:** paste the key from Step 3, then press Enter. The screen stays blank while you paste — this is normal.
4. **Model:** choose the recommended model. If you are not sure, choose the first model in the list.
5. **Preview:** press Enter to save.

If you do not have Claude Code or Codex yet, install one first:

```bash
npm install -g @anthropic-ai/claude-code
claude
```

Or:

```bash
npm install -g @openai/codex
codex
```

Sign in when the tool opens. It is a separate product with its own account.

### Step 5: Open your AI tool

Open **Claude Code** if that is what you configured:

```bash
claude
```

Or open **Codex**:

```bash
codex
```

If you chose Cursor, Cline, or another tool, open it normally — only the Skill was installed. Ask a simple question, for example: “Search the web for today's AI news and summarize the top three items.”

### Step 6: Switch back to the official model (optional)

If you chose **Models + Skills**, setup writes Felo as the default model provider and backs up your previous Codex/Claude Code configuration:

```bash
feloapi use official   # restore your original configuration
feloapi use felo       # switch back to Felo
```

`feloapi disconnect codex --yes` (or `claude-code`) removes the Felo Skill and the backup. The key is stored in the client configuration for direct use; keep `~/.codex/config.toml` and `~/.claude/settings.json` private.

### If something goes wrong

- **`command not found`:** close the terminal, open it again, and repeat Step 2.
- **`Node.js` is too old:** install the LTS version from nodejs.org again, then reopen the terminal.
- **The key is rejected:** create a new key, then run `feloapi auth login` and paste it.
- **Codex says `fetch failed`:** run `feloapi setup --agent codex --allow-network` again, then start Codex with `codex -s workspace-write`.
- **You do not know which model to choose:** run `feloapi model list`, or just choose the first model.

## Advanced (optional)

- `npx feloapi-cli setup` is only for a quick trial. It needs network access and is not suitable for agent sandboxes or offline computers.
- For scripts or CI, use `feloapi setup --agent codex --model MODEL_ID --yes` or `--skills-only`; use `feloapi connect codex --model MODEL_ID --dry-run` to preview without saving.
- The key is saved locally at `~/.feloapi/state.json` as plain text (mode `0600`). For Codex/Claude model setup it is also written into the client configuration so the client can open directly; both files use mode `0600`. To avoid saving it, use `--skills-only` or `feloapi run`.
- Codex blocks network access in its sandbox; use `--allow-network` and start Codex with `-s workspace-write`.
- More details: [Authentication](#authentication), [Supported agents](#supported-agents), and [Codex sandbox](#codex-sandbox-and-network-access).

## Codex sandbox and network access

Codex blocks outbound network access when it runs in its sandbox, so Felo API calls fail unless both conditions are met:

- Use `feloapi setup --agent codex --model MODEL_ID --allow-network` so the generated Codex profile permits network access.
- Start Codex with `-s workspace-write`, for example `codex exec -s workspace-write "List the main files in this repository"`.

```bash
feloapi setup --agent codex --model gpt-5.6-sol --allow-network
codex exec -s workspace-write "List the main files in this repository"
```

Add `--yes` to run setup non-interactively in scripts and CI.

## Supported agents

| Agent | ID | Model profile | Skills |
| --- | --- | --- | --- |
| Codex | `codex` | Yes | Yes |
| Claude Code | `claude-code` | Yes | Yes |
| Cursor | `cursor` | No | Yes |
| Cline | `cline` | No | Yes |
| Roo Code | `roo-code` | No | Yes |
| Kilo Code | `kilo-code` | No | Yes |
| OpenCode | `opencode` | No | Yes |
| DeepSeek Harness | `deepseek-harness` | No | Yes |
| Hermes | `hermes` | No | Yes |
| OpenClaw | `openclaw` | No | Yes |
| Pi | `pi` | No | Yes |
| Freebuff | `freebuff` | No | Yes |

Model profiles are currently limited to `codex` and `claude-code`. For every other agent, setup installs Skills and leaves the agent's own model provider untouched.

Pi installs Skills into `$PI_CODING_AGENT_DIR/skills`, which defaults to `~/.pi/agent/skills`.

Freebuff has no configuration file of its own. It reads the shared `~/.agents/skills` directory, the same target as Cline, so configuring either agent writes to that shared location. `feloapi setup --agent freebuff --skills-only --yes` reuses it and reports `agent: cline` with `requestedAgent: freebuff` in its output.

```bash
feloapi agents
feloapi setup --agent deepseek-harness --skills-only
```

`feloapi agents` lists the agents supported on this machine; pass an ID to `--agent` to target one directly.

## Authentication

```bash
feloapi auth login
feloapi auth status
feloapi auth logout
```

`auth login` stores the key in `~/.feloapi/state.json`. `auth status` shows which credential is active and where it comes from. Model setup also writes the key into the managed client configuration for direct use. `auth logout` first restores every managed client configuration (removing the key from Codex/Claude configs), then deletes the state key. If a managed config was edited, logout refuses and keeps the key; restore it manually first. It does not revoke the remote key or unset `FELO_API_KEY`.

For CI and ephemeral shells, export the key instead. `FELO_API_KEY` is read from the environment and is not written to Felo's state file; model setup may still write it into the managed client configuration when you choose a model profile:

```bash
export FELO_API_KEY="YOUR_API_KEY"
feloapi model list
```

Console-side commands such as `feloapi keys` and `feloapi usage` are different: they call the website's account endpoints and require the **Felo Console web session token**, not an API Key (API Keys are rejected there with HTTP 401). Most users should manage keys and usage in the web Console; the CLI accepts a session token through `FELO_ACCOUNT_TOKEN` or `--token-stdin`.

```bash
export FELO_ACCOUNT_TOKEN="YOUR_ACCOUNT_TOKEN"
feloapi keys list
feloapi usage plan
```

## API keys

`feloapi keys list` shows the API keys on your account. Revoking a key deletes it permanently and cannot be undone:

```bash
feloapi keys list
feloapi keys revoke 123 --yes
```

`keys revoke` takes the key ID printed by `keys list`. Add `--yes` to skip the confirmation prompt, and `--token-stdin` to read the Console session token from stdin instead of the environment.

## Models and pricing

The public model catalog lists 59 models with pricing, context window, and input/output modalities.

```bash
feloapi model list
feloapi model search video
feloapi model show MODEL_ID
```

`model list` prints the catalog; `model search` filters by name, vendor, or modality; `model show` prints pricing, context, and modalities for one model.

Generate a runnable client snippet for any model:

```bash
feloapi model code --model gpt-5.6-sol --sdk openai --lang python
feloapi model code --model claude-sonnet-4-6 --sdk anthropic --lang node
feloapi model code --model gpt-5.6-sol --sdk openai --lang curl
```

`--sdk` selects the OpenAI-compatible or Anthropic-compatible wire format, and `--lang` selects Python, Node.js, or cURL. For image and video models, `model code` generates the asynchronous submit → poll → download flow instead of a single request.

## Images and video

Image and video generation is asynchronous. `generate` submits a task, polls it, and downloads the result; `get` fetches an existing task.

```bash
feloapi image generate --model IMAGE_MODEL_ID --prompt "A clean product shot of a white mug" --download ./out
feloapi image get TASK_ID --download ./out

feloapi video generate --model VIDEO_MODEL_ID --prompt "A slow drone shot over a coastline at sunrise" --download ./out
feloapi video get TASK_ID --download ./out
```

`--download DIR` saves the generated file to that directory. Add `--no-wait` to return immediately after submission; the command prints the task ID, and you can collect the result later:

```bash
feloapi video generate --model VIDEO_MODEL_ID --prompt "A slow drone shot over a coastline at sunrise" --no-wait
feloapi video get TASK_ID --download ./out
```

Replace `IMAGE_MODEL_ID`, `VIDEO_MODEL_ID`, and `TASK_ID` with values from `feloapi model list` and the generate output.

## Chat with a model

```bash
feloapi chat --model gpt-5.6-sol --message "Summarize the main files in this repository"
```

`chat` sends a single message and prints the assistant reply. Add `--raw` to print the raw API response instead of extracted text.

## Data API

The Data API exposes 25 providers and 631 endpoints, including Ahrefs, Semrush, DataForSEO, Exa, and Tavily.

```bash
feloapi data list --supplier ahrefs
feloapi data show /v1/beta/ahrefs/site-explorer/metrics
feloapi data call /v1/beta/ENDPOINT --body '{"query":"ai agents"}'
```

`data list` shows the providers and endpoints available to your account, and `data list --supplier ahrefs` narrows the list to one provider. `data show` prints query parameters, body fields, and the docs link for one endpoint. `data call` sends a request to an endpoint path with a JSON body; replace `ENDPOINT` with a path from `data list`.

## Usage

Usage commands read your Felo account and need `FELO_ACCOUNT_TOKEN`:

```bash
feloapi usage plan
feloapi usage limits
feloapi usage model --limit 20
```

| Command | What it shows |
| --- | --- |
| `usage plan` | Current plan and quota |
| `usage limits` | Rate and usage limits applied to your account |
| `usage model` | Recent per-model usage records |

`usage model` accepts `--limit`, `--offset`, `--from`, `--to`, and `--token-stdin`.

## Config

```bash
feloapi config list
feloapi config get default-model
feloapi config set default-model gpt-5.6-sol
feloapi config set output json
feloapi config unset default-model
feloapi config path
```

| Key | Purpose |
| --- | --- |
| `environment` | API environment the CLI targets |
| `default-model` | Model used when `--model` is omitted |
| `output` | Default output format |

`config path` prints the configuration file location. Values set here apply to every command, so you do not need to repeat the same flags. Pass `--output table` to `model`, `data`, `agents`, `keys`, and `skill` commands for human-readable tables; JSON remains the default output format.

## Skill management

```bash
feloapi skill list
feloapi skill update --yes
```

`skill list` shows the Skills installed for each configured agent. `skill update` refreshes them to the latest versions; in non-interactive environments add `--yes` to skip the confirmation prompt. Start a new agent session afterward so the agent loads the updated Skills.

## Exit codes and errors

| Exit code | Meaning |
| --- | --- |
| 0 | Success |
| 2 | Invalid usage or arguments |
| 3 | Authentication failed |
| 4 | Rate limited |
| 6 | Network error |
| 7 | Confirmation required; rerun with `--yes` |
| 130 | Interrupted |

Errors are written to stderr as a single JSON object:

```json
{"error":{"code":"ERROR_CODE","type":"ERROR_TYPE","message":"What went wrong","hint":"What to try next"}}
```

Scripts can branch on `code` or the exit code instead of parsing messages. To discover the full command surface as JSON, run `feloapi --introspect`.

## Use Felo tools and check your setup

After saving your key, use the existing Felo tools — Felo search, Web Fetch, slides, and LiveDocs. API requests may consume your account's quota:

```bash
feloapi search "AI agent trends" --json
feloapi web-fetch --url https://example.com --format markdown
```

Run local checks or view command help:

```bash
feloapi doctor
feloapi --help
```

`doctor` checks local configuration without making a paid API call. `doctor --online` also checks model discovery; `doctor --probe --agent codex` sends a small model request after confirmation and may incur charges.

| Issue | What to do |
| --- | --- |
| `npm` is not found or Node is too old | Install Node.js 22+ and reopen your terminal. Check `node --version`. |
| The key is rejected | Use the complete key from its creation result. Update it with `feloapi auth login`. |
| The agent still uses another provider | Run `feloapi use felo`; check project settings and explicit overrides. |
| Codex cannot reach the API | Add `--allow-network` during setup and start Codex with `codex exec -s workspace-write`. |
| Existing configuration conflicts | Review the reported files. The CLI preserves files it does not manage and files edited outside the CLI. |
| Remove a connection | Run `feloapi disconnect codex` or `disconnect claude-code`. |

`feloapi recover` restores Felo-managed configuration after a failed or interrupted setup. `feloapi auth logout` removes the local key only. To revoke a key, use the Felo Console.

For manual configuration, see the [Codex guide](https://openapi.felo.ai/docs/agent-clients/codex.md) and [Claude Code guide](https://openapi.felo.ai/docs/agent-clients/claude-code.md).
