Tài liệu API
MeshTok là cổng kết nối tương thích 100% với OpenAI. Nếu mã nguồn của bạn đã gọi OpenAI, bạn chỉ cần thay đổi hai thứ: base URL và khóa API.
1. Lấy khóa API của bạn
Sign in to the bảng điều khiển and create a token. Your key looks like sk-xxxx....
2. Base URL
Tương thích OpenAI (khuyến nghị)
https://meshtok.com/v1 Use with OpenAI SDK, Cursor, Cline, Aider, and most tools. Covers all 175 models.
Tương thích 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. Ví dụ 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. Ví dụ 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. Streaming
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. Danh sách tất cả model
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.
Hướng dẫn tính năng
Phản hồi streaming →
Server-Sent Events theo định dạng OpenAI. Python, JS, phân tích SSE thô.
Gọi công cụ & hàm →
Cho phép 154 model gọi hàm của bạn. Vòng lặp tác tử đầy đủ, gọi song song.
Đầu ra có cấu trúc →
Buộc JSON hợp lệ. Chế độ json_object và json_schema chặt chẽ.
Vision & đầu vào hình ảnh →
Gửi hình ảnh đến 58 model vision. URL, base64, OCR, đa ảnh.
Dự phòng model →
Tự động chuyển đổi dự phòng giữa các phòng thí nghiệm. Mẫu tuần tự và song song.
Tác tử mã hóa & IDE →
Thiết lập Claude Code, Cursor, Cline, Aider, Continue, Codex.
Đầu vào đa phương thức →
Hình ảnh, âm thanh, video, PDF — 69 model đa phương thức.
Sẵn sàng xây dựng? Lấy API key