Skip to Content
Launching the open-source gateway

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.md

Setup

Set environment variables

Terminal
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 }}.

Python
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

ParameterTypeDescriptionDefault
qstringThe search query.Required
depthstringSearch depth: "standard" or "deep"."deep"
outputTypestring"searchResults", "sourcedAnswer", or "structured"."sourcedAnswer"
structuredOutputSchemastringSchema for structured output.null
includeImagesbooleanWhether to include images in the response.false

Response structure

JSON
{ "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.