SeaLinkSeaLink
/
Back to integrations

Tool setup

OpenAI SDK Integration Guide

Set SeaLink's base URL and API Key in your existing OpenAI SDK code to call supported models.

SDKOpenAI-compatible

Key Concept

OpenAI SDKs support custom base_url settings. For standard chat, streaming, and tool-calling requests, you usually only need to set SeaLink's base_url and api_key; before production, test real requests with your target model to verify parameter compatibility.

Python

Basic Chat
from openai import OpenAI
client = OpenAI(
base_url="https://test.sealink.io/v1",
api_key="sk-sealink-your-key",
)
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello, SeaLink."}],
)
print(response.choices[0].message.content)
Streaming
from openai import OpenAI
client = OpenAI(
base_url="https://test.sealink.io/v1",
api_key="sk-sealink-your-key",
)
stream = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Write a haiku."}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Tool Calling
from openai import OpenAI
client = OpenAI(
base_url="https://test.sealink.io/v1",
api_key="sk-sealink-your-key",
)
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"}
},
"required": ["city"]
}
}
}]
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "What's the weather in Bangkok?"}],
tools=tools,
)
print(response.choices[0].message.tool_calls)

Node.js

Basic Chat
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://test.sealink.io/v1",
apiKey: process.env.SEALINK_API_KEY,
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello, SeaLink." }],
});
console.log(response.choices[0].message.content);

cURL

Bash (Windows/macOS/Linux)
curl https://test.sealink.io/v1/chat/completions \
-H "Authorization: Bearer $SEALINK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Hello"}]
}'

SDK Setup

Install Python SDK

pip install openai

Requires Python ≥ 3.8.

Install Node.js SDK

npm install openai

Requires Node.js ≥ 18.

Environment variable management

Never hardcode your API Key. Use environment variables: Windows: set SEALINK_API_KEY=sk-sealink-... macOS/Linux: export SEALINK_API_KEY=sk-sealink-... Or use a .env file with python-dotenv / dotenv.

Operating System Notes

Windows

Env vars: $env:SEALINK_API_KEY="sk-sealink-..." in PowerShell (temporary), or [Environment]::SetEnvironmentVariable for permanent. Python path: %LOCALAPPDATA%/Programs/Python/. Add to PATH if pip is not found.

macOS

Env vars: add export SEALINK_API_KEY=... to ~/.zshrc. Python: system Python is often old — brew install python for a newer version. Node.js: brew install node.

Linux

Env vars: add export SEALINK_API_KEY=... to ~/.bashrc. Python: sudo apt install python3-pip (Debian/Ubuntu) or sudo dnf install python3-pip (Fedora). Node.js: use nvm to install — avoid apt's old version.