Skip to main content
Portkey provides a robust and secure gateway to facilitate the integration of various Large Language Models (LLMs) into your applications, including Oracle Cloud Infrastructure (OCI) Generative AI.
Provider Slug: oracle

Portkey SDK Integration with Oracle OCI

Portkey provides a consistent API to interact with models from various providers. To integrate Oracle OCI Generative AI with Portkey:

1. Install the Portkey SDK

npm install --save portkey-ai

2. Initialize Portkey with Oracle OCI

Oracle OCI uses API key-based authentication with request signing. You’ll need the following credentials from your OCI console:
ParameterDescription
oracleRegionOCI region (e.g., us-chicago-1, eu-frankfurt-1)
oracleTenancyYour OCI tenancy OCID
oracleCompartmentIdYour OCI compartment OCID
oracleUserYour OCI user OCID
oracleFingerprintAPI key fingerprint
oraclePrivateKeyPrivate key content (PEM format)
oracleKeyPassphrase(Optional) Passphrase for encrypted private key
Add these credentials to Portkey to create your Oracle virtual key.
import Portkey from 'portkey-ai'

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
    provider: "@ORACLE_PROVIDER" // Your Oracle OCI virtual key
})

3. Invoke Chat Completions

const chatCompletion = await portkey.chat.completions.create({
    messages: [{ role: 'user', content: 'Say this is a test' }],
    model: 'cohere.command-r-plus',
});

console.log(chatCompletion.choices);

Supported Models

Oracle OCI Generative AI supports various foundation models including:
  • Cohere Models: cohere.command-r-plus, cohere.command-r, cohere.command
  • Meta Llama Models: meta.llama-3.1-405b-instruct, meta.llama-3.1-70b-instruct
For the complete list of available models, refer to the Oracle OCI Generative AI documentation.

Configuration Options

You can specify the API version using the oracleApiVersion parameter (defaults to 20231130).

Next Steps

The complete list of features supported in the SDK are available on the link below.

SDK

You’ll find more information in the relevant sections:
  1. Add metadata to your requests
  2. Add gateway configs to your Oracle requests
  3. Tracing Oracle requests
  4. Setup a fallback from OpenAI to Oracle