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

# Agents Quickstart

> Create an agent wallet, fund it, and make a paid API call.

## 1. Install the CLI

```bash theme={null}
npm install -g @anyway-sh/cli
```

## 2. Create your first agent wallet

```bash theme={null}
anyway login --agent-wallet
```

This opens one browser flow that:

1. signs you in;
2. creates the owner wallet if needed;
3. creates an agent wallet; and
4. securely returns the Agent Wallet Key to the CLI.

<Warning>
  The key is revealed once. Store the downloaded backup securely and never commit it, paste it into chat, or include it in logs.
</Warning>

For a non-interactive environment, begin the device flow and resume it after the owner approves:

```bash theme={null}
anyway login --agent-wallet --non-interactive
anyway login --continue
anyway wallets agents create --continue
```

Run both continuation commands in order; the first completes login and the second saves the Agent Wallet Key. Repeat a continuation command while its status is pending.

## 3. Fund the wallet

Open [Agent Wallets](https://app.anyway.sh/wallets?view=agent), then:

1. add funds to the buffer balance;
2. select **Distribute funds**;
3. choose the agent wallet and amount.

Credits and USDC are different:

* Credits are shared by the organization and are used first for eligible SuperAPI calls.
* USDC is allocated to a specific agent wallet.

## 4. Confirm the agent identity

```bash theme={null}
export ANYWAY_AGENT_WALLET_KEY="<your key>"
anyway wallets agents whoami
anyway wallets agents policies
anyway wallets agents credit-balance
```

`whoami` identifies the agent and wallet. `credit-balance` reports the organization's USD Credits, not the wallet's USDC balance.

## 5. Discover and call a paid API

```bash theme={null}
curl https://marketplace-prod.anyway.sh/v1/api/directory
curl https://marketplace-prod.anyway.sh/v1/api/info/{upstream_id}
```

Use the directory entry's `id` as `upstream_id`, then copy the callable x402 URL from the info response's `curl_x402` field:

```bash theme={null}
anyway superapi call "<x402 endpoint URL>"
```

The CLI makes the initial request, reads the 402 quote, asks for confirmation, signs the payment, retries the call, and prints the API response.

<Warning>
  Use `--yes` only in an agent runtime where automatic approval is intentional. Wallet balance and spending policies remain the final guardrails.
</Warning>
