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.0.tar.gz (21.8 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.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: evalops_openai-0.2.0.tar.gz
  • Upload date:
  • Size: 21.8 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.0.tar.gz
Algorithm Hash digest
SHA256 232e17d7110f921196f73163ff30f54f74b7e71bbc357f148d68fae8d98c45a7
MD5 bfbf3c2720500b93332f00fcdbbe1128
BLAKE2b-256 4b29b79b88ce2cfd5a50cb0064dfb99f30648e78d033fe6dd9cee17888de8868

See more details on using hashes here.

File details

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

File metadata

  • Download URL: evalops_openai-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b91a5502f84d23f477951e35a1414118fd63cc78dbd37dc4b7fec7bfbbba01b7
MD5 f4032e356c43ee3015e4aa2b9a441805
BLAKE2b-256 13edd8fa1de0b580f32aa272f415ac77926805e133e9d07b88c78390797d9df8

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