← Docs
Function calling
Define tools with the OpenAI-style tools parameter. Choose models that list tool-calling support on the model detail page; complex tools, multi-tool selection, and argument reliability vary by model.
Example
Python
from openai import OpenAIclient = OpenAI(base_url="https://test.sealink.io/v1",api_key="<your-sealink-key>",)tools = [{"type": "function","function": {"name": "get_weather","description": "Get the current weather for a city","parameters": {"type": "object","properties": {"city": {"type": "string", "description": "City name"},"unit": {"type": "string", "enum": ["c", "f"]},},"required": ["city"],},},}]resp = client.chat.completions.create(model="qwen3-max", # or gpt-4-1, qwen3-max, doubao-1-5-vision-promessages=[{"role": "user", "content": "Weather in Bangkok in C?"}],tools=tools,tool_choice="auto",)call = resp.choices[0].message.tool_calls[0]print(call.function.name, call.function.arguments)# get_weather {"city": "Bangkok", "unit": "c"}
Node.js
import OpenAI from "openai";const client = new OpenAI({baseURL: "https://test.sealink.io/v1",apiKey: process.env.SEALINK_API_KEY,});const tools = [{type: "function" as const,function: {name: "search_docs",description: "Search internal documentation",parameters: {type: "object",properties: {query: { type: "string" },top_k: { type: "integer", default: 3 },},required: ["query"],},},}];const resp = await client.chat.completions.create({model: "qwen3-max",messages: [{ role: "user", content: "How do I refund a customer?" }],tools,tool_choice: "auto",});console.log(resp.choices[0].message.tool_calls);
Model support matrix
| Model | Level | Note |
|---|---|---|
| Claude family | Selected models | Use the model detail page to confirm Anthropic tool-use support. |
| GPT family | Selected models | OpenAI-style tools; behavior depends on the selected model. |
| Qwen family | Selected models | Use OpenAI-compatible request shape where tool calling is enabled. |
| Doubao / Kimi / DeepSeek / GLM | Model-dependent | Validate tool-call quality with your own schemas before production. |
Tip
- SeaLink keeps the tool-calling request shape OpenAI-compatible where supported. Test your own tool schemas end to end before launch.
- Specific tool and parameter descriptions usually improve tool selection and argument quality.
- For high-throughput workloads, load-test with low-risk tools first, then choose a model by latency, success rate, and cost.