Skip to main content

Introduction

The OpenAI SDK can be used to interact with the Linkup API, to generate responses.
We are only compatible with Responses API.
Chat Completions API is NOT supported at the moment.

Quickstart

Get started with the OpenAI SDK in less than 5 minutes!
2

Installation

You can install the OpenAI SDK using the following:
pip install openai
3

Usage

Here is a basic usage showing how to use the OpenAI SDK:
from openai import OpenAI

client = OpenAI(
  base_url='https://api.linkup.so/v1',
  api_key="<YOUR API KEY>"
)

response = client.responses.create(
  model="linkup-standard",
  input="Can you tell me which women were awarded the Physics Nobel Prize",
)

print(response.output_text)

Input Parameters

ParameterTypeDescriptionDefault
modelstringType of search to perform “linkup-standard” or “linkup-deep”Required
For others parameters, please refer to the Responses API.

Model

The model field is used to select the type of search you want to perform:
  • linkup-standard: the search will be straightforward and fast, suited for relatively simple queries (e.g. “What’s the weather in Paris today?”)
  • linkup-deep: the search will use an agentic workflow, which makes it in general slower, but it will be able to solve more complex queries (e.g. “What is the company profile of LangChain accross the last few years, and how does it compare to its concurrents?”)

Using structured output (advanced)

2

Installation

You need to install the OpenAI SDK and Pydantic using the following:
pip install openai pydantic
3

Usage

Here is a example of how to use the structured output with the OpenAI SDK:
from openai import OpenAI
from pydantic import BaseModel

class Winner(BaseModel):
  name: str
  year: str

class Response(BaseModel):
  winners: list[Winner]

client = OpenAI(
  base_url='https://api.linkup.so/v1',
  api_key="<YOUR API KEY>"
)

response = client.responses.parse(
  model="linkup-standard",
  input="Can you tell me which women were awarded the Physics Nobel Prize",
  text_format=Response,
)

print(response.output_parsed)
Facing issues? Reach out to our engineering team at [email protected] or via our Discord or book a 15 minutes call with a member of our technical team.