Linkup
Linkup is a web search API that returns sourced answers grounded in real-time web data. Use it through the Respan gateway to ground LLM completions with fresh information, rendered into your prompts via template variables.
Set up Respan
Create an account at platform.respan.ai and grab an API key . For gateway, also add credits or a provider key .
Linkup is a gateway-only integration. Calls run through the Respan gateway and are automatically traced.
Paste this into your coding agent:
Help me set up Respan tracing with the Linkup integration.
Follow https://www.respan.ai/docs/integrations/linkup.mdSetup
Set environment variables
export RESPAN_API_KEY="YOUR_RESPAN_API_KEY"
export LINKUP_API_KEY="YOUR_LINKUP_API_KEY"Add Linkup parameters to your request
Include linkup_params in your request body. The Linkup response is rendered into your prompt as {{ linkup_search_response }}.
import os
import requests
response = requests.post(
"https://api.respan.ai/api/chat/completions",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {os.environ['RESPAN_API_KEY']}",
},
json={
"model": "gpt-4.1-nano",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Please summarize: {% if linkup_search_response %}{{ linkup_search_response.answer }}{% endif %}"},
],
"linkup_params": {
"api_key": os.environ["LINKUP_API_KEY"],
"q": "What is Microsoft's 2024 revenue?",
"depth": "deep",
"outputType": "sourcedAnswer",
"includeImages": False,
},
},
)
print(response.json())Template variables
Use Jinja2 syntax to render Linkup responses in your messages. See the Jinja2 docs.
{% if linkup_search_response %}
{{ linkup_search_response.answer }}
Sources:
{% for source in linkup_search_response.sources %}
- {{ source.name }}: {{ source.url }}
{{ source.snippet }}
{% endfor %}
{% endif %}Parameters
| Parameter | Type | Description | Default |
|---|---|---|---|
q | string | The search query. | Required |
depth | string | Search depth: "standard" or "deep". | "deep" |
outputType | string | "searchResults", "sourcedAnswer", or "structured". | "sourcedAnswer" |
structuredOutputSchema | string | Schema for structured output. | null |
includeImages | boolean | Whether to include images in the response. | false |
Response structure
{
"answer": "The answer text",
"sources": [
{
"name": "Source name",
"url": "Source URL",
"snippet": "Text snippet from the source"
}
]
}Error handling
If the Linkup API call fails, the error is added to warnings_dict in the response under the key LINKUP_SEARCH_ERROR.