skillfed

oci-openai

OCI authentication and authorization utilities for OpenAI python SDK

oci-openai v1.1.0 125.9K downloads/30d#11,795 on PyPI32
License unclear UPL-1.0 Active released

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

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

oci-openai on PyPI

pip

pip install oci-openai

uv

uv add oci-openai

poetry

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 the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 4 — httpx, oci, openai, requests
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)

Evidence: oci_openai-1.1.0-py3-none-any.whl

Keywords: AI, Artificial Intelligence, GenAI, Generative AI, OCI, Oracle, Oracle Cloud Infrastructure

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

Tags

OCI generative AI clientOpenAI compatible OCIOCI authentication OpenAIOracle Cloud generative AIOCI model deploymentOpenAI SDK OCI integrationOCI LLM access
oci-integrationllm-clientopenai-compatible

More Python Modules packages