如下为模型以及 model 传参示例:
| 模型 | 传入 model 参数 |
| kimi-k3 | moonshot/kimi-k3 |
| kimi-k2.7-code | moonshot/kimi-k2.7-code |
| kimi-k2.7-code-highspeed | moonshot/kimi-k2.7-code-highspeed |
| kimi-k2.6 | moonshot/kimi-k2.6 |
| kimi-k2.5 | moonshot/kimi-k2.5 |
具体可用模型请以厂商文档为准,查看 所有模型。
一、调用示例
调用模型前请确保已绑定月之暗面厂商的 API Key,前往控制台 模型与密钥页面 绑定。
二、SDK
使用 AI SDK// Node.js 18+import { createAiGateway } from "@edgeone/makers-models-provider";import { generateText } from "ai";const aiGateway = createAiGateway({ apiKey: process.env.MAKERS_MODELS_KEY,});const { text } = await generateText({ model: aiGateway("moonshot/kimi-k2.6"), max_tokens: 1024, prompt: "What can you do?",});使用 OpenAI JS SDKimport OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.MAKERS_MODELS_KEY, baseURL: "https://ai-gateway.edgeone.link/v1",});const completion = await client.chat.completions.create({ model: "moonshot/kimi-k2.6", max_tokens: 1024, messages: [{ role: "user", content: "What can you do?" }],});使用 Anthropic JS SDK// Node.js 18+import Anthropic from "@anthropic-ai/sdk";const client = new Anthropic({ apiKey: process.env.MAKERS_MODELS_KEY, baseURL: "https://ai-gateway.edgeone.link",});const message = await client.messages.create({ model: "moonshot/kimi-k2.6", max_tokens: 1024, messages: [{ role: "user", content: "What can you do?" }],});console.log(message.content[0].text);
三、cURL
使用 OpenAI Chat Completions API 请求curl -i -X POST "https://ai-gateway.edgeone.link/v1/chat/completions" \\ -H "Authorization: Bearer $MAKERS_MODELS_KEY" \\ -H "Content-Type: application/json" \\ -d '{ "model": "moonshot/kimi-k2.6", "max_tokens": "1024", "messages": [ { "role": "user", "content": "What can you do?" } ] }'使用 Anthropic Messages API 请求curl -i -X POST "https://ai-gateway.edgeone.link/v1/messages" \\ -H "X-Api-Key: $MAKERS_MODELS_KEY" \\ -H "Content-Type: application/json" \\ -d '{ "model": "moonshot/kimi-k2.6", "max_tokens": "1024", "messages": [{"role":"user","content":"What can you do?"}] }'