API文档

MeshTok是100% OpenAI兼容的网关。

1. 获取API密钥

Sign in to the 控制台 and create a token. Your key looks like sk-xxxx....

2. Base URL

OpenAI兼容(推荐)
https://meshtok.com/v1
Use with OpenAI SDK, Cursor, Cline, Aider, and most tools. Covers all 175 models.
Anthropic兼容
https://meshtok.com
Use with Claude Code, Anthropic SDK, and tools that require the Anthropic Messages API format.

Most users only need the OpenAI-compatible endpoint. All endpoints follow the OpenAI convention: /v1/chat/completions, /v1/models, /v1/embeddings.

3. Python示例

# pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://meshtok.com/v1",
    api_key="sk-your-MeshTok-key",
)

# any of 175 models -same code, just change the model name
resp = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role":"user","content":"Explain quantum computing in one sentence."}],
)
print(resp.choices[0].message.content)

4. JavaScript示例

// npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://meshtok.com/v1",
  apiKey: "sk-your-MeshTok-key",
});

const resp = await client.chat.completions.create({
  model: "bigmodel/glm-5.2",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

5. 流式输出

Add stream: true for Server-Sent Events streaming, identical to OpenAI's format.

curl https://meshtok.com/v1/chat/completions \
  -H "Authorization: Bearer sk-your-MeshTok-key" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-sonnet-5","messages":[{"role":"user","content":"Hi"}],"stream":true}'

6. 列出全部模型

curl https://meshtok.com/v1/models \
  -H "Authorization: Bearer sk-your-MeshTok-key"

Returns the full list of 175 available model IDs. Browse them visually on the models page.

功能指南

流式响应 →
OpenAI格式的Server-Sent Events。
函数/工具调用 →
154个模型可调用你的函数。
结构化输出 →
强制有效JSON。
视觉与图像输入 →
向58个视觉模型发送图像。
备用模型 →
实验室间自动故障转移。
编码代理与IDE →
配置Claude Code、Cursor、Cline、Aider。
多模态输入 →
图像、音频、视频、PDF — 69个模型。

准备好开始了吗? 获取API密钥