Replicate

Trace Replicate model predictions with Respan.
  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.

1{
2 "mcpServers": {
3 "respan-docs": {
4 "url": "https://docs.respan.ai/mcp"
5 }
6 }
7}

What is Replicate?

Replicate is a platform for running machine learning models in the cloud. It hosts thousands of open-source models and provides a simple API for running predictions without managing infrastructure.

Setup

1

Install packages

$pip install respan-ai opentelemetry-instrumentation-replicate replicate python-dotenv
2

Set environment variables

$export REPLICATE_API_TOKEN="YOUR_REPLICATE_API_TOKEN"
$export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
$export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.respan.ai/api"
$export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer $RESPAN_API_KEY"
3

Initialize and run

1import os
2from dotenv import load_dotenv
3
4load_dotenv()
5
6import replicate
7from respan import Respan
8
9# Auto-discover and activate all installed instrumentors
10respan = Respan(is_auto_instrument=True)
11
12# Run a prediction — auto-traced by Respan
13output = replicate.run(
14 "meta/llama-2-70b-chat",
15 input={"prompt": "Say hello in three languages."},
16)
17print("".join(output))
18respan.flush()
4

View your trace

Open the Traces page to see your auto-instrumented prediction spans.

What gets traced

  • Model name and version
  • Input parameters
  • Prediction output
  • Latency and processing time
  • Token usage (for language models)

Traces appear in the Traces dashboard.

Learn more