Official SDKs
Last updated: 2026-11-27T14:39:27-03:00 (UTC-3)
Use the official OpenAI, Anthropic and Google SDKs pointed at the gateway: only the base URL and the key change. On every release, a test runs these SDKs, at the versions below, against the real gateway binary.
How to configure each SDK
Section titled “How to configure each SDK”OpenAI (Python, openai):
from openai import OpenAIclient = OpenAI(base_url="https://gateway.example.com/v1", api_key=GATEWAY_KEY)client.chat.completions.create(model="chat-default", messages=[{"role": "user", "content": "Hello"}])Anthropic (Python, anthropic): use auth_token, which becomes Authorization: Bearer.
from anthropic import Anthropicclient = Anthropic(base_url="https://gateway.example.com", auth_token=GATEWAY_KEY)client.messages.create(model="claude-alias", max_tokens=256, messages=[{"role": "user", "content": "Hello"}])Google Gen AI (Python, google-genai), in the Gemini API v1beta profile:
from google import genaifrom google.genai.types import HttpOptionsclient = genai.Client(api_key="unused", http_options=HttpOptions( base_url="https://gateway.example.com", api_version="v1beta", headers={"Authorization": f"Bearer {GATEWAY_KEY}"}))client.models.generate_content(model="gemini-alias", contents="Hello")The Google SDK requires an api_key to build the client; the gateway ignores any credential from the SDK and uses the one from the configured connection. Never put the provider key in the client: the client only knows the gateway key.
For Claude Code and Codex CLI, see Providers.
Tested versions
Section titled “Tested versions”| SDK | Version | What is exercised |
|---|---|---|
openai |
3.37.0 | Chat Completions JSON and stream, Responses JSON and stream (store: false), embeddings, moderations with text and an image part |
anthropic |
2.3.0 | Messages JSON and stream, with final text and usage |
google-genai |
2.33.0 | generate_content and generate_content_stream |
Test environment: Python 3.14.7 on macOS arm64.
What the test checks
Section titled “What the test checks”There are 28 cases, against the real gateway and providers simulated on loopback (no account, real key or public network):
- 10 successes: the SDKs read the native responses, including streams, final usage and the moderation envelope, flags (a
nullcategory included), scores and applied input types. - 12 errors: per family, an invalid key gives
401; a model outside the allowlist and a valid key missing the route scope each give403; a429from the provider reaches the SDK. Local refusals do not call the provider. - 6 flags off: the routes respond
404without calling the provider. - The harness requires the gateway to remain alive until its own shutdown request and exit cleanly afterward; premature or nonzero exit fails certification. A controlled real-process regression preserves that inverse.
- The gateway swaps the SDK’s credential for the connection’s, propagates
X-Request-Idand the trace ID, and the logs contain no body, response or credential.
Current focused certification uses the exact hash-locked clients, a freshly compiled gateway and owned PostgreSQL. The report identifies SDK/Python/platform versions, case count and upstream sends; cleanup is recorded by the owned runner. The ordinary control tests run without those SDK dependencies.
The test does not use real models: it does not measure latency, price or quality, and it does not prove an account’s permissions.
Limits
Section titled “Limits”- Not tested: JavaScript/TypeScript, Go, Java and .NET SDKs; earlier versions; async clients; tools, multimodality, files, Realtime, Vertex and batches through the SDKs. These flows have their own gateway tests, but not through the SDK.
- Each SDK exposes the request ID in its own way (Anthropic’s uses
request-id); the gateway always returnsX-Request-Id.
For contributors
Section titled “For contributors”The test lives in scripts/verify-sdk-compat.py, with the versions locked by hash in scripts/sdk-compat-requirements.lock. The release gate runs the test when SDK_PYTHON points to a venv with that lock; without it, the test shows up as SKIP, which is not proof.
python3 -m venv /tmp/gateway-sdk-venv/tmp/gateway-sdk-venv/bin/python -m pip install --require-hashes --only-binary=:all: \ -r scripts/sdk-compat-requirements.lockpython3 scripts/with-test-services.py --command-timeout-seconds 600 -- \ /tmp/gateway-sdk-venv/bin/python scripts/verify-sdk-compat.pySee also
Section titled “See also”- Quickstart.
- Capabilities and routes.
- Official documentation: OpenAI SDKs, Anthropic Python SDK, Google Gen AI SDK.
Published prompt Python client
Section titled “Published prompt Python client”The optional m7gtw-prompts0.1.0.dev0 local wheel is a separate dependency-free server-side client for the gateway’s published text registry. It reads/renders only the active key team’s current publication, supports flat strings and explicit bounded typed render_json, and returns immutable revision/hash; it never calls a provider. Default-off API flags, explicit key scopes and team/organization plan ceilings remain cumulative. The actual installed wheel was exercised with the compiled gateway and owned PostgreSQL, including two-team denial, publication changes, encoded/decoded limits, revocation, flags and correlation.
The validated runtime is Python3.14.7/macOSarm64; the package declares Python>=3.11, without certifying every minor/OS profile. No PyPI publication or async/other-language prompt client is claimed. See the full prompt API, configuration and client guide.