# SDK and CLI setup

> Clawifi starts Python-native today, with REST and MCP surfaces for broader agent runtimes. TypeScript agents on the Vercel AI SDK have [@clawifi/ai-sdk](https://clawifi.dev/docs/ai-sdk).

Canonical page: https://clawifi.dev/sdk

- **Install:** `pip install clawifi` installs the CLI, the MCP server (`clawifi-mcp`) and the Python SDK (`from clawifi import Clawifi`).
- **Authenticate:** Store `CLAWIFI_API_KEY` in the agent runtime.
- **Run:** Use REST, CLI, or MCP depending on your workflow.

## Python SDK

The same package, pip install clawifi, is the Python SDK. It calls the same API with the same key and reads CLAWIFI_API_KEY from the environment.

**Install**

```sh
pip install clawifi
```

**Python**

```python
from clawifi import Clawifi

client = Clawifi()
page = client.fetch("https://example.com")
results = client.search_free("Model Context Protocol")
print(client.credits())
```

## Methods

| Method | Calls |
| --- | --- |
| fetch(url, **options) | `POST /fetch` |
| scrape(url, **options) | `POST /scrape` |
| search_free(query, **options) | `POST /search/free` |
| search_content(query, **options) | `POST /search/content` |
| extract(url, **options) | `POST /extract` |
| map(url, **options) | `POST /map` |
| crawl(seed_url, **options) | `POST /crawl` |
| create_job(operation, payload) / get_job(job_id) / poll_job(job_id) | `POST /jobs`, `GET /jobs/{job_id}` |
| get_crawl(crawl_id) / poll_crawl(crawl_id) | `GET /crawls/{crawl_id}` |
| list_history() / iter_history() | `GET /history` |
| list_monitors() / iter_monitors() | `GET /monitors` |
| account() | `GET /account/me` |
| credits() | `GET /usage` |
| billing_plans() | `GET /billing/plans` |
| estimate(operation, **args) | the call with `"dry_run": true` (fetch, scrape, extract, map, crawl, search_free, search_content) |
| schema_assist(**options) | `POST /schema/assist` |
| get(path) / post(path, json=…) | any route |
| AsyncClawifi | the same methods, awaitable |
