This release is a pre-release and may not be stable for production use.
Swarmauri xAI LLM
swarmauri_llm_xai provides provider-native Swarmauri adapters for xAI's Grok chat-completions API.
Features
XAIModeldirectly implements the Swarmauri LLM base contract.XAIToolModeldirectly 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.dev4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_llm_xai-0.11.0.dev4.tar.gz | 4.1 kB | Without provenance | Details for swarmauri_llm_xai-0.11.0.dev4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_llm_xai-0.11.0.dev4-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_llm_xai-0.11.0.dev4-py3-none-any.whl |
Total release size: 10.9 kB
Release files / swarmauri_llm_xai-0.11.0.dev4.tar.gz
| Download URL | swarmauri_llm_xai-0.11.0.dev4.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eeb13128102f0ca8a488cecdffba7f58e8b3e3b66c3f2d7adb0a5b245ff84435
|
|
BLAKE2b-256 checksum How to use checksums |
c63a4caef3935f9b136c75ab9d3c04a85b43823ec37fb45ce9a04458fc7af595
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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.dev4-py3-none-any.whl
| Download URL | swarmauri_llm_xai-0.11.0.dev4-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
23f7a59cc8abb25bf7a2ae1ed8d26c5d5844e749ab4c18081d79fe828fee4a01
|
|
BLAKE2b-256 checksum How to use checksums |
1f9d08f9d5983dd73072383d71d9b7388ca097f382ff4d13fd7a2f84b4655e67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","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.dev4
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.