Use the OpenAI SDK
Point an existing OpenAI client at Deeplinq and stream a response.
Deeplinq implements the OpenAI chat-completions and models surfaces. Configure the SDK with the engine base URL and a Deeplinq credential. See the parameter compatibility matrix for which request fields are implemented, rejected, or silently tolerated.
TypeScript
import OpenAI from "openai"
const client = new OpenAI({
apiKey: process.env.DEEPLINQ_TOKEN,
baseURL: `${process.env.DEEPLINQ_BASE_URL}/v1`,
})
const stream = await client.chat.completions.create({
model: "auto",
stream: true,
messages: [{ role: "user", content: "Explain reciprocal rank fusion." }],
})
for await (const event of stream) {
process.stdout.write(event.choices[0]?.delta.content ?? "")
}Python
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["DEEPLINQ_TOKEN"],
base_url=f'{os.environ["DEEPLINQ_BASE_URL"]}/v1',
)
response = client.chat.completions.create(
model="auto",
messages=[
{
"role": "user",
"content": "Explain reciprocal rank fusion.",
}
],
)
print(response.choices[0].message.content)Web search
Set web_search_options. Deeplinq runs each search with its own search, never
the AI company's, and the answer cites its sources as url_citation
annotations:
const completion = await client.chat.completions.create({
model: "gpt-5-mini",
messages: [
{
role: "user",
content: "What happened to lithium prices this week? Cite your sources.",
},
],
web_search_options: {},
})
console.log(completion.choices[0].message.annotations)A stream carries the text and annotations but no search progress. See Web search on the chat endpoints for the fields, citations, caps and charging.
Tenant attribution
When you act for a person, use their end-user token. The user travels inside the token, so there is no header to set and nothing for an untrusted client value to reach:
const client = new OpenAI({
apiKey: await accessTokenFor(authenticatedUser), // that user's own token
baseURL: `${process.env.DEEPLINQ_BASE_URL}/v1`,
})Spend, per-user limits and resource ownership all follow the principal the token resolves to. A machine token carries no end user: its spend is organization-level, and user-owned endpoints refuse it.