Skip to main content

Drop-in OpenAI SDK shim for EvalOps llm-gateway routing

Project description

evalops-openai

Drop-in OpenAI SDK shim for routing OpenAI-compatible requests through EvalOps llm-gateway with organization scope, principal attribution, audit, metering, and governance hooks.

This package is the first G1 wedge from evalops/platform#1133. It deliberately wraps the official OpenAI SDKs instead of reimplementing OpenAI wire formats.

Python

pip install evalops-openai
from evalops_openai import OpenAI

client = OpenAI(
    organization_id="org_123",
    principal="user:ada@example.com",
)

response = client.chat.completions.create(
    **client.with_provider_ref(
        {
            "model": "gpt-4.1-mini",
            "messages": [{"role": "user", "content": "hello"}],
        }
    )
)

Node

npm install @evalops/openai
import { OpenAI } from "@evalops/openai";

const client = new OpenAI({
  organizationId: "org_123",
  principal: "user:ada@example.com",
});

const response = await client.chat.completions.create(
  client.withProviderRef({
    model: "gpt-4.1-mini",
    messages: [{ role: "user", content: "hello" }],
  }),
);

Environment

  • EVALOPS_API_KEY or OPENAI_API_KEY: Platform-issued bearer token.
  • EVALOPS_ORGANIZATION_ID: organization scope stamped into gateway requests.
  • EVALOPS_PRINCIPAL: optional actor string for audit attribution.
  • EVALOPS_TRACE_ID: optional trace correlation ID.
  • EVALOPS_LLM_GATEWAY_URL: defaults to https://llm-gateway.internal.evalops.dev/v1.
  • EVALOPS_PROVIDER_ENVIRONMENT: defaults to prod.
  • EVALOPS_PROVIDER_CREDENTIAL_NAME: optional provider ref credential name.
  • EVALOPS_PROVIDER_TEAM_ID: optional provider ref team ID.

Current Gateway Constraint

The current llm-gateway contract requires provider_ref in the JSON body for /v1/chat/completions and /v1/responses. The helpers above inject that field while preserving the vendor SDK surface. Once the gateway can infer a default provider ref from the authenticated principal, the helper call can disappear and the package becomes import-only migration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

evalops_openai-0.2.1.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

evalops_openai-0.2.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file evalops_openai-0.2.1.tar.gz.

File metadata

  • Download URL: evalops_openai-0.2.1.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evalops_openai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1ed87581ea1698f60dd08aaf977defcbbe4e24ceb16b6accf5a7881792143f00
MD5 7f90ca90988bfd73872f8ee7e3e1cdce
BLAKE2b-256 4119dc74a1863b3c9bfe5a6a2a0ca20b971c15e2c368595c528614bbd76447f2

See more details on using hashes here.

File details

Details for the file evalops_openai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: evalops_openai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for evalops_openai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a4bb872264c27eec10db3e62155978fd8584a9d654ead9b0ffc58562d2f102c
MD5 42b287fc87ee22e89345bdc68c92133f
BLAKE2b-256 e0d2274a6c89cd31cfb6f0ae1b0b6996da70e204c0284801afc680051545f169

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page