Skip to main content

Orthogonal Python SDK

Python SDK for calling APIs on the Orthogonal platform.

Call any API on the Orthogonal platform through one client and one credit balance — authentication, routing, and billing are handled for you.

PyPI version PyPI downloads python license

Table of Contents

Why Orthogonal

Orthogonal puts a catalog of APIs behind one account and one balance:

  • One integration — call any API on the platform through a single run() method.
  • Pay per use — a single credit balance instead of juggling dozens of provider subscriptions.
  • Sync and async — a blocking Orthogonal client and an await-able AsyncOrthogonal, both usable as context managers.
  • Typed — RunOptions / RunResponse typed dicts and full type hints.

Installation

Requires Python 3.9+.

pip install orth

Quick Start

import os
from orthogonal import Orthogonal

with Orthogonal(api_key=os.environ["ORTHOGONAL_API_KEY"]) as orthogonal:
    res = orthogonal.run(
        api="tavily",
        path="/search",
        query={"query": "latest AI news"},
    )

print(res["data"])   # the upstream API's response
print(res["price"])  # amount charged, e.g. "0.01"

Get an API key from your Orthogonal dashboard.

Authentication

Pass your key to the constructor (reading it from the environment keeps keys out of source):

orthogonal = Orthogonal(api_key=os.environ["ORTHOGONAL_API_KEY"])

Usage

GET request (query params)

res = orthogonal.run(
    api="fantastic-jobs",
    path="/v1/active-ats",
    query={"time_frame": "1h", "limit": 10},
)

POST request (JSON body)

res = orthogonal.run(
    api="some-api",
    path="/v1/generate",
    body={"prompt": "a red bicycle"},
)

Options dict instead of keyword arguments

res = orthogonal.run({
    "api": "tavily",
    "path": "/search",
    "query": {"query": "hello world"},
})

Custom headers

Headers passed to the constructor are sent on every request:

orthogonal = Orthogonal(
    api_key=os.environ["ORTHOGONAL_API_KEY"],
    headers={"x-my-trace-id": "abc123"},
)

Async Usage

AsyncOrthogonal mirrors the sync client with await and async with:

import asyncio
from orthogonal import AsyncOrthogonal

async def main():
    async with AsyncOrthogonal(api_key=os.environ["ORTHOGONAL_API_KEY"]) as orthogonal:
        res = await orthogonal.run(
            api="tavily",
            path="/search",
            query={"query": "orthogonal"},
        )
        print(res["data"])

asyncio.run(main())

Error Handling

run() returns the response on success and raises OrthogonalError on any non-2xx response (invalid key, insufficient credits, or an upstream/validation error). The message describes what went wrong.

from orthogonal import Orthogonal, OrthogonalError

try:
    res = orthogonal.run(api="tavily", path="/search", query={"query": "x"})
except OrthogonalError as err:
    print(f"request failed: {err}")

API Reference

Orthogonal(api_key, *, headers=None, base_url=...)

Argument Type Description
api_key str Required. Your Orthogonal API key (orth_live_… / orth_test_…).
headers Mapping[str, str] | None Optional headers sent on every request.
base_url str Override the API base URL (advanced).

orthogonal.run(options=None, *, api, path, query=None, body=None) → RunResponse

Call an endpoint. Pass either an options dict or keyword arguments (not both).

Argument Type Description
api str Required. The API slug (e.g. "tavily").
path str Required. The endpoint path (e.g. "/search").
query Mapping[str, JSONValue] Query parameters.
body Mapping[str, JSONValue] Request body for POST/PUT/PATCH.

RunResponse (a TypedDict)

Key Type Description
success bool Whether the call succeeded.
price str Amount charged in USD (e.g. "0.01").
data JSONValue The upstream API's response.

AsyncOrthogonal(...)

Same constructor and run(...) signature as Orthogonal, but run() is a coroutine (await) and the client supports async with / await client.close().

OrthogonalError

Raised by run() on a non-2xx response. Subclass of Exception; str(err) is a human-readable message.

Both clients are context managers — use with / async with (or call close()) so the underlying HTTP connection is released.

Related

  • @orth/cli — the Orthogonal command-line tool.
  • @orth/sdk — the official TypeScript/JavaScript SDK.

License

MIT © Orthogonal

Release files for orth 0.1.2

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

Source distribution (sdist)

Source distribution for orth 0.1.2
File Size Uploaded
orth-0.1.2.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orth 0.1.2
File Interpreter ABI Platform
orth-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 18.2 kB

Release files / orth-0.1.2.tar.gz

Download URL orth-0.1.2.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4497350cae1462e2c3b0808bc9ccaae38c495cf4fd7d2454aba5588c8ecccfab
BLAKE2b-256 checksum
How to use checksums
73397861302e6bfe9d6577220f9ee30fd81b60f9367b151c9ec6b6b14d749c81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 5, 2026.

Transparency log

Release files / orth-0.1.2-py3-none-any.whl

Download URL orth-0.1.2-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0f567dceb70d45c5e08a16c725ac22010cfda3f0114164bda7951e3118fb3286
BLAKE2b-256 checksum
How to use checksums
cce92596d6762d0cd5f771312406b6507df7c3cb7c8a613759d0fef569cd1228
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 Jul 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

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