openai-oxide for Python
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)
| File | Size | Uploaded | |
|---|---|---|---|
| openai_oxide-0.17.0.tar.gz | 21.7 MB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|