Metadata-Version: 2.5
Name: runcrate-haystack
Version: 0.1.0
Summary: Haystack integration for Runcrate: 200+ open models behind one OpenAI-compatible API
Project-URL: Homepage, https://www.runcrate.ai/docs?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=gpu_pricing
Project-URL: Documentation, https://www.runcrate.ai/docs/api-reference/chat/chat-llm-completion?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=gpu_pricing
Project-URL: Pricing, https://www.runcrate.ai/inference/pricing?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=gpu_pricing
Author-email: Aeonmind LLC <hello@runcrate.ai>
License: MIT
License-File: LICENSE
Keywords: chat-generator,haystack,inference,llm,openai-compatible,runcrate
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: haystack-ai>=2.19.0
Description-Content-Type: text/markdown

# runcrate-haystack

Haystack chat generator for [Runcrate](https://www.runcrate.ai/?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=gpu_pricing): 200+ open models (DeepSeek, Qwen, Llama, Kimi, gpt-oss and more) behind one OpenAI-compatible API, billed per token from one prepaid balance. The same account rents GPUs by the hour for fine-tuning or serving your own model.

## Install

```bash
pip install runcrate-haystack
```

Create an API key ([docs](https://www.runcrate.ai/docs/account/api-keys?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=gpu_pricing)) and `export RUNCRATE_API_KEY=...`.

## Use

```python
from haystack.dataclasses import ChatMessage
from haystack_integrations.components.generators.runcrate import RuncrateChatGenerator

generator = RuncrateChatGenerator(model="deepseek-ai/DeepSeek-V3.2")
result = generator.run([ChatMessage.from_user("Explain LoRA fine-tuning in one sentence.")])
print(result["replies"][0].text)
```

### Streaming

```python
from haystack.components.generators.utils import print_streaming_chunk

generator = RuncrateChatGenerator(
    model="Qwen/Qwen3-235B-A22B-Instruct-2507",
    streaming_callback=print_streaming_chunk,
)
generator.run([ChatMessage.from_user("Write a haiku about GPUs.")])
```

### In a pipeline

```python
from haystack import Pipeline
from haystack.components.builders import ChatPromptBuilder

template = [ChatMessage.from_user("Answer briefly: {{ question }}")]

pipe = Pipeline()
pipe.add_component("prompt", ChatPromptBuilder(template=template, required_variables=["question"]))
pipe.add_component("llm", RuncrateChatGenerator(model="deepseek-ai/DeepSeek-V3.2"))
pipe.connect("prompt.prompt", "llm.messages")

print(pipe.run({"prompt": {"question": "What is an H100?"}})["llm"]["replies"][0].text)
```

### Tool calling

```python
from haystack.components.agents import Agent
from haystack.tools import tool

@tool
def multiply(a: float, b: float) -> float:
    """Multiply two numbers."""
    return a * b

agent = Agent(chat_generator=RuncrateChatGenerator(model="openai/gpt-oss-120b"), tools=[multiply])
print(agent.run([ChatMessage.from_user("What is 1234 * 4567?")])["last_message"].text)
```

## Arguments

| Argument | Default |
|---|---|
| `model` | `deepseek-ai/DeepSeek-V3.2`; any id from `GET https://api.runcrate.ai/v1/models` |
| `api_key` | `Secret.from_env_var("RUNCRATE_API_KEY")` |
| `api_base_url` | `https://api.runcrate.ai/v1` |
| `generation_kwargs` | `max_tokens`, `temperature`, `top_p`, `stop`, `response_format` ... sent as-is |
| `tools` | list of `Tool`/`Toolset` (models with tool support) |
| `streaming_callback`, `timeout`, `max_retries`, `http_client_kwargs` | as in Haystack's `OpenAIChatGenerator` |

The component serializes with `to_dict`/`from_dict`, so pipelines that use it save to YAML; the API key is stored as an environment variable reference, never as a value. Models and prices: [runcrate.ai/inference/pricing](https://www.runcrate.ai/inference/pricing?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=gpu_pricing).

## Let your agent rent GPUs too

Runcrate also runs a remote MCP server at `https://mcp.runcrate.ai/mcp` (OAuth sign-in in the browser, no key to paste): [setup](https://www.runcrate.ai/docs/mcp/setup?utm_source=pypi-runcrate-haystack&utm_medium=directory&utm_campaign=mcp).

## License

MIT, Aeonmind LLC.
