Skip to main content

Official Python SDK for the Viewrium API. Create and manage 3D models, api keys, and usage records.

Project description

viewrium

Official Python SDK for the Viewrium API. Create and manage 3D models, API keys, and usage records.

Install

pip install viewrium

Python 3.10+.

Configure

import viewrium
viewrium.api_key = "sk_live_..."

Or via environment variable:

export VIEWRIUM_API_KEY=sk_live_...

Both are supported; the module variable wins if both are set.

Other config (all optional):

Variable Env Default
viewrium.api_base VIEWRIUM_API_BASE https://api.viewrium.com
viewrium.timeout - 60 seconds
viewrium.max_retries - 3 (retries 429 / 5xx, respects Retry-After)

Quickstart (sync)

import viewrium

viewrium.api_key = "sk_live_..."

model = viewrium.Model.create(
    custom_id="sku-1",
    images=["https://example.com/img1.jpg", "https://example.com/img2.jpg"],
    height=90,
    tags=["chair", "summer-2026"],
)
print(model.id, model.status)

models = viewrium.Model.list(tag="chair", limit=20)
for m in models.data:
    print(m.custom_id, m.status)

Quickstart (async)

import asyncio
import viewrium

viewrium.api_key = "sk_live_..."

async def main():
    model = await viewrium.AsyncModel.create(
        custom_id="sku-1",
        images=["https://example.com/img1.jpg"],
        height=35,
        size_unit="in",  # converted to cm server-side
    )
    events = await viewrium.AsyncModel.list_events(model.id)
    return model, events

asyncio.run(main())

Resources

Each resource has a sync class and an Async-prefixed async twin.

Sync Async Methods
Model AsyncModel create, create_from_images, create_from_video, retrieve, list, modify, delete, list_events
ApiKey AsyncApiKey create, list, delete
Usage AsyncUsage retrieve
Tag AsyncTag list

Uploading files

model = viewrium.Model.create_from_images(
    ["./chair-front.jpg", "./chair-side.jpg", "./chair-back.jpg"],
    custom_id="sku-1",
    height=90,
    tags=["chair"],
)

model = viewrium.Model.create_from_video(
    "./chair-walkaround.mp4",
    custom_id="sku-2",
    height=92,
)

Paths are strings or pathlib.Path. Files are opened + closed by the SDK.

Sizing

Pass height + optional size_unit ("cm" or "in", default "cm"). The server normalizes to cm before storing. Explicit height wins over scraped values; if neither is present, the model renders unscaled.

Errors

from viewrium import (
    ViewriumError,       # base class
    AuthError,           # 401 / missing key
    NotFoundError,       # 404
    ValidationError,     # 400 / 409 / 422
    RateLimitError,      # 429 (has .retry_after)
    APIError,            # 5xx / other
)

try:
    viewrium.Model.retrieve("not-a-real-id")
except NotFoundError:
    ...
except RateLimitError as e:
    print("back off for", e.retry_after, "seconds")

Cleanup

The SDK lazily opens HTTP clients and tears them down on process exit. If you need to close eagerly:

viewrium.close()           # sync client
await viewrium.aclose()    # async client

License

Apache 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

viewrium-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

viewrium-0.1.0-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file viewrium-0.1.0.tar.gz.

File metadata

  • Download URL: viewrium-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for viewrium-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ea80823d37c82f1f29a8eb8ebfd9fbf07e4b53ec01d4f3b2b63de200232414ec
MD5 476cf47fa0bb2e2f10507300d8223cfa
BLAKE2b-256 aff92ce373b12cbcac90c2eedbb521cae8641a9dbcf7b7d9dc46caecd90da9f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for viewrium-0.1.0.tar.gz:

Publisher: publish-sdk-python.yml on davidzagyvaig/viewrium

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file viewrium-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: viewrium-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for viewrium-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de93288e1e9d92d8c9b828ea441aa0496af58f11701ee8b3b7496c5ff41b0c89
MD5 93e8439a6711e228b5a7f762534b08b6
BLAKE2b-256 6008ca310c0331831cf4f43decda73627df0885f73269be11679755913bb5566

See more details on using hashes here.

Provenance

The following attestation bundles were made for viewrium-0.1.0-py3-none-any.whl:

Publisher: publish-sdk-python.yml on davidzagyvaig/viewrium

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page