For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenAI API

Use Foresight through any OpenAI-compatible client.

Minimal example

from openai import OpenAI

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

response = client.chat.completions.create(
    model="foresight-v4",
    messages=[
        {"role": "user", "content": "Will the Fed cut interest rates in 2026?"},
    ],
)

message = response.choices[0].message
print(message.content)

A few useful response fields:

  • response.choices[0].message.content — model response, including <answer></answer> tags when answer_type is set.

  • response.choices[0].message.thinking — reasoning tokens

  • response.choices[0].message.annotations — citations, when research runs.

  • response.usage — cost metadata.

See the REST API reference for more details.

Answer formats

When answer_type is set, message.content includes machine-readable tags.

answer_type

Raw response shape

"binary"

<answer>0.62</answer>

"continuous"

<answer>{"mean": 42.5, "standard_deviation": 5.2}</answer>

"multiple_choice"

<answer>{"A": 0.55, "B": 0.45}</answer>

"free_response"

<answer>...</answer>

"auto"

Server-selected structured answer raw response shape

See our API reference for more response examples.

Research

Pass research in extra_body to gather live web context before forecasting. Set it to true to query all default sources, or pass a sources array to limit which providers run:

See our API reference for an up-to-date list of supported sources.

Reasoning effort

Recommendation: use low reasoning effort if cost and latency outweigh marginal improvements in accuracy.

See Recipes for more forecasting guidelines.

Last updated

Was this helpful?