Skip to main content
  1. Sign up — Create an account at platform.respan.ai
  2. Create an API key — Generate one on the API keys page
  3. Add credits or a provider key — Add credits on the Credits page or connect your own provider key on the Integrations page
Add the Docs MCP to your AI coding tool to get help building with Respan. No API key needed.
{
  "mcpServers": {
    "respan-docs": {
      "url": "https://docs.respan.ai/mcp"
    }
  }
}
This integration is for the Respan gateway.

What is Haystack?

Haystack is a Python framework for building production-ready LLM pipelines. Use the RespanGenerator component to route LLM calls through the Respan gateway.

Quickstart

Step 1: Install packages

pip install respan-exporter-haystack haystack-ai

Step 2: Set environment variables

export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"

Step 3: Use RespanGenerator in your pipeline

from haystack import Pipeline
from respan_exporter_haystack import RespanGenerator

pipeline = Pipeline()
pipeline.add_component("llm", RespanGenerator(
    api_key="your-api-key",
    model="gpt-4o-mini",
))

result = pipeline.run({"llm": {"prompt": "Tell me a joke"}})
print(result)

Step 4: Verify

Open the Logs page to see your gateway requests.

Prompts

Use Respan-managed prompts with the gateway:
from respan_exporter_haystack import RespanGenerator

generator = RespanGenerator(
    api_key="your-api-key",
    model="gpt-4o-mini",
    prompt_id="your-prompt-id",
    prompt_version=1,
)

Configuration

ComponentDescription
RespanGeneratorRoutes LLM calls through the Respan gateway.
RespanChatGeneratorChat-specific gateway component.
See the Haystack Exporter SDK reference for the full API.
Looking for tracing integration? See Tracing > Haystack.