Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Swarmauri

Downloads Hits Python License Release

Swarmauri xAI LLM

swarmauri_llm_xai provides provider-native Swarmauri adapters for xAI's Grok chat-completions API.

Features

  • XAIModel directly implements the Swarmauri LLM base contract.
  • XAIToolModel directly implements the tool-LLM base contract.
  • Bearer-token authentication with credentials excluded from serialized state.
  • Sync, async, incremental streaming, batch, and function-calling workflows.
  • Optional model discovery through xAI's language-model catalog.
  • Explicit provider, HTTP client, and retry-policy composition.
  • Conservative chat retries that do not replay ambiguous connection failures.

Installation

uv add swarmauri_llm_xai
pip install swarmauri_llm_xai

Usage

import os

from swarmauri_llm_xai import XAIModel
from swarmauri_standard.conversations.Conversation import Conversation
from swarmauri_standard.messages.HumanMessage import HumanMessage

conversation = Conversation(
    messages=[HumanMessage(content="Explain orbital mechanics briefly.")]
)
model = XAIModel(api_key=os.environ["XAI_API_KEY"], name="grok-4.3")
model.predict(conversation)
print(conversation.get_last().content)

For explicit composition:

from swarmauri_llm_xai import XAIChatRetryPolicy, XAIModel
from swarmauri_provider_xai import XAIProvider
from swarmauri_transport_httpx import HttpxClient

provider = XAIProvider(api_key=os.environ["XAI_API_KEY"])
model = XAIModel(
    provider=provider,
    http_client=HttpxClient(base_url=provider.base_url),
    retry_policy=XAIChatRetryPolicy(max_attempts=3),
)

Use XAIToolModel with a Swarmauri Toolkit for function calling. Set discover_models=True to populate allowed model IDs from the authenticated xAI language-model catalog.

See the xAI inference reference, chat endpoint, and function-calling guide.

Metadata

Release files for swarmauri_llm_xai 0.11.0.dev5

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

Source distribution (sdist)

Source distribution for swarmauri_llm_xai 0.11.0.dev5
File Size Uploaded Provenance Actions
swarmauri_llm_xai-0.11.0.dev5.tar.gz 4.2 kB Without provenance Details for swarmauri_llm_xai-0.11.0.dev5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for swarmauri_llm_xai 0.11.0.dev5
File Interpreter ABI Platform Actions
swarmauri_llm_xai-0.11.0.dev5-py3-none-any.whl Python 3 none any Details for swarmauri_llm_xai-0.11.0.dev5-py3-none-any.whl

Total release size: 11.0 kB

Release files / swarmauri_llm_xai-0.11.0.dev5.tar.gz

Download URL swarmauri_llm_xai-0.11.0.dev5.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1c4c51441bdd11786e36dcba788bc9d95f7a56d377c08e3096d69d4080d2611d
BLAKE2b-256 checksum
How to use checksums
b0d0aac457f4cc15a7495178bd3e98857fa66fbc5977546ac161c9a844461363
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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 / swarmauri_llm_xai-0.11.0.dev5-py3-none-any.whl

Download URL swarmauri_llm_xai-0.11.0.dev5-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea62ffe35f273ce49c557f18dae28b8bc65b094cfe36ffa1feb52ddf65ab3199
BLAKE2b-256 checksum
How to use checksums
8c89a3fd67a6e8f8eccb770154d0349f3431dc8365483c03753e047eb9c21f3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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}

Security for swarmauri_llm_xai 0.11.0.dev5

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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