Metadata-Version: 2.4
Name: lightningrod-ai
Version: 1.1.0
Summary: Predict anything with AI. Python SDK for Foresight forecasting models, built on top of OpenAI compatible inference API.
Author-email: Lightning Rod Labs <support@lightningrod.ai>
License: MIT License
        
        Copyright (c) 2025 Lightning Rod Labs
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        
        
Project-URL: Homepage, https://lightningrod.ai/sdk
Project-URL: Repository, https://github.com/lightning-rod-labs/lightningrod-python-sdk
Keywords: forecasting,probabilistic prediction,OpenAI-compatible API,foresight,LLM inference
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openai>=1.0.0
Provides-Extra: dev
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"
Dynamic: license-file

![](https://github.com/user-attachments/assets/66056c7a-6c6e-4040-a1a0-9852f709a0c5)


# Lightning Rod Python SDK

**Foresight** returns a calibrated probability for any question about the future through an OpenAI-compatible API.

**Trusted for high-stakes predictions** by Numinous, Shore Capital Partners, Awardable, ERIS Marketplace, and others. Foresight processes **billions of tokens** and serves **100k+ inference requests every day**.

[Documentation](https://docs.lightningrod.ai/) · [Get an API key](https://dashboard.lightningrod.ai/sign-up?redirect=/api) · [Research paper](https://arxiv.org/abs/2601.06336)

## ⚡ Better AI Predictions

Foresight is served behind an OpenAI-compatible endpoint, so any OpenAI client works — just point `base_url` at Lightning Rod.

```python
from openai import OpenAI

client = OpenAI(
    api_key="your-api-key",
    base_url="https://api.lightningrod.ai/v1/openai",
)

completion = client.chat.completions.create(
    model="foresight-v4",
    messages=[
        {"role": "user", "content": "Will the Fed cut rates at its next meeting?"},
    ],
    extra_body={"research": True}, # Auto research the most relevant prediction context
)

print(completion.choices[0].message.content)
```

See the [forecasting guides](https://docs.lightningrod.ai/forecasting/guides) for how to write good forecasting prompts.

### Prefer an SDK helper?

`lr.predict()` wraps the same API and parses the structured answer for you:

```bash
pip install lightningrod-ai
```

```python
import lightningrod as lr

client = lr.LightningRod(api_key="your-api-key")
result = client.predict(
    "Will the Fed cut interest rates in 2026?",
    answer_type="binary",
    research=True,
)
print(result.binary.probability)
```

## 🏗️ Train an expert on your domain

Need a model tuned to your domain? Our platform turns raw sources into labeled datasets and fine-tuned models. Read the [Future-as-Label paper](https://arxiv.org/abs/2601.06336) or view public models and datasets on [Hugging Face](https://huggingface.co/LightningRodLabs).

[**📅 Book a call with us**](https://calendly.com/d/ctq4-7gd-nyq/lightning-rod-demo)

## 📚 Learn more

- [Documentation & API reference](https://docs.lightningrod.ai/) — quickstart, guides, recipes, and the REST API reference
- [Quickstart notebook](notebooks/quickstart.ipynb) — OpenAI-compatible client and `lr.predict()`, side by side (runnable in Colab)
