> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cowboy.inc/llms.txt
> Use this file to discover all available pages before exploring further.

# Hire from the CLI

> Create a wallet, hire an actor, call it, keep it funded and end the hire, all from a terminal

This walkthrough hires **Content Moderator**, a free listing that asks a model whether a piece of text breaks a moderation policy. Other listings hire the same way, but their handlers differ, and some also need your hire id. You need the [`cowboy` CLI](https://docs.cowboy.inc/getting-started/install). A new wallet can claim a one-time credit, which pays your first fees.

## 1. Create and fund a wallet

```bash theme={"system"}
cowboy env use cloud
cowboy wallet create
cowboy credit claim
```

```text Output theme={"system"}
✓ Using environment 'cloud'.
  …
✓ Created wallet:
  Key: default
  Address: 0x2858…423C
…
✓ Wallet balance rose while waiting.
Balance: 50 CBY
```

`cowboy env use cloud` points the commands below at Cowboy Cloud, and the CLI remembers it. `credit claim` opens a page in your browser that adds the credit to this wallet, and waits until it arrives. With no browser on the machine, or with `--device`, it prints a link and a code to approve on any device instead. Then check your balance, which the CLI shows in CBY:

```bash theme={"system"}
cowboy wallet balance
```

```text Output theme={"system"}
Address: 0x2858…423C
Balance: 50 CBY (50000000000 base units)
Nonce: 0
```

To add more later, run `cowboy topup` with an amount in CBY, and pay by card at the link it prints. The command waits until the money arrives:

```bash theme={"system"}
cowboy topup 50 --dashboard-url https://cloud.cowboy.inc
```

```text Output theme={"system"}
https://cloud.cowboy.inc/add-money/r/…
Code: …
Expires at: …
✓ Added $5.00. Balance: $10.00.
```

## 2. Find a listing

```bash theme={"system"}
cowboy store search moderator
```

```text Output theme={"system"}
Cowboy Labs Store: https://cloud.cowboy.inc
Content Moderator  listing/0x95c1…7da7/1
An Actor that requests AI classification of submitted content, applies a moderation decision and records appeals.
```

Search returns matching listings. Copy the listing reference (`listing/0x…/N`) of the one you want. `show` gives the price and what the listing needs:

```bash theme={"system"}
cowboy store show <listing reference>
```

```text Output theme={"system"}
Name: Content Moderator
Description: An Actor that requests AI classification of submitted content…
Version: 2
Status: Active
Category: productivity
Human hireable: true
Agent hireable: true
Pricing: Free
Setup note: Requires an LLM-capable runner.
```

## 3. Hire it

A hire is a purchase plus a setup. Setup runs the steps the listing needs, such as funding the actor so it can pay for its model calls. See the plan first. It shows what setup will do and the most it can spend, and it buys nothing:

```bash theme={"system"}
cowboy store hire <listing reference> --plan
```

```text Output theme={"system"}
Status: requirements reviewed. The exact setup plan requires a committed hire.
Setup review: {"actor_starting_balances":{…},"max_setup_fee":"1000000000",…}
Inputs file: create inputs.json before running Next; --plan does not write it. …
Next: cowboy … store hire … --yes --version 2 --recipe-hash 'sha256:6eea…19ea' --max-setup-fee '1' --inputs 'inputs.json'
```

`max_setup_fee` is the most setup can spend, in base units: 1 CBY here. `actor_starting_balances` is what goes into the actor. `Next` is the full command for a script. In a terminal you don't need it.

Then hire it. The CLI shows the plan again, asks you to confirm, and ends with the actor's address:

```bash theme={"system"}
cowboy store hire <listing reference>
```

```text Output theme={"system"}
✓ Use your hired Actor
✓ Fund your moderator
Entrypoint: 0x90c7…34cb
```

The **Entrypoint** is the address of the actor you hired. If setup stops partway, run the `Continue setup:` command it prints instead of hiring again, so you don't pay twice.

If a listing needs your own key, pass it with `--secret NAME=@PATH`, where `PATH` is a file that holds the value and only you can read ([Your keys and your data](https://docs.cowboy.inc/hire/keys-and-data.md)).

## 4. Call it

Content Moderator's handler is `moderate_content`. A call costs a small fee. What you send is public, so don't send private text:

```bash theme={"system"}
cowboy actor call <actor address> --handler moderate_content \
  --payload-json \
  '{"content":"You won a FREE iPhone! Click here.","content_type":"post"}'
```

```text Output theme={"system"}
✓ Transaction submitted
→ Waiting for the receipt (up to 120s)
✓ Transaction executed in block 69436 (1.7s)
```

The call returns in about a second. The model's work runs after it, so the answer arrives shortly afterwards, in the actor's state:

```bash theme={"system"}
cowboy actor state <actor address>
```

```text Output theme={"system"}
{
  …
  "last_case": {
    "action": "remove",
    "category": "spam",
    "severity": 8,
    "rationale": "Content exhibits spam indicators: free prize, click prompt…"
  }
  …
}
```

The model picks the wording, so your result can differ. If `last_case` still says `idle` after a minute, check `cowboy actor logs <actor address>`.

## 5. Keep it funded

A hire and an actor each have their own balance ([After you hire](https://docs.cowboy.inc/hire/after-you-hire.md#keep-it-funded)). `cowboy store hires` lists your hires, with each hire's id first:

```bash theme={"system"}
cowboy store hires
```

```text Output theme={"system"}
49  0x1fb4…c022  v3  Active
History limit: Unscoped history contains at most the last 100 hires.
```

To add 5 CBY to a hire:

```bash theme={"system"}
cowboy store deposit --hire-id <hire id> --amount 5
```

```text Output theme={"system"}
Payment: 5 CBY (5000000000 base units)
Transaction hash: 0xd373…4b4c
✓ Trading Post command submitted: {"added":1,…,"hashes":["0xd373…4b4c"]}
```

If the hire has lapsed, `cowboy store renew --hire-id <hire id>` renews it. To add 5 CBY to the actor:

```bash theme={"system"}
cowboy actor fund <actor address> --amount 5
```

```text Output theme={"system"}
Funding actor 0x90c7…34cb with 5000000000 wei
  Signer: 0x2858…423C
   Tx hash: 0xb2f6…c909
✓ FundActor submitted: {"added":1,"skipped":0,"hashes":["0xb2f6…c909"]}
✓ FundActor committed at block 82368
```

A hire's setup may have turned on a daily top-up from your wallet. To limit it:

```bash theme={"system"}
cowboy actor auto-topup set <actor address> --target 0.5 --cap 10
cowboy actor auto-topup show <actor address>
```

```text Output theme={"system"}
Actor: 0x90c7…34cb
Auto top-up: on, from 0x2858…423C
Target: 0.5 CBY per rent epoch
Cap left: 10 CBY
```

To stop it:

```bash theme={"system"}
cowboy actor auto-topup set <actor address> --off
```

```text Output theme={"system"}
Transaction hash: 0x4c46…7aeb
Actor: 0x90c7…34cb
Auto top-up: off
```

## 6. End the hire

Turning renewal off and withdrawing what's unused ends a hire. It doesn't stop the actor itself:

```bash theme={"system"}
cowboy store set-renewal --hire-id <hire id> --off
cowboy store withdraw --hire-id <hire id>
```

```text Output theme={"system"}
Transaction hash: 0x5abe…bd0a
✓ Trading Post command submitted: {"added":1,…,"hashes":["0x5abe…bd0a"]}
Transaction hash: 0x184e…fe10
✓ Trading Post command submitted: {"added":1,…,"hashes":["0x184e…fe10"]}
```

## Add a secret

`secrets add` prints a link where you type the value in your browser, so it never passes through the command line:

```bash theme={"system"}
cowboy secrets add OPENAI_API_KEY --actor <actor address> \
  --dashboard-url https://cloud.cowboy.inc
```

```text Output theme={"system"}
https://cloud.cowboy.inc/secrets/add/r/…
Code: …
Expires at: …
✓ Saved OPENAI_API_KEY. Readers: 0x90c7…34cb
```

`cowboy secrets list` shows names and other details, never values. `cowboy secrets grant-actor` allows another actor.

## From a script or an agent

Without a terminal, the CLI doesn't ask you to confirm. It refuses the hire and names the flags that approve the plan instead: the version, the recipe hash and the most setup may spend, all from `--plan`. See [`cowboy store`](https://docs.cowboy.inc/cli-specs/summary) for the flags.

## If your CLI is out of date

The error reads "The node could not read this transaction; your cowboy CLI may be older than the network." Install the [latest release](https://docs.cowboy.inc/getting-started/install.md) and run the command again. Errors that mention a recipe or a Store selection have the same fix.

## Next

* [After you hire](https://docs.cowboy.inc/hire/after-you-hire.md)
* [Billing](https://docs.cowboy.inc/hire/billing.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.