Skip to main content

openai-oxide for Python

PyPI PyPI downloads

Python bindings for openai-oxide — the fastest OpenAI client. Also available on crates.io (Rust) and npm (Node.js).

Rust core compiled to native Python extension via PyO3 + maturin.

Install

pip install openai-oxide
# or
uv pip install openai-oxide
# or
uv add openai-oxide

For local development (requires Rust toolchain):

cd openai-oxide-python
uv sync
uv run maturin develop --release

Usage

import asyncio, json
from openai_oxide import Client

async def main():
    client = Client()  # reads OPENAI_API_KEY env var

    # Simple
    r = await client.create("gpt-4o-mini", "Hello!")
    print(r["text"])

    # Streaming
    stream = await client.create_stream("gpt-4o-mini", "Explain quantum computing...", max_output_tokens=200)
    async for event in stream:
        print(event)

    # Structured output
    schema = json.dumps({
        "type": "object",
        "properties": {"answer": {"type": "integer"}},
        "required": ["answer"],
        "additionalProperties": False
    })
    r = await client.create_structured("gpt-4o-mini", "What is 7*8?", "math", schema)
    print(json.loads(r["text"])["answer"])  # 56

    # Function calling
    tools = json.dumps([{
        "name": "get_weather",
        "description": "Get weather",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
            "additionalProperties": False
        }
    }])
    r = await client.create_with_tools("gpt-4o-mini", "Weather in Tokyo?", tools)
    print(r["function_calls"])

asyncio.run(main())

Test

uv run python test_oxide.py

Benchmarks

Run uv run python examples/bench_python.py to compare against the official openai SDK.

See the main README for full benchmark results.

Metadata

Release files for openai-oxide 0.17.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 openai-oxide 0.17.0
File Size Uploaded
openai_oxide-0.17.0.tar.gz 21.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for openai-oxide 0.17.0
File Interpreter ABI Platform
openai_oxide-0.17.0-cp314-cp314-macosx_11_0_arm64.whl CPython 3.14 CPython 3.14 macOS 11.0+ ARM64 Details
openai_oxide-0.17.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
openai_oxide-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details

Total release size: 29.8 MB

Release files / openai_oxide-0.17.0.tar.gz

Download URL openai_oxide-0.17.0.tar.gz
Size 21.7 MB
Tags Source
SHA-256 checksum
How to use checksums
2dbfe420320fc2c7bc1204a7453606c920cc316479bc7039e4468c2b4659478a
BLAKE2b-256 checksum
How to use checksums
3ca259a19b70bac7a0d70c7298fc7119021afdbd24fc111b02d0d394ecb611b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / openai_oxide-0.17.0-cp314-cp314-macosx_11_0_arm64.whl

Download URL openai_oxide-0.17.0-cp314-cp314-macosx_11_0_arm64.whl
Size 2.6 MB
Tags CPython 3.14 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
ac88cc947ab000a133ce03cc80320cbe4c279d617a65b220e1ae6713be64bc26
BLAKE2b-256 checksum
How to use checksums
d2bd09f99bb69c2f8b3fa8e6dec5ad663a333568f2f670ca079ee13fa3836896
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / openai_oxide-0.17.0-cp312-cp312-win_amd64.whl

Download URL openai_oxide-0.17.0-cp312-cp312-win_amd64.whl
Size 2.5 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
cbd7ea2c36198916d2aaf8e796bacc07efda3c8a050d10939821afc20014604b
BLAKE2b-256 checksum
How to use checksums
65a931232896486da3dcbf1a67c6ba085fd0663fad076ffdb20f501878d00b1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / openai_oxide-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL openai_oxide-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.0 MB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
c6f32afb82c571badc6305d82f905b008635b2b250d3f14c9578d10a6eef9a0a
BLAKE2b-256 checksum
How to use checksums
dba8ff783468228bd196754b1d895753baae63a808c209b0e9dcbef0e9305ea1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.17.0 This release

4 release files

0.11.2

4 release files

0.11.1

4 release files

0.9.8

4 release files

0.9.7

4 release files

0.9.6

4 release files

0.9.5

4 release files

0.9.4

4 release files

0.9.3

4 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

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