Skip to content

Instantly share code, notes, and snippets.

@kamilio
Created July 17, 2026 20:13
Show Gist options
  • Select an option

  • Save kamilio/c1280e6e7bd8c590c789b4cab6e00c94 to your computer and use it in GitHub Desktop.

Select an option

Save kamilio/c1280e6e7bd8c590c789b4cab6e00c94 to your computer and use it in GitHub Desktop.
Repro: Vercel AI Gateway rejects Kimi K3 documented builtin_function $web_search tool
// npm install openai
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.VERCEL_API_KEY,
baseURL: "https://ai-gateway.vercel.sh/v1",
});
const completion = await client.chat.completions.create({
model: "moonshotai/kimi-k3",
messages: [
{ role: "system", content: "You are Kimi." },
{
role: "user",
content:
"Please search for Moonshot AI Context Caching technology and tell me what it is.",
},
],
tools: [
{
type: "builtin_function",
function: { name: "$web_search" },
},
],
});
console.log(JSON.stringify(completion, null, 2));
@kamilio

kamilio commented Jul 17, 2026

Copy link
Copy Markdown
Author

Result

BadRequestError: 400 Invalid input: expected "function"

status: 400
type: invalid_request_error
param: tools.0.type
code: invalid_request_error

Kimi documentation: https://platform.kimi.ai/docs/guide/use-web-search

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment