# Infernet Client

Infernet Client is a python library as well as a CLI tool. It allows you to:

1. Interact with the [Infernet Node](https://github.com/ritual-net/infernet-node)'s REST API.
2. Interact with the [Infernet Router](https://github.com/ritual-net/infernet-router)'s REST API.
3. Create an Infernet Wallet that can:
   a. Pay for requested subscriptions
   b. Receive payments for fulfilled subscriptions.

## Installation

You can either install `infernet-client` via [`uv` (Recommended)](https://astral.sh/blog/uv) or via `pip`.

=== "uv"

    ``` bash
    uv pip install infernet-client
    ```

=== "pip"

    ``` bash
    pip install infernet-client
    ```

## Commands

You can view all commands with `--help`:

```bash
infernet-client --help
```

**Expected Output:**

```
Usage: infernet-client [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  approve        Approve a spender.
  check-model    Check model support.
  containers     List containers running in the network
  create-wallet  Create an Infernet Wallet.
  find           Find nodes running the given containers
  fund           Fund a wallet.
  health         Health check
  ids            Get job IDs for this client.
  info           Get node information.
  job            Request a job.
  resources      Get container resources.
  results        Fetch job results.
  stream         Request a streamed job.
  sub            Request a delegated subscription.
  withdraw       Withdraw tokens.
```

## Quickstart

You can interact with your Infernet Node using either the CLI or the Python library.

Here's how you can check the [server's health](https://docs.ritual.net/infernet/node/api#healthinfo):

=== "Python"

    ```python
    from infernet_client import NodeClient

    client = NodeClient("http://localhost:4000")
    is_healthy = await client.health()

    print(is_healthy)
    ```

    **Expected Output:**

    ```bash
    True
    ```

=== "CLI"

    ```bash
    export SERVER_URL=http://localhost:4000

    infernet-client health
    ```

    **Expected Output:**

    ```bash
    healthy
    ```

## Next Steps

- See examples of the available commands and options in the [Usage](usage.md) section.

- Check out the library's [source code](https://github.com/ritual-net/infernet-monorepo-internal/tree/main/libraries/infernet_client).
