--- id: oci-openai version: "1.1.0" license: UPL-1.0 license_treatment: unclear maintenance: active --- # oci-openai — OCI authentication and authorization utilities for OpenAI python SDK License: unclear · Maintenance: active · Downloads: 125.9K/mo ## 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 above — verify before relying. Provides OpenAI-compatible Python clients for accessing OCI Generative AI Service and OCI Data Science Model Deployment, with OCI-native authentication and authorization. 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 pip install oci-openai uv add oci-openai poetry add oci-openai ## Installing oci-openai 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). 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()) Requires OCI credentials configured (OCI CLI profile or environment). Requires valid OCI Generative AI or Data Science Model Deployment endpoint URL and compartment ID. 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_current - Install friction: low - Maintenance: active - Downloads: 125.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags OCI generative AI client, OpenAI compatible OCI, OCI authentication OpenAI, Oracle Cloud generative AI, OCI model deployment, OpenAI SDK OCI integration, OCI LLM access, oci-integration, llm-client, openai-compatible [View on SkillFed](https://skillfed.io/packages/oci-openai) · [View on PyPI](https://pypi.org/project/oci-openai/)