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.

Download files

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

Source Distribution

openai_oxide-0.17.0.tar.gz (21.7 MB view details)

Uploaded Source

Built Distributions

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

openai_oxide-0.17.0-cp314-cp314-macosx_11_0_arm64.whl (2.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

openai_oxide-0.17.0-cp312-cp312-win_amd64.whl (2.5 MB view details)

Uploaded CPython 3.12Windows x86-64

openai_oxide-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file openai_oxide-0.17.0.tar.gz.

File metadata

  • Download URL: openai_oxide-0.17.0.tar.gz
  • Upload date:
  • Size: 21.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for openai_oxide-0.17.0.tar.gz
Algorithm Hash digest
SHA256 2dbfe420320fc2c7bc1204a7453606c920cc316479bc7039e4468c2b4659478a
MD5 5b59c1a8802435903e371c9fee5d716e
BLAKE2b-256 3ca259a19b70bac7a0d70c7298fc7119021afdbd24fc111b02d0d394ecb611b6

See more details on using hashes here.

File details

Details for the file openai_oxide-0.17.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for openai_oxide-0.17.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ac88cc947ab000a133ce03cc80320cbe4c279d617a65b220e1ae6713be64bc26
MD5 8eac2f9e6d39bf1f49ec49594b6bef4b
BLAKE2b-256 d2bd09f99bb69c2f8b3fa8e6dec5ad663a333568f2f670ca079ee13fa3836896

See more details on using hashes here.

File details

Details for the file openai_oxide-0.17.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for openai_oxide-0.17.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 cbd7ea2c36198916d2aaf8e796bacc07efda3c8a050d10939821afc20014604b
MD5 e5105a87b3c8a54a4dd855c66857d4d8
BLAKE2b-256 65a931232896486da3dcbf1a67c6ba085fd0663fad076ffdb20f501878d00b1e

See more details on using hashes here.

File details

Details for the file openai_oxide-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for openai_oxide-0.17.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c6f32afb82c571badc6305d82f905b008635b2b250d3f14c9578d10a6eef9a0a
MD5 df12e28b055afb8352118a48b92f6cae
BLAKE2b-256 dba8ff783468228bd196754b1d895753baae63a808c209b0e9dcbef0e9305ea1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.17.0 This release

4 files

0.11.2

4 files

0.11.1

4 files

0.9.8

4 files

0.9.7

4 files

0.9.6

4 files

0.9.5

4 files

0.9.4

4 files

0.9.3

4 files

0.9.2

2 files

0.9.1

2 files

0.9.0

2 files

0.1.0

2 files

Supported by

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