skillfed

openlayer

The official Python library for the openlayer API

openlayer v0.31.2 200.5K downloads/30d#9,691 on PyPI17
Permissive license Apache-2.0 Active released

What it is and what it does

Openlayer is the official Python client library for the Openlayer REST API, generated using Stainless. It wraps Openlayer's inference pipeline and project management endpoints in a typed, ergonomic interface. The library provides both Openlayer (synchronous) and AsyncOpenlayer (asynchronous) clients, both powered by httpx, with full type hints for request parameters and response objects via Pydantic models and TypedDicts.

The library is designed for developers integrating Openlayer's monitoring and data-streaming capabilities into Python applications. It handles authentication via API key, includes automatic retry logic for transient failures (connection errors, timeouts, rate limits, and 5xx responses), and offers helper methods on response objects for JSON serialization and dictionary conversion. Async usage is straightforward: import AsyncOpenlayer, use await on API calls, and optionally swap the HTTP backend to aiohttp for improved concurrency.

Use it for:

  • Stream inference pipeline data (inputs, outputs, tokens, costs, timestamps) to Openlayer for monitoring and analysis.
  • Create and manage project commits programmatically to track model and prompt changes over time.
  • Build async data pipelines that batch-upload inference results without blocking application logic.
  • Integrate Openlayer monitoring into existing Python ML workflows with full IDE autocomplete and type checking.
  • Handle API errors gracefully with typed exception hierarchy (APIConnectionError, RateLimitError, APIStatusError subclasses).

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a typed Python client for the Openlayer REST API, supporting both synchronous and asynchronous access to inference pipeline data and project management endpoints.

Yes. The library is actively maintained, has low install friction, carries no known vulnerabilities, and uses a permissive Apache-2.0 license. It is the official client for Openlayer's API and is essential if you need to integrate Openlayer monitoring into a Python application. The typed interface, async support, and automatic retries make it production-ready.

Install

openlayer on PyPI

pip

pip install openlayer

uv

uv add openlayer

poetry

poetry add openlayer

Installing openlayer

Before you install

Low install friction; pure Python wheel with 12 runtime dependencies including httpx, pydantic, and pandas. Actively maintained with a release 10 days old and recent commits. Supports Python 3.9 through 3.14.

License in practice

Apache-2.0 permissive license allows commercial use, modification, and distribution with minimal restrictions—suitable for most production and proprietary projects.

Quickstart

pip install openlayer

import os
from openlayer import Openlayer

client = Openlayer(api_key=os.environ.get("OPENLAYER_API_KEY"))
response = client.inference_pipelines.data.stream(
    inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
    config={"input_variable_names": ["user_query"], "output_column_name": "output"},
    rows=[{"user_query": "test", "output": "result"}]
)
print(response.success)

Requires OPENLAYER_API_KEY environment variable or explicit api_key parameter; Python 3.9 or later.

Verify before relying

  • Whether the library's retry behavior (2 retries by default for connection/timeout/429/5xx errors) is configurable beyond max_retries setting.
  • Performance characteristics when streaming large datasets through inference_pipelines.data.stream().
  • Whether aiohttp integration (optional extra) provides measurable concurrency improvements over default httpx backend.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 12 — anyio, distro, httpx, pandas, pyarrow, pydantic, pyyaml, requests-toolbelt, sniffio, tqdm, typing-extensions, wrapt
Maintenance actively maintained — 10 days since the last release
Last repo commit
First released
Downloads 200,517/month — #9,691 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: openlayer-0.31.2-py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: OS IndependentOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed

Tags

openlayer api client pythoninference pipeline data streamingasync rest api clienttyped api wrapperml monitoring api accessproject commit managementhttpx-based api client
api-clientasync-supportml-monitoring

More Python Modules packages