Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Migrating from openai-python

openai-oxide uses the same parameter names and resource structure as the official openai-python SDK. If you know the Python API, you already know openai-oxide.

Key Differences

PythonRust (openai-oxide)
client = OpenAI()let client = OpenAI::from_env()?;
client.chat.completions.create(...)client.chat().completions().create(...).await?
client.responses.create(...)client.responses().create(...).await?
stream=True parameterSeparate create_stream() method
Dict / Pydantic modelsTyped request/response structs
None for optional fieldsOption<T> with builder methods
Exception handlingResult<T, OpenAIError>

Pattern: Python to Rust

# Python
response = client.responses.create(
    model="gpt-5.4",
    input="Hello",
    max_output_tokens=100,
    temperature=0.7,
)
#![allow(unused)]
fn main() {
// Rust
let response = client.responses().create(
    ResponseCreateRequest::new("gpt-5.4")
        .input("Hello")
        .max_output_tokens(100)
        .temperature(0.7)
).await?;
}

See the OpenAI Docs Mapping for a complete endpoint cross-reference.