Metadata-Version: 2.4
Name: querais
Version: 0.2.6
Summary: Python client for QueraIS, the decentralized AI inference marketplace. OpenAI-shaped chat/streaming plus QueraIS extras: nodes, stats, model manifest.
Project-URL: Homepage, https://github.com/ShavitR/querais/tree/main/sdk-python#readme
Project-URL: Repository, https://github.com/ShavitR/querais
Project-URL: Issues, https://github.com/ShavitR/querais/issues
Author: QueraIS contributors
License-Expression: MIT
Keywords: ai,arbitrum,decentralized,inference,llm,openai-compatible,querais,web3
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: langchain
Requires-Dist: langchain-openai>=0.2; extra == 'langchain'
Provides-Extra: llamaindex
Requires-Dist: llama-index-llms-openai-like>=0.3; extra == 'llamaindex'
Description-Content-Type: text/markdown

# querais

Python client for [QueraIS](https://github.com/ShavitR/querais) — the decentralized
AI inference marketplace. Anyone with a GPU serves models and earns; you buy
inference through one OpenAI-compatible endpoint.

```bash
pip install querais
```

```python
from querais import QueraisClient

client = QueraisClient("https://gateway.querais.xyz", api_key="sk-...")
result = client.chat([{"role": "user", "content": "hello"}], model="llama3.2")
print(result.content)
```

## OpenAI-compatible

The gateway speaks the OpenAI chat-completions protocol, so the official `openai`
package works too — point it at the gateway:

```python
from openai import OpenAI

client = OpenAI(base_url="https://gateway.querais.xyz/v1", api_key="sk-...")
```

This package is thin sugar over that protocol plus QueraIS-specific helpers.

## Streaming

```python
for delta in client.chat_stream([{"role": "user", "content": "tell me a story"}],
                                model="llama3.2"):
    print(delta, end="", flush=True)
```

## QueraIS extras

```python
client.models()          # model ids served by connected nodes
client.nodes()           # public node directory: reputation, prices, dimensions
client.stats()           # network stats
client.model_manifest()  # the gateway's signed model-digest manifest (404 if unpinned)
```

Routing extensions on `chat()` / `chat_stream()`:

```python
client.chat(messages, model="llama3.2",
            max_price_per_1k_tokens=0.5,  # cap what you pay
            min_reputation=0.7)           # floor the node quality
```

## LangChain / LlamaIndex

The integrations return the **official** LangChain / LlamaIndex OpenAI classes
configured for the gateway — nothing reimplemented:

```bash
pip install 'querais[langchain]'   # or 'querais[llamaindex]'
```

```python
from querais.langchain import chat_model
llm = chat_model("https://gateway.querais.xyz", api_key="sk-...", model="llama3.2")

from querais.llamaindex import llm as qllm
llm = qllm("https://gateway.querais.xyz", api_key="sk-...", model="llama3.2")
```

## License

MIT
