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

# Coinbase

> Integrating with Coinbase

OpenTools cleanly integrates with **Coinbase**, covering a range of tooling from handling multiple portfolios and accounts to identifying a single order.

This provider is designed for agentic flows - using framework or model adapater - so that consumers alike are able to find their information quickly and accurately. It provides additional capabilites such as `get_portfolio_breakdown` that is unique to Coinbase, given the response structure of *Coinbase Advanced API*.

<Note>
  Coinbase support is **read-only** for now. Order placement and trade execution are not yet exposed but are currently on the [roadmap](https://www.opentools.page/roadmap)
</Note>

***

## What are the exposed tools?

The following tools are available when using the Coinbase provider:

| Tool                               | Description                                                       |
| ---------------------------------- | ----------------------------------------------------------------- |
| `coinbase_get_account`             | A single brokerage account (primary by default, or by UUID)       |
| `coinbase_list_accounts`           | All brokerage accounts for this user                              |
| `coinbase_list_portfolios`         | Available portfolios (id, name, type, deleted)                    |
| `coinbase_get_portfolio_breakdown` | Snapshot of balances + positions for a portfolio UUID             |
| `coinbase_list_positions`          | Flattened positions derived from portfolio breakdown              |
| `coinbase_list_assets`             | Brokerage products (e.g. `BTC-USD`) mapped to `Asset`             |
| `coinbase_get_asset`               | A single product by `product_id` (e.g. `BTC-USD`)                 |
| `coinbase_list_orders`             | Orders with optional filters (status, time window, symbols, side) |
| `coinbase_get_order`               | A single order by `order_id`                                      |

<Tip>
  Coinbase positions are derived from portfolio breakdown and flattened across spot/perp/futures positions where available. It is also important to note that a `Clock` is not supported since trading hours are 24/7 for crypto.
</Tip>

***

## Quick example

Below is a quick way to construct a Coinbase trading service which exposes all available tools:

```python theme={null}
import os
from opentools import trading

tools = trading.coinbase(
    api_key=os.environ["COINBASE_SECRET_KEY"],
    api_secret=os.environ["COINBASE_PEM"],
    model="openai",
    paper=False,
    minimal=True,
)
```

Once constructed, `tools` can be passed into a tool loop, like with `run_with_tools`, or bound to a framework adapter.

<Tip>
  Coinbase only uses the live option so paper has to be False otherwise it will be redirected each time.
</Tip>

***

## What are the authentication options?

Our Coinbase integrations supports multiple auth patterns:

* **API key + PEM private key** (recommended)
* **Bearer token** (pre-built token)
* **Authorization header mapping** (custom)

If you provide both API credentials *and* a bearer token, OpenTools will raise an `AuthError` to avoid ambiguous configuration. The simplest option is to provide an API key name and PEM private key. OpenTools will generate a short-lived JWT per request (signed with your PEM key) and attach it as a Bearer token automatically.

***

## What are all the configuration options?

Coinbase supports all shared Trading features:

* **Paper/live**\
  Use `paper=True` to target Coinbase’s sandbox environment.

* **Minimal**\
  Set `minimal=True` to omit provider metadata and reduce token usage.

* **Include/Exclude**\
  Control which tools are exposed to the model using `include` and `exclude`.

* **Framework binding**\
  Optionally pass `framework=langgraph` or `framework=pydanticai` to expose tools in a framework-native format.

These options behave consistently across all trading providers.

***

## Next steps

<Columns cols={2}>
  <Card title="Alpaca" icon="up" href="/trading/alpaca">
    Explore equity trading tools powered by Alpaca
  </Card>

  <Card title="Tools" icon="wrench" href="/concepts/tools">
    Learn how tools are defined and exposed in OpenTools
  </Card>
</Columns>
