Skip to main content

exoclaw-provider-openai

Direct-httpx OpenAI-compatible provider for exoclaw.

Uses httpx directly (no OpenAI SDK, no LiteLLM) so the request body can be streamed as the JSON is built rather than materialized as one contiguous string before the POST. On long conversations this drops peak per-turn RAM from ≈3× prompt-size (list + JSON dump + httpx buffer) to ≈1× streaming buffer — see exoclaw/docs/memory-model.md Step B.

Shape

from exoclaw_provider_openai import Deployment, OpenAIStreamingProvider

provider = OpenAIStreamingProvider(
    default_model="zai/glm-4.7",
    deployments={
        "zai/glm-4.7":           Deployment(base_url="https://openrouter.ai/api/v1", api_key=OPENROUTER_KEY),
        "minimax/minimax-m2.7":  Deployment(base_url="https://openrouter.ai/api/v1", api_key=OPENROUTER_KEY),
        "openai/gpt-5.4":        Deployment(base_url="https://api.openai.com/v1",    api_key=OPENAI_KEY),
        "zai-direct/glm-5.1":    Deployment(base_url="https://api.z.ai/api/coding/paas/v4", api_key=ZAI_KEY),
    },
    fallbacks={
        "zai/glm-4.7":   ["minimax/minimax-m2.7"],
        "zai/glm-5.1":   ["minimax/minimax-m2.7"],
    },
)

Each model name maps to exactly one deployment (base URL + API key + optional extra headers). fallbacks is a per-model list — when the primary raises a retryable error (429, 5xx, timeout) the provider walks the fallback list until one succeeds or all are exhausted.

Routing policy

  • Each model → exactly one deployment. No load balancing across deployments for a single model.
  • Fallbacks are strict per-model lists. No automatic cross-provider fallback.
  • SSE response streaming is always on (the streaming-request-body path requires it as the codec; non-streaming responses aren't supported).
  • TTFT timeout: if the first response byte doesn't arrive inside stream_ttft_timeout seconds, the request is abandoned and the fallback list is tried. Default 15 s.

What's intentionally skipped vs. LiteLLM

  • Multi-provider cost tracking / usage normalization (OpenRouter returns the OpenAI shape directly; openclaw doesn't use cost tracking).
  • Automatic Anthropic cache_control tagging. If your deployment needs it, stamp it on the messages before handing them to chat() — this provider is OpenAI-schema only.
  • Deep parameter remapping across providers. Everything here is the OpenAI chat-completions schema; it's the caller's responsibility to send messages in that shape.

Release files for exoclaw-provider-openai 0.4.3

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

Source distribution (sdist)

Source distribution for exoclaw-provider-openai 0.4.3
File Size Uploaded
exoclaw_provider_openai-0.4.3.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for exoclaw-provider-openai 0.4.3
File Interpreter ABI Platform
exoclaw_provider_openai-0.4.3-py3-none-any.whl Python 3 none any Details

Total release size: 31.5 kB

Release files / exoclaw_provider_openai-0.4.3.tar.gz

Download URL exoclaw_provider_openai-0.4.3.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
84f596a34b4fb33b2571659f40d7836c6888a04da31393c2936048c1faeb9321
BLAKE2b-256 checksum
How to use checksums
51ae8cd8fabb3b338cc7d8fa54e89aa01197acb9ccc98228f813a5102e1574df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / exoclaw_provider_openai-0.4.3-py3-none-any.whl

Download URL exoclaw_provider_openai-0.4.3-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
561308e338e331b47640d767b838a18676f3828ae967be2437baa4b4b6838c12
BLAKE2b-256 checksum
How to use checksums
73dc11d3a112aac753fe27cf645e317bfaf74b51c14b8c44d8f7dc5eb875bef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.4.3 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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