Metadata-Version: 2.5
Name: spavik
Version: 0.1.2
Summary: Prediction API for Python apps: create a model from your data in one call, then predict churn, conversions, prices, delivery times or demand. No ML stack to build.
Project-URL: Homepage, https://spavik.co
Project-URL: Documentation, https://docs.spavik.co/libraries/python
Project-URL: Repository, https://github.com/spavik-co/spavik-python-sdk
Project-URL: Issues, https://github.com/spavik-co/spavik-python-sdk/issues
Project-URL: Changelog, https://github.com/spavik-co/spavik-python-sdk/blob/main/CHANGELOG.md
Project-URL: Use cases, https://spavik.co/use-cases
Project-URL: Pricing, https://spavik.co/pricing
Author-email: Spavik <admin@spavik.co>
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: ai-agents,api-client,automl,churn-prediction,classification,forecasting,lead-scoring,machine-learning,mcp,prediction,prediction-api,predictive-analytics,regression,sdk,spavik,tabular-data,time-series
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Office/Business
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.24
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: respx>=0.20; extra == 'dev'
Requires-Dist: twine>=5; extra == 'dev'
Provides-Extra: pandas
Requires-Dist: pandas>=1.3; extra == 'pandas'
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://spavik.co">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://docs.spavik.co/logo-dark.svg">
      <img src="https://docs.spavik.co/logo-light.svg" alt="Spavik" width="180">
    </picture>
  </a>
</p>

# Spavik for Python: predictions in your app, without an ML stack

[![PyPI](https://img.shields.io/pypi/v/spavik.svg)](https://pypi.org/project/spavik/)
[![Python versions](https://img.shields.io/pypi/pyversions/spavik.svg)](https://pypi.org/project/spavik/)
[![CI](https://github.com/spavik-co/spavik-python-sdk/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/spavik-co/spavik-python-sdk/actions/workflows/ci.yml)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/spavik-co/spavik-python-sdk/blob/main/LICENSE)

[Spavik](https://spavik.co) is a prediction API for developers and AI agents.
You send the history your application already keeps, such as past customers,
leads, orders or shipments, and Spavik creates a model from it in one call.
Your code then asks the questions that matter to the business: will this
customer cancel, will this lead buy, what will this house sell for, how many
orders will come in tomorrow.

There is no model to design, host or retrain by hand. This package is the
official Python client: it handles authentication, retries, safe replays and
data conversion, so a prediction is a method call.

```sh
pip install spavik
```

## A first prediction in five minutes

1. Create a free account on [spavik.co](https://spavik.co) and copy your API key
   from the dashboard. No credit card is required.
2. Export it: `export SPAVIK_API_KEY="sk-spv-api-..."`
3. Download [churn.csv](https://github.com/spavik-co/spavik-python-sdk/blob/main/examples/data/churn.csv),
   120 synthetic customers with their plan, seats, support tickets and whether
   they cancelled.
4. Run this script beside the file:

```python
from spavik import Spavik

with Spavik() as client:
    # Free: does this table say anything about churn?
    report = client.evaluate("churn.csv", target="churn")
    print(report["assessment"]["message"])

    # Free: create a model from the 120 past customers.
    model = client.train("churn.csv", target="churn")

    # One credit: will this customer cancel?
    result = model.predict({"plan": "pro", "seats": 12, "tickets_90d": 2})
    print(result.predictions)
```

Keep `model.id`: the model stays available, and later predictions reuse it
without training again.

## What you can predict

Anything your history already records the answer to. Each guide below comes
with a dataset and complete code.

| Question your app asks | Answer | Guide |
|---|---|---|
| Will this customer cancel? | yes or no, with a probability | [Churn prediction](https://spavik.co/use-cases/churn-prediction) |
| Will this lead become a customer? | yes or no, with a probability | [Lead conversion](https://spavik.co/use-cases/lead-conversion-prediction) |
| What will this property sell for? | a number | [House prices](https://spavik.co/use-cases/house-price-prediction) |
| How many hours will this parcel take? | a number | [Delivery times](https://spavik.co/use-cases/delivery-time-prediction) |
| How many orders tomorrow? | the next values of a series | [Order forecast](https://spavik.co/use-cases/order-forecast) |
| What will tomorrow's peak demand be? | the next values of a series | [Electricity demand](https://spavik.co/use-cases/electricity-demand-forecast) |

Forecasting needs no model at all: send the series and the number of steps.

```python
forecast = client.forecast("sales.csv", target="sales", horizon=7)
print(forecast.points)
```

## How a model lives

`evaluate` tells you, for free, whether the data can predict the column you
chose and how it compares with a simple guess. `train` creates the model, also
for free. `predict` scores new rows and is, with `forecast`, the only billed
step. Once the real outcome is known, `model.submit_outcomes(...)` reports it,
`model.performance()` shows how the predictions held up, and `model.refresh()`
folds the new examples into the model.

Training needs at least 100 rows, and results are usually limited below 200.
Reaching that size improves the odds without promising a good model, which is
why the evaluation comes first.

## Plans

The Free plan includes 100 predictions per calendar month, reset on the 1st at
00:00 UTC, and one active model. Training, evaluation and backtests are free on
every plan. Paid plans and their limits are on the
[pricing page](https://spavik.co/pricing).

## Works with your data and your agents

Pass a CSV path, CSV or JSON text, a dict, a list of dicts or a pandas
DataFrame (`pip install "spavik[pandas]"`). Dates, `Decimal` and missing values
are converted for you. `AsyncSpavik` offers the same methods for asyncio
applications.

If you build with an AI agent, the same operations are available as tools from
the [Spavik MCP server](https://spavik.co/mcp-integration), and a
[TypeScript SDK](https://www.npmjs.com/package/spavik) covers Node.js and edge
runtimes.

## Documentation

- [Python guide](https://docs.spavik.co/libraries/python)
- [Quickstart](https://docs.spavik.co/start) and [API reference](https://docs.spavik.co)
- [Changelog](https://github.com/spavik-co/spavik-python-sdk/blob/main/CHANGELOG.md)
- [Report an issue](https://github.com/spavik-co/spavik-python-sdk/issues)

The API may still change before 1.0, and breaking changes are listed in the
changelog. Contributions are welcome, see
[CONTRIBUTING.md](https://github.com/spavik-co/spavik-python-sdk/blob/main/CONTRIBUTING.md).

## License

[Apache-2.0](https://github.com/spavik-co/spavik-python-sdk/blob/main/LICENSE)
