Skip to content

[bot] Instrument portkey-ai (830,380 weekly downloads) #696

Description

@braintrust-bot
<!-- library-gap-audit: portkey-ai-py -->

Gap

portkey-ai (the Python SDK for the Portkey AI Gateway) has no Braintrust instrumentation in this repo. It provides a unified, OpenAI-SDK-compatible execution surface (Portkey(...).chat.completions.create(...), .completions.create(...), .embeddings.create(...), streaming, and tool-calling) that routes requests to 250+ upstream LLM providers via virtual keys, fallbacks, load balancing, and semantic caching.

This is directly analogous to the gateway/router libraries already instrumented in this repo — litellm and openrouter — but portkey-ai itself has no wrapper, despite having comparable or higher adoption and the same execution-oriented surface (generation, streaming, tool calls) that the existing gateway integrations cover.

Weekly downloads: 830,380 (as of 2026-08-17; source: https://pypistats.org/api/packages/portkey-ai/recent)

Braintrust docs status: not_found — checked https://www.braintrust.dev/docs/integrations; Portkey is not listed among the supported integrations, providers, or gateway/proxy tooling. The page's only guidance for unlisted providers is to use the generic AI Proxy or request an integration.

Upstream sources:

Local repo files inspected (confirming no existing instrumentation):

  • py/src/braintrust/integrations/ (recursive listing) — no portkey directory (contrast with existing gateway coverage: litellm, openrouter)
  • py/src/braintrust/wrappers/*.py — no portkey wrapper
  • py/pyproject.toml [tool.braintrust.matrix] and [tool.braintrust.vendor-packages] — no portkey/portkey-ai entry
  • py/noxfile.py — no portkey test session
  • py/src/braintrust/_generated_types.py — only false-positive substring match (...ReportKey...), not a real reference
  • Repo-wide case-insensitive grep for portkey — no genuine matches

Suggested instrumentation: wrap the Portkey client's chat.completions.create, completions.create, and embeddings.create methods (including streaming) similarly to the existing litellm/openrouter gateway wrappers, capturing the routed provider/model, request/response payloads, and token usage as span data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions