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.8.1

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.8.1
File Size Uploaded
gravi_model_client-0.8.1.tar.gz 37.8 kB Details

Built distribution (wheel)

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

Total release size: 66.6 kB

Release files / gravi_model_client-0.8.1.tar.gz

Download URL gravi_model_client-0.8.1.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0e8f5a3b0fa61ebd0b17be07e2f85e44e674ebf36c679c21210c1b571ccca6dc
BLAKE2b-256 checksum
How to use checksums
e5acdaa4fb5a29865d3b3eedd282122c6265995916b87228a4d88cf1eaaa55ec
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 4, 2026.

Transparency log

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

Download URL gravi_model_client-0.8.1-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c70fd209ef740607b14b846e045ee5a63d6be272b8aecedf0467bc1f22db9f27
BLAKE2b-256 checksum
How to use checksums
6cf1a575a846b5bff06e90a88727c091213f2f3af8d23ad1d4ae1c079c455fc6
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 4, 2026.

Transparency log

Release history Release notifications | RSS feed

0.11.0

2 release files

0.9.0

2 release files

This release

0.8.1 This release

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