Skip to content

fix(openai): attribute MiniMax requests to their provider - #406

Open
nik13 wants to merge 2 commits into
devfrom
fix/openai-minimax-provider
Open

nik13 wants to merge 2 commits into
devfrom
fix/openai-minimax-provider

Conversation

@nik13

@nik13 nik13 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Correct MiniMax provider attribution in the existing Python traceAI-openai integration. This is a releasable shared-route prerequisite, not approval to delete or deprecate traceAI-minimax.

  • Add exact mappings for api.minimax.io, api.minimax.cn, api.minimaxi.com and api.minimax.chat; preserve the fallback for custom proxies, bare domains and look-alikes.
  • Add 67 offline cases using the real OpenAI SDK and the existing localhost OTLP/HTTP receiver. Cover synchronous/asynchronous text, text streams, non-streamed tools, streamed-request attribution, API errors, token counts, privacy and exact-host normalization/rejection.
  • Add network-isolated CI at OpenAI 1.69.0 and 3.42.0, including released core 1.2.2.
  • Document the shared non-streaming setup and its current migration limitations in the package README. No public entry points, versions, release inventory or CHANGELOG version sections are removed or changed.

Sources and design

MiniMax officially supports the shared OpenAI client. No separate wrapper or copied vendor implementation is needed for provider attribution.

The resolver keeps this repository's exact-host policy rather than widening to arbitrary MiniMax-looking subdomains.

Verification

Base: d6a9966dd4d5d5fb344f7f5ab11b7483c2c2a6bc.

Before the production change, the new provider suite had 54 failures and 13 passes at both OpenAI boundaries. All 54 failures were the missing MiniMax attribution or its normalization. After the fix:

Environment Entire shared OpenAI suite
Python 3.10 / OpenAI 1.69.0 / source core 129 passed
Python 3.12 / OpenAI 3.42.0 / source core 129 passed
Python 3.12 / OpenAI 3.42.0 / released fi-instrumentation-otel 1.2.2 129 passed
Python 3.12 / OpenAI 1.93.1 / locked core 1.1.0 123 passed, 6 skipped

The first generic package CI run exposed its older core 1.1.0 lock: that release lacks error-detail controls and full tool-schema masking. Six tool/error privacy cases explicitly target core 1.2.2+ and skip on the old lock; all six run and pass in every dedicated modern-core job. Plain-text privacy and all attribution cases still run on the old lock. This change does not claim to add privacy features to old core releases, and the held guide requires core 1.2.2 or later.

Vendor HTTP uses httpx.MockTransport; exports cross a real localhost HTTP socket and are decoded as OTLP protobuf by the repository harness. Every local Python test/probe used the macOS sandbox denying outbound network except localhost. CI uses a network namespace with only loopback. No real credentials, model API calls or Future AGI backend calls were used.

Rerun with the source OpenAI package, core, pytest, pytest-asyncio, and httpx installed:

python -I -m pytest python/frameworks/openai/tests -q

The new workflow pins the three environments. New-test Ruff E/F/I checks and git diff --check pass. There is no Ruff configuration in the touched package pyproject, and no migrations, frontend contracts or OSS/EE boundary changes. Self-review found no introduced blocking defects.

The README and held MDX snippet also ran unchanged with register(), mocked vendor HTTP and localhost OTLP at both SDK boundaries and released core. The MDX compiles; site rendering and live backend display are not claimed.

Retirement gate remains closed

Independent offline probes on both SDK boundaries reconfirm that enabling both packages emits two spans. The shared route still omits response IDs and finish reasons, loses streamed tool arguments, and can omit text when final usage is null. Streamed-tool/null-usage repair is already in #367; this PR intentionally does not duplicate or modify that work. Attribution tests for streamed tools verify SDK result preservation, provider and usage, not exported tool-argument parity.

The existing legacy package also supports OpenAI 1.0–1.68, below the shared package floor. Its current stream handling can raise TypeError on an SDK-normalized null tool_calls field. No claim of legacy streaming correctness or full migration parity is made.

Release this shared attribution fix first. Before retiring the dedicated implementation, land/release the shared stream fix, resolve the remaining response-ID/finish-reason and one-span coexistence contracts, verify privacy/parity, and provide a backward-compatible entry-point migration. Keep published registry history. Do not delete or advertise a drop-in replacement on this PR alone.

A customer docs draft is held outside the docs repository until the corrected package reaches PyPI; no docs PR advertises unreleased attribution. It describes the limited non-streaming route rather than claiming retirement parity. The Anthropic-compatible route is outside this change.

E2E coverage

not applicable (no e2e/ harness) · flows hit: n/a · marker: n/a · verdict: not applicable

Generated with Claude Code

nik13 and others added 2 commits October 31, 2026 08:36
Reuse the shared SDK route with exact documented hosts and preserve the dedicated package until migration parity is ready. Test attribution and privacy over loopback OTLP at supported SDK boundaries.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Keep attribution and text masking coverage on the existing core 1.1.0 lock while running tool and error privacy contracts on the source core and released 1.2.2 CI jobs.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant