Skip to main content

gravi-model-client

Python client for Gravitate's demand and supply optimization models.

Installation

pip install gravi-model-client

Usage

from gravi_model_client import GraviModelClient, ModelRunRequest, OptimizationInput

async with GraviModelClient(api_key="your-api-key", base_url="https://...") as client:
    # Health check
    await client.health_check()

    # Run demand model (synchronous)
    result = await client.run_demand_model(request)

    # Run TSD (supply) model (synchronous)
    result = await client.run_tsd_model(optimization)

Async (queue-based) models: VRP and OSA

VRP (tank wagon turn) and OSA (order-based supply) runs are queued and processed by a worker. run_vrp_model / run_osa_model handle the whole queue → poll → fetch lifecycle and block until the result is ready:

from gravi_model_client import GraviModelClient, VrpModelRunRequest, OsaInput

async with GraviModelClient(api_key="your-api-key") as client:
    vrp_result = await client.run_vrp_model(vrp_request)   # -> VrpModelResultResponse
    osa_result = await client.run_osa_model(osa_input)     # -> OsaAPIResponse

They raise ModelRunError if the run fails or is cancelled, and ModelRunTimeout if it doesn't finish within timeout (default 300s; tune poll_interval too).

For fire-and-forget / webhook workflows, use the primitives instead: queue_vrp_model returns a job id, get_job_status / get_osa_job_status return a JobStatus, and get_vrp_model_run_response / get_osa_model_run_response fetch the finished result.

Models

This package is the single source of truth for all pydantic models used by both the client and the server. Import models directly:

from gravi_model_client.demand import ModelRunRequest, StoreRequest, TankRequest, VolumeRange
from gravi_model_client.tsd import OptimizationInput, Directive, Site, Tank

Metadata

Release files for gravi-model-client 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gravi-model-client 0.9.0
File Size Uploaded
gravi_model_client-0.9.0.tar.gz 38.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gravi-model-client 0.9.0
File Interpreter ABI Platform
gravi_model_client-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.6 kB

Release files / gravi_model_client-0.9.0.tar.gz

Download URL gravi_model_client-0.9.0.tar.gz
Size 38.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c2a8c2dd039f8967b4e6d56a564975a3d0d255bba37e09c876bf06c298a56416
BLAKE2b-256 checksum
How to use checksums
0f779f5cf6e1e91814d9f01c94baaaa4d87a541f07bdb78da5248b543fa50f19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release files / gravi_model_client-0.9.0-py3-none-any.whl

Download URL gravi_model_client-0.9.0-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14b2ed8471ddd61c884d54bacb1ee22a168dd3483cc05bc3872b46d81eb7ddc6
BLAKE2b-256 checksum
How to use checksums
d51a42de93d7a9e43e24f9a576b1a2191b93b8cb765fe401f66ec94580721b10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 5, 2026.

Transparency log

Release history Release notifications | RSS feed

0.11.0

2 release files

This release

0.9.0 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page