oci-openai
OCI authentication and authorization utilities for OpenAI python SDK
Decision gist · record as of 2026-08-14
Yes, if you are already using OCI infrastructure and need OpenAI-compatible access to OCI Generative AI or Data Science models. The package is actively maintained, has low install friction, and supports current Python versions. Verify that UPL-1.0 licensing is acceptable for your use case, and confirm you have OCI credentials and the correct endpoint URL before installing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires OCI credentials configured (OCI CLI profile or environment).
- Requires valid OCI Generative AI or Data Science Model Deployment endpoint URL and compartment ID.
- Low install friction with a pure-Python wheel.
License · maintenance · safety
UPL-1.0 (unclear) — Licensed under UPL-1.0 (Oracle Public License), classified as unclear treatment. Verify compatibility with your project's license policy before use.
last release 2026-02-03 (192 days) · last repo commit 2026-06-30 · 32 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 125,879 downloads/mo, #11,795 on PyPI
Alternatives
Verify before relying
pip install oci-openai
from oci_openai import OciOpenAI, OciSessionAuth
client = OciOpenAI(
base_url="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/v1",
auth=OciSessionAuth(profile_name=""),
compartment_id="",
)
completion = client.chat.completions.create(
model="",
messages=[{"role": "user", "content": "Your prompt here"}],
)
print(completion.model_dump_json())- Whether UPL-1.0 is compatible with common commercial or copyleft licensing schemes in your organization.
- Whether OCI API key authentication (alternative mentioned in docs) is preferable for your use case versus this package's principal-based auth.
- Performance and rate-limit behavior under production load.
What it is and what it does
oci-openai bridges the OpenAI Python SDK with OCI's Generative AI and Data Science Model Deployment services using OCI-native authentication. It wraps httpx and the openai library to inject OCI credentials (session-based, user principal, or resource principal) into requests, allowing you to use familiar OpenAI API patterns (chat.completions.create, async clients) against OCI endpoints instead of OpenAI's.
The package supports both synchronous (OciOpenAI) and asynchronous (AsyncOciOpenAI) clients, and can patch the native openai SDK's http client for use with frameworks like langchain-openai. It targets OpenAI, xAI Grok, and Meta Llama models hosted on OCI, and works with both OCI Generative AI endpoints and custom model deployments via OCI Data Science.
Use it for
- Migrate existing OpenAI SDK code to OCI Generative AI without rewriting API calls, using OCI IAM for authentication.
- Build LLM applications on OCI with resource-level or workload-level authentication (e.g., OKE pods, compute instances).
- Integrate OCI-hosted models into langchain or other frameworks that accept a custom http_client.
- Deploy inference against custom models in OCI Data Science Model Deployment using OpenAI-compatible chat and completion APIs.
- Avoid managing separate API keys by leveraging OCI principal authentication across your infrastructure.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are already using OCI infrastructure and need OpenAI-compatible access to OCI Generative AI or Data Science models.
The package is actively maintained, has low install friction, and supports current Python versions. Verify that UPL-1.0 licensing is acceptable for your use case, and confirm you have OCI credentials and the correct endpoint URL before installing.
Install
oci-openai on PyPI
Before you install
Low install friction with a pure-Python wheel. Active maintenance with recent commits (last commit 2026-06-30). Supports current Python versions (3.9–3.12).
Requires OCI credentials configured (OCI CLI profile or environment). Requires valid OCI Generative AI or Data Science Model Deployment endpoint URL and compartment ID.
License in practice
Licensed under UPL-1.0 (Oracle Public License), classified as unclear treatment. Verify compatibility with your project's license policy before use.
Quickstart
pip install oci-openai
from oci_openai import OciOpenAI, OciSessionAuth
client = OciOpenAI(
base_url="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/v1",
auth=OciSessionAuth(profile_name=""),
compartment_id="",
)
completion = client.chat.completions.create(
model="",
messages=[{"role": "user", "content": "Your prompt here"}],
)
print(completion.model_dump_json())
Verify before relying
- Whether UPL-1.0 is compatible with common commercial or copyleft licensing schemes in your organization.
- Whether OCI API key authentication (alternative mentioned in docs) is preferable for your use case versus this package's principal-based auth.
- Performance and rate-limit behavior under production load.
Package facts
| License | UPL-1.0 unclear |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 4 packageshttpxociopenairequests |
| Maintenance | Actively maintained 192 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 125,879 / month, #11,795 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python ModulesTopic :: System :: BenchmarkTyping :: Typed |
Evidence: oci_openai-1.1.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “OCI generative AI client”
- oci-openaiProvides OpenAI-compatible Python clients for accessing OCI…
- langchain-ociIntegrates LangChain with Oracle Cloud Infrastructure (OCI) services,…
- coherePython SDK for accessing Cohere's language models across multiple…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also langchain-oci · oci · oci-cli · openai · sap-ai-sdk-gen · generative-ai-hub-sdk · oras · ocifs · agent-framework-openai · litellm