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

Uploaded Python 3

File details

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

File metadata

  • Download URL: evalops_openai-0.1.0.tar.gz
  • Upload date:
  • Size: 21.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 768079ba5a77390f501846da3abf1aabc5d8967d652550c3d5d01c6818f5e1b6
MD5 ea01ee2cc6d1446af449a2fc6211d2fc
BLAKE2b-256 05f6f7788bc7a504ada44bf26bd930acb1c4a45a89baa97b1a21fa43ac9408f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: evalops_openai-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 486de0aedff267c58dadc8a8727c91cb307e64a1e1b751511ef0489d5cda6eef
MD5 429a83fdef9e29b55b28efba43e23a68
BLAKE2b-256 e0f060006b5b0b23bc1e360c2729bd93528c6709ca6b52375e59d16bbe0f2b79

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