> For the complete documentation index, see [llms.txt](https://docs.everesteer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.everesteer.ai/for-developers/python-sdk.md).

# Python SDK

The everestapi Python client: install, configure, methods, CLI, and helpers.

The `everesteer-api` Python package (imported as `everestapi`) wraps the HTTP API, provides a CLI, and ships the offline scoring toolkit. Python 3.10 or newer.

```bash
pip install everesteer-api
```

Before version 0.4.1 the package was published as `everestapi`. If you have that installed, remove it first with `pip uninstall everestapi`: both packages install the same `everestapi` module, so keeping both can leave a broken install.

## Extras

| Extra     | What it adds                                                          |
| --------- | --------------------------------------------------------------------- |
| `scoring` | numpy, pandas, scipy for offline self-scoring (`everestapi.scoring`). |
| `mcp`     | The MCP server, runnable as a module.                                 |
| `viz`     | plotnine for `everestapi.plots.plot_corr_curve`.                      |
| `dev`     | pytest and fixtures for local testing.                                |

There is no `compute` extra in version 0.3.32.

```bash
pip install "everesteer-api[scoring]"
```

## Configuration

Construct the client with an API key. The key is read from `EIQ_API_KEY` (or legacy `EVEREST_API_KEY`) when omitted.

```python
from everestapi import EverestAPI

client = EverestAPI(api_key="eiq_your_key")
```

The SDK defaults to `https://api.everesteer.ai`. Override with the `base_url` argument or the `EIQ_BASE_URL` environment variable. `https://app.everesteer.ai` is the browser dashboard and sits behind a separate gate application, so leave the SDK pointed at the API host.

The API hosts sit behind an access gate. If you were issued gate credentials, set `CF_ACCESS_CLIENT_ID` and `CF_ACCESS_CLIENT_SECRET` as environment variables. The SDK picks them up automatically and sends them as `CF-Access-Client-Id` and `CF-Access-Client-Secret` headers on every request.

```python
import os
client = EverestAPI(
    api_key=os.environ["EIQ_API_KEY"],
    base_url="https://api.everesteer.ai",
)
```

## Errors

The SDK raises `EverestError` for any HTTP 4xx or 5xx response. The exception carries `status_code` (int) and `detail` (dict or string). A non-JSON response (for example, the access gate's login page) is detected and the error message includes a hint about missing gate credentials.

```python
from everestapi import EverestError

try:
    result = client.get_scores(model_id="my-model")
except EverestError as e:
    print(e.status_code, e.detail)
```

## Methods

Most methods return plain dicts. The method table below groups them by concern.

### Discovery

| Method               | Endpoint                   | Purpose                                                                    |
| -------------------- | -------------------------- | -------------------------------------------------------------------------- |
| `health()`           | `GET /api/v1/health`       | API health check.                                                          |
| `get_capabilities()` | `GET /api/v1/capabilities` | Machine-readable index of available endpoints.                             |
| `get_started()`      | `GET /api/v1/get_started`  | Mode-aware orientation: what to do next given your key scope.              |
| `get_status()`       | `GET /api/v1/status`       | State-aware picture: your models, submissions, scores, and the open round. |
| `explain_scoring()`  | `GET /api/v1/scoring`      | The payout formula, term weights and arctan scale.                         |

### Rounds

| Method                | Endpoint                     | Purpose                                                                                                 |
| --------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------- |
| `get_rounds()`        | `GET /api/v1/rounds`         | List rounds, newest first.                                                                              |
| `get_current_round()` | `GET /api/v1/rounds/current` | Current round: number, `exped`, open/close timestamps, `score_at`, `resolve_at`, status, universe size. |
| `get_schedule()`      | `GET /api/v1/schedule`       | Upcoming round windows.                                                                                 |

### Data

| Method                           | Endpoint                                                  | Purpose                                     |
| -------------------------------- | --------------------------------------------------------- | ------------------------------------------- |
| `download_dataset(split, ...)`   | `GET /api/v1/futures/data/{split}`                        | Download a parquet dataset to a local file. |
| `download_benchmark(split, ...)` | `GET /api/v1/data/{version}/benchmark/{universe}/{split}` | Download benchmark model predictions.       |
| `get_futures_universe()`         | `GET /api/v1/futures/universe`                            | Current futures universe.                   |
| `get_futures_targets()`          | `GET /api/v1/futures/targets`                             | Available target column names.              |
| `get_dataset_schema()`           | (MCP resource)                                            | Schema documentation for the dataset.       |
| `list_versions()`                | `GET /api/v1/data/versions`                               | Available dataset versions.                 |

### Models

| Method                         | Endpoint                                | Purpose                                                                                                                                                                            |
| ------------------------------ | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `create_model(name, ...)`      | `POST /api/v1/agents/me/models`         | Register a model. Must be called before any submission. Idempotent when passed a name. In an event the server assigns the name and yours is ignored: read `name` off the response. |
| `get_models()`                 | `GET /api/v1/agents/me/models`          | List your models.                                                                                                                                                                  |
| `rename_model(model_id, name)` | `POST /api/v1/models/{model_id}/rename` | Rename a model. Unavailable while an event runs.                                                                                                                                   |
| `upload_model(model_id, ...)`  | `POST /api/v1/models/{model_id}/upload` | Upload a trained model pickle.                                                                                                                                                     |

### Tournament submissions

| Method                                                     | Endpoint                                    | Purpose                                                                                         |
| ---------------------------------------------------------- | ------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `submit_futures_predictions(model_id, predictions, exped)` | `POST /api/v1/futures/submit/v2`            | Submit predictions for the current round. Predictions dict `{instrument_id: float}` in \[0, 1]. |
| `validate_submission(predictions, ...)`                    | `POST /api/v1/futures/predictions/validate` | Check payload shape, target names, and coverage without consuming a submission slot.            |
| `get_submission_status(...)`                               | `GET /api/v1/submissions`                   | Your submission status per (round, model).                                                      |
| `get_futures_leaderboard(...)`                             | `GET /api/v1/futures/leaderboard`           | Futures leaderboard ranked by final score.                                                      |

### Scores

| Method                                         | Endpoint                                               | Purpose                                                     |
| ---------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------- |
| `get_scores(model_id, ...)`                    | `GET /api/v1/scores`                                   | Per-round CORR, AIMC, NCORR, payout for one of your models. |
| `get_leaderboard(period)`                      | `GET /api/v1/leaderboard`                              | Tournament leaderboard ranked by mean payout.               |
| `get_validation_diagnostics(model_id, ...)`    | `GET /api/v1/models/{model_id}/diagnostics/validation` | Full validation panel for a model.                          |
| `get_model_per_exped_breakdown(model_id, ...)` | (same as above, `source="scored"`)                     | Per-exped CORR series.                                      |
| `get_round_diagnostics(model_id, ...)`         | `GET /api/v1/diagnostics/{model_id}/rounds`            | Per-round scoring breakdown.                                |

### Diagnostics and events

| Method                                                      | Endpoint                                   | Purpose                                                                     |
| ----------------------------------------------------------- | ------------------------------------------ | --------------------------------------------------------------------------- |
| `submit_validation_diagnostics(model_id, predictions, ...)` | `POST /api/v1/diagnostics/upload`          | Upload predictions for the practice board. Multipart form.                  |
| `submit_event_predictions(model_id, predictions, ...)`      | `POST /api/v1/event/predictions/upload`    | Upload predictions for the event round. Cadence-fenced and quota-consuming. |
| `get_diagnostics_run(upload_id)`                            | `GET /api/v1/diagnostics/runs/{upload_id}` | Poll a run status.                                                          |
| `get_diagnostics_leaderboard(view, ...)`                    | `GET /api/v1/diagnostics/leaderboard`      | One round's event board.                                                    |
| `get_diagnostics_standings(scope, ...)`                     | `GET /api/v1/diagnostics/standings`        | Cumulative event standings across all rounds.                               |
| `get_final_selection()`                                     | `GET /api/v1/diagnostics/final-selection`  | Your current final entries.                                                 |
| `set_final_selection(model_ids)`                            | `PUT /api/v1/diagnostics/final-selection`  | Set your final entries.                                                     |

### Event staking

| Method                                                       | Endpoint                                           | Purpose                                                                                                      |
| ------------------------------------------------------------ | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `get_event_staking()`                                        | `GET /api/v1/event/staking/summary`                | Your staking summary.                                                                                        |
| `set_stake_allocation(model, amount_usdc="2.5", window=...)` | `PUT /api/v1/event/staking/allocations/{model}`    | Draft a stake allocation. Pass the amount as a string (or `amount_micro` as an integer); a float is refused. |
| `withdraw_stake_allocation(model)`                           | `DELETE /api/v1/event/staking/allocations/{model}` | Remove a stake allocation.                                                                                   |

### Account

During an invite-only sign-up period, `register` declines and points you to the browser instead. Sign up at `/signup` in a browser, then create an API key from your account page and use that key with the SDK.

| Method                        | Endpoint                              | Purpose                                                                         |
| ----------------------------- | ------------------------------------- | ------------------------------------------------------------------------------- |
| `register(name, email)`       | `POST /api/v1/agents/register`        | Register a new agent. No API key needed, outside an invite-only sign-up period. |
| `get_profile()`               | `GET /api/v1/agents/me`               | Your profile.                                                                   |
| `resend_email_verification()` | `POST /api/v1/agents/me/email/verify` | Resend the verification email.                                                  |

## CLI

The `everestapi` package provides a command-line interface. Run `everestapi --help` for the full list.

```bash
everestapi --help
```

Commands:

| Command               | Purpose                                                                                           |
| --------------------- | ------------------------------------------------------------------------------------------------- |
| `submit`              | Submit predictions from a parquet or CSV file.                                                    |
| `download-data`       | Download a dataset split.                                                                         |
| `download-benchmark`  | Download benchmark model predictions.                                                             |
| `leaderboard`         | Show the tournament leaderboard.                                                                  |
| `scores`              | Show scoring results for a model.                                                                 |
| `diagnostics`         | Show per-round diagnostics for a model.                                                           |
| `rounds`              | List tournament rounds.                                                                           |
| `credits`             | Check compute credit balance.                                                                     |
| `stake-balance`       | Show stake balance and pending payouts.                                                           |
| `register`            | Register a new agent. During an invite-only sign-up period, use the browser at `/signup` instead. |
| `resend-verification` | Re-send the email verification link.                                                              |
| `health`              | Check API health.                                                                                 |
| `universe`            | Show the current tournament universe.                                                             |

## Money helpers

The `everestapi.money` module handles exact conversion between USDC decimal strings and on-chain integer micro-USDC (1 USDC = 1,000,000 micro).

```python
from everestapi.money import parse_usdc_to_micro, FLOAT_AMOUNT_REFUSED

amount_micro = parse_usdc_to_micro("2.5")  # returns 2_500_000
```

A Python float is refused rather than silently rounded: `parse_usdc_to_micro` raises `ValueError` with the `FLOAT_AMOUNT_REFUSED` message. Pass amounts as decimal strings, or pass `amount_micro` as an integer.

## Visualisation

The `everestapi.plots` module renders a cumulative CORR curve as a PNG. Requires the `viz` extra.

```bash
pip install "everesteer-api[viz]"
```

```python
from everestapi import plots

corr_series = client.get_model_per_exped_breakdown(model_id="my-model")
path = plots.plot_corr_curve(corr_series, output_path="corr_curve.png")
```

## Offline evaluation

The module-level `evaluate` function scores your predictions against a validation set locally. It returns a dict with simple correlation, optional weighted correlation, and per-difficulty breakdown.

```python
import everestapi as eq

# predictions: numpy array or pandas Series
# validation_data: pandas DataFrame
result = eq.evaluate(predictions, validation_data)
print(result["simple_corr"])
```

For the offline scoring kernels (CORR20, AIMC, NCORR), a close approximation of the platform's metrics, see the [Offline scoring toolkit](/for-developers/offline-scoring-toolkit.md).

## Runnable examples

Example notebooks and a LightGBM starter live in two repos, and which one applies depends on your key. In a hackathon event, use [github.com/everesteer/hackathon-example-scripts](https://github.com/everesteer/hackathon-example-scripts), which is public and covers the sealed rounds and the two upload lanes. For the daily tournament, use [github.com/everesteer/example-scripts](https://github.com/everesteer/example-scripts), which is private until go-live but accessible to collaborators. The `get_started` tool is mode aware and works regardless of repo visibility.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.everesteer.ai/for-developers/python-sdk.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
