# Run the buyer without the app

For developers. Install the gyblos command, start a local buyer from a terminal and connect a coding agent to free models without the desktop app.

Source: https://docs.gyblos.com/en/buyers/command-line

The [desktop app](/en/buyers/desktop-app) is the simplest way to use Gyblos. This page is for developers who
prefer a terminal, or who run coding agents on a machine without a desktop. The `gyblos` command runs the
same buyer the app runs, on your own computer, and serves the OpenAI and Anthropic APIs on a local address.

Your prompt reaches the seller that answers it. That seller's machine runs the model and can read your
prompt. Don't send passwords, keys or other secrets. See [Data and privacy](/en/reference/data-and-privacy).

Like the desktop app, the released buyer uploads signed receipts and content-free observations to the Gyblos
metrics collector. Receipts can't be turned off; observations can, with
[`GYBLOS_OBSERVATIONS=off`](/en/reference/data-and-privacy#observations).

This page covers free models. For paid models and API keys with a spending limit, use the
[desktop app's API keys](/en/buyers/use-from-code).

## Install

```sh
npm install -g gyblos
```

It works on macOS (Apple Silicon), Linux (x64 and arm64, glibc) and Windows 10/11 (x64). The package brings its
own runtime: npm only installs it. The buyer keeps its data in `~/.gyblos/buyer`
(`%USERPROFILE%\.gyblos\buyer` on Windows). `gyblos buyer --help` lists every buyer command.

To update, run `npm install -g gyblos@latest`.

## Set up the buyer

```sh
gyblos buyer init
```

It needs an interactive terminal. Press Enter at the first question to use any seller registered on the
network. Setup creates the buyer's identity and settings, then shows a summary and asks before saving. It
starts with a zero maximum per response, so the buyer uses free offers only. It sends no payment and changes
nothing that already exists.

## Start the buyer

```sh
gyblos buyer start
```

Keep it running while your tools use it. It listens on `http://127.0.0.1:4031`, on your computer only. The
first start creates a private token in `~/.gyblos/buyer/api-token`. Every request must carry it, and the buyer
never prints it.

Anyone who can read that file, or run programs as your user, can use your buyer. Run it only on a machine you
control. To replace the token, stop the buyer, delete the file and start it again.

## Connect a coding agent

In the shell where you start your agent, put the token in a variable, then let `gyblos` write the agent's
configuration:

```sh
export GYBLOS_API_KEY="$(cat ~/.gyblos/buyer/api-token)"
gyblos buyer agent codex --write --token-env GYBLOS_API_KEY
```

On Windows, in PowerShell:

```powershell
$env:GYBLOS_API_KEY = Get-Content "$HOME\.gyblos\buyer\api-token"
gyblos buyer agent codex --write --token-env GYBLOS_API_KEY
```

Replace `codex` with `opencode`, `pi` or `claude`. With `--write`, the command updates only the Gyblos part of
the tool's own configuration file and keeps a copy of the previous file. Without `--write`, it prints the
configuration instead. Claude Code reads its settings from the shell, so for `claude` the command prints the
lines to run there.

Other programs that speak the OpenAI or Anthropic API use the same address and token:

```sh
curl http://127.0.0.1:4031/v1/models -H "Authorization: Bearer $GYBLOS_API_KEY"
```

## Keep one paid channel

```sh
gyblos buyer existing-channel on
```

Run it with the buyer stopped, after your first paid answer has funded a channel. Your tools then use only that
channel, even after a restart. When it runs out, settles or expires, paid requests fail before any new deposit
or answer, even for the same seller. API keys can't change this. To allow a new deposit, stop the buyer and run
`gyblos buyer existing-channel off`. Setting a renewal budget with `gyblos buyer budget` also lifts this restriction.
