Enable extended reasoning for complex tasks using the reasoning_effort parameter:
response = client.chat.completions.create( model="claude-sonnet-4-6", messages=[{"role": "user", "content": "Solve step by step: what is 23! / 20!?"}], reasoning_effort="high",)# Access the reasoning output (if the model returns it)if response.choices[0].message.reasoning_content: print(f"Reasoning: {response.choices[0].message.reasoning_content}")print(f"Answer: {response.choices[0].message.content}")
You can also pass provider-specific parameters through extensions:
Valid metadata fields: user_id, tags (list), trace_id, and custom_fields (dict for arbitrary key-value pairs). See the Python SDK Reference for field constraints.
with client.chat.completions.create( model="gpt-5.4", messages=[{"role": "user", "content": "Count to 10"}], stream=True) as stream: for chunk in stream: if chunk.choices and chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True)# stream is automatically closed
Or close manually with stream.close().
Routing metadata, usage, and response headers are available only after consuming all chunks.
See Streaming Guide for full patterns including tool call streaming.
Error objects also carry response_headers. Use e.response_headers.request_id when filing support tickets to correlate with server logs.See the Python SDK Reference for the complete ResponseHeaders API.
Availability depends on the provider. completion_tokens_details.reasoning_tokens is present for OpenAI o-series, DeepSeek, xAI, and Google Gemini. It’s None for providers that don’t report reasoning token counts (Anthropic, Moonshot, Fireworks).See Check reasoning token availability for the full breakdown.
AurikoAsyncOpenAI (experimental) is an AsyncOpenAI subclass that captures routing metadata automatically. Pass it to any framework that accepts an external AsyncOpenAI instance. The kwarg name varies across frameworks.Install with the optional openai-compat extra:
last_routing_metadata is a single-slot property. Under concurrent use it reflects the most recent response. For per-request capture, pass an on_response callback:
LangChain takes the chat.completions resource rather than the full client. LangChain and LlamaIndex both still require an api_key argument for their own parent-class construction; pass any placeholder value.For the Agents SDK path, see OpenAI Agents SDK. For the full class reference, see AurikoAsyncOpenAI.
Use AurikoAsyncOpenAI when a framework needs an AsyncOpenAI instance. Use auriko.AsyncClient for direct Python code. AsyncClient exposes routing_metadata directly on each response, so you do not need to read a separate client-level property.
AurikoAsyncOpenAI is Python-only. TypeScript consumers can use @auriko/ai-sdk-provider with the Vercel AI SDK, or the OpenAI TS SDK with baseURL: 'https://api.auriko.ai/v1'.
The Auriko SDK covers: inference (chat completions and the Response API, both with routing), identity, and model discovery. For full platform operations, use the REST API directly.