Skip to main content

aurarouter-openai

OpenAI Platform and Azure OpenAI MCP provider server for AuraRouter.

aurarouter-openai exposes OpenAI and Azure OpenAI models as an MCP (Model Context Protocol) provider server compatible with the AuraRouter Provider Protocol. It separates cloud vendor specifics (such as reasoning model dialects, /v1/responses, Structured Outputs, and prompt caching) from AuraRouter core's generic local OpenAPIProvider.


Features

  • Standard MCP Provider Protocol:
    • provider.generate: Single-shot text generation
    • provider.generate_with_history: Multi-turn conversational generation
    • provider.list_models: Catalog discovery with context limits, pricing, and capabilities
    • provider.health_check: Liveness and credential readiness probe
    • provider.capabilities: Tool and feature advertisement
  • Reasoning Model Dialect Adaptation:
    • Automatically switches o1, o3, o4-mini, and gpt-5* models to max_completion_tokens.
    • Maps system instructions to the developer role.
    • Supports reasoning_effort (low, medium, high) and suppresses unsupported temperature parameters.
  • Dual API Modes:
    • Chat Completions: /v1/chat/completions (default)
    • Responses API: /v1/responses (api_mode="responses")
  • Azure OpenAI Support:
    • Configurable azure_endpoint, api_version, and deployment routing.
    • Supports both api-key header authentication and Microsoft Entra ID (AZURE_OPENAI_AD_TOKEN).
  • Prompt Cache Affinity:
    • Passes prompt_cache_key to upstream endpoints.
    • Returns cached_input_tokens and reasoning_tokens telemetry.
  • AuraRouter v2.1 Telemetry Envelopes:
    • Normalizes Go-duration rate limit headers (x-ratelimit-*) and Retry-After.
    • Propagates typed error envelopes: rate_limit_exceeded, context_length_exceeded, and provider_transient_error.

Installation

pip install aurarouter-openai

Or install from source:

cd aurarouter-openai
pip install -e .

Configuration

Environment Variables

Variable Description
OPENAI_API_KEY OpenAI API key (or Azure OpenAI API key)
OPENAI_BASE_URL Optional custom base URL (default: https://api.openai.com/v1)
OPENAI_ORG_ID Optional OpenAI organization ID
OPENAI_PROJECT_ID Optional OpenAI project ID
AZURE_OPENAI_ENDPOINT Azure OpenAI resource endpoint (e.g. https://my-resource.openai.azure.com)
AZURE_OPENAI_AD_TOKEN Optional Microsoft Entra ID bearer token for Azure OpenAI
OPENAI_API_VERSION Azure OpenAI API version (default: 2025-01-01-preview)

Running the Server

Start the standalone MCP server:

python -m aurarouter_openai

Display command line options and help:

python -m aurarouter_openai --help

AuraRouter Integration

In your AuraRouter configuration file (auraconfig.yaml):

models:
  gpt-4o:
    provider: mcp
    mcp_endpoint: http://localhost:8000
    model_name: gpt-4o
    hosting_tier: cloud
    cost_per_1m_input: 2.50
    cost_per_1m_output: 10.00
    context_limit: 128000

  o3:
    provider: mcp
    mcp_endpoint: http://localhost:8000
    model_name: o3
    hosting_tier: cloud
    cost_per_1m_input: 2.00
    cost_per_1m_output: 8.00
    context_limit: 200000

Testing & Verification

The test suite supports standalone execution and monorepo runner integration:

pytest tests/ -v
  • Unit & Telemetry Suite: Verifies client lifecycle, dialect transformation, rate-limit header parsing, and error encapsulation.
  • Canary Suite: Includes @pytest.mark.live_vendor canaries with strict token caps (max_tokens=16) to verify live OpenAI Platform connectivity when OPENAI_API_KEY is present.

License

MIT License. See LICENSE for details.

Metadata

Release files for aurarouter-openai 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aurarouter-openai 0.5.1
File Size Uploaded Provenance Actions
aurarouter_openai-0.5.1.tar.gz 20.2 kB With provenance Details for aurarouter_openai-0.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aurarouter-openai 0.5.1
File Interpreter ABI Platform Actions
aurarouter_openai-0.5.1-py3-none-any.whl Python 3 none any Details for aurarouter_openai-0.5.1-py3-none-any.whl

Total release size: 35.8 kB

Release files / aurarouter_openai-0.5.1.tar.gz

Download URL aurarouter_openai-0.5.1.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bfaedd893ea2a27d0c42e598d2baad30614626d62e862220c3e2c153f35f1fc8
BLAKE2b-256 checksum
How to use checksums
11879113627db10bbf48cd7260f559a335031a67d8846905bcae24f8da9b931b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / aurarouter_openai-0.5.1-py3-none-any.whl

Download URL aurarouter_openai-0.5.1-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0af41465ca64843ad9d663cdbe52a7c97015a92f9b600ad1983d8695d5b5f845
BLAKE2b-256 checksum
How to use checksums
0b8feb0caca8a800dd93da835b81f0d87ee0ab946f4256c41b8b0e13ccc7ee17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for aurarouter-openai 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for aurarouter_openai-0.5.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page