知识库章节 ▾
导航
▸ 从这里开始 按角色类别
- Cursor + Gonka AI — 便宜的 LLM 用于编码
- Claude Code + Gonka AI — 终端的 LLM
- OpenClaw + Gonka AI — 可负担的 AI 代理
- OpenCode:在终端中使用自己的模型
- Continue.dev + Gonka AI — 适用于 VS Code/JetBrains 的 AI
- Cline + Gonka AI — VS Code 中的 AI 代理
- Aider + Gonka AI — 与 AI 结对编程
- LangChain + Gonka AI — 便宜的 AI 应用程序
- n8n + Gonka AI — 通过便宜的 AI 实现自动化
- Open WebUI + Gonka AI — 您的 ChatGPT
- LibreChat + Gonka AI — 开源 ChatGPT
- Hermes Agent + DeepSeek 在 Gonka 网络 — 极低成本的自主智能体
- Kilo Code + Gonka AI — VS Code 中的 AI 代理
- Roo Code + Gonka AI — VS Code 中的自主 AI 代理
- LlamaIndex + Gonka AI — 低成本的 RAG 应用程序
- PydanticAI + Gonka — 低成本的类型化 AI 代理
- Vercel AI SDK + Gonka AI — 低成本的 TypeScript AI 应用程序
- TanStack AI + Gonka — 低成本的 TypeScript AI 应用程序
- API 快速入门 — curl, Python, TypeScript
- JoinGonka Gateway - 全面概述
- 管理密钥 — Gonka 上的 SaaS
- 最便宜的AI API:2026年提供商对比
- 如何购买AI token和API密钥:2026年的3种方法
- Cursor Pro 请求限制已用尽 — 解析与廉价替代方案
- Claude Code 更便宜 — 账单解析与切换
- Cline 正在烧钱 — 为什么代理花费如此之多
- OpenClaw 成本高昂 —— 为什么 Agent 会疯狂消耗 Token 以及如何节省
- OpenRouter:廉价替代方案 — 与 JoinGonka Gateway 的对比
- 2026 年最佳编码 AI 模型:对比与定价
- GitHub Copilot 无限制低成本替代方案
- 无积分、无限制的廉价 Windsurf 替代方案
- 2026 年最便宜的 AI 代理 API
- ZCode:使用低成本 GLM 推理替代 GLM Coding Plan
- JetBrains IDE + JoinGonka Gateway — 使用自己的 endpoint 替代点数消耗
- GitHub Copilot BYOK — 使用自己的模型替代配额限制
- Zed + JoinGonka Gateway — 编辑器中的低成本推理
- Pi + JoinGonka Gateway — 基于低成本推理的终端代理
- Codex CLI:使用自己的密钥代替订阅
- DeepSeek Harness:通过 JoinGonka Gateway 连接自有提供商
- MiniMax Code:通过 Gonka 使用自备密钥运行 MiniMax 智能体
- Warp + JoinGonka Gateway — 在您端点上的终端代理
- Trae + JoinGonka Gateway — AI-IDE 中的 Gonka 网络模型
- Cherry Studio + JoinGonka Gateway — 桌面 AI 客户端
- omp (Oh My Pi) + JoinGonka Gateway:带模型角色的代理
- OpenHands + JoinGonka Gateway:专属 endpoint 上的智能体
- qwen-oauth 关闭后的 Qwen Code:通过 JoinGonka Gateway 工作
- Goose + JoinGonka Gateway:您的提供商和密钥到 keyring
- Crush + JoinGonka Gateway:基于 Gonka 网络模型的 Charm 代理
- Zoo Code + JoinGonka Gateway:从 Roo Code 迁移至 Gonka 模型
- Kimi Code CLI:通过 Gonka 使用您自己的密钥连接 Moonshot AI Agent
- Factory Droid + JoinGonka Gateway:在 Gonka 网络模型上使用 BYOK
- MiMo Code + JoinGonka Gateway:Gonka 网络模型上的 Xiaomi 代理
工具
API 快速入门 — curl, Python, TypeScript
JoinGonka Gateway 为去中心化 Gonka 网络提供了兼容 OpenAI + Anthropic 的 API。任何为 OpenAI API (/v1/chat/completions) 编写的代码都可以在 Gonka 上运行——只需更改 base_url 和 api_key。Anthropic API 工具 (Claude Code) 则通过 /v1/messages 直接连接,无需代理。
本文提供了三种最流行工具的现成代码示例:curl(命令行)、Python 和 TypeScript/Node.js (OpenAI 格式)。对于 Anthropic 格式,请参阅 Claude Code 指南。
你需要准备什么:一个 JoinGonka API 密钥(格式为 jg-xxx)。请在 gate.joingonka.ai/register 免费领取,并附赠 3M token。
curl — 终端请求
测试 API 最快的方法就是用 curl:
普通请求:
curl https://gate.joingonka.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer jg-your-key" \
-d '{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [
{"role": "user", "content": "What is Gonka?"}
]
}'流式传输(分块返回响应):
curl https://gate.joingonka.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer jg-your-key" \
-d '{
"model": "MiniMaxAI/MiniMax-M2.7",
"messages": [
{"role": "user", "content": "Write hello world in Python"}
],
"stream": true
}'响应以 JSON(普通)或 Server-Sent Events(流式传输)格式返回——与 OpenAI API 完全兼容。
Python — openai SDK
官方 OpenAI Python SDK 无需任何修改即可配合 JoinGonka Gateway 使用:
pip install openai普通请求:
from openai import OpenAI
client = OpenAI(
base_url="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
)
response = client.chat.completions.create(
model="MiniMaxAI/MiniMax-M2.7",
messages=[
{"role": "user", "content": "Explain blockchain in simple terms"}
],
)
print(response.choices[0].message.content)流式传输:
stream = client.chat.completions.create(
model="MiniMaxAI/MiniMax-M2.7",
messages=[{"role": "user", "content": "Write a sorting function in Python"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")工具调用:
import json
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the weather in a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
}]
response = client.chat.completions.create(
model="MiniMaxAI/MiniMax-M2.7",
messages=[{"role": "user", "content": "What is the weather in Moscow?"}],
tools=tools,
)
tool_call = response.choices[0].message.tool_calls[0]
print(f"Function: {tool_call.function.name}")
print(f"Arguments: {tool_call.function.arguments}")网络中的模型支持原生工具调用——函数可以被正确调用,无需解析文本响应。
TypeScript/Node.js — openai SDK
安装:
npm install openai普通请求:
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://gate.joingonka.ai/v1',
apiKey: 'jg-your-key',
});
async function main() {
const response = await client.chat.completions.create({
model: 'MiniMaxAI/MiniMax-M2.7',
messages: [
{ role: 'user', content: 'Write an Express.js server' },
],
});
console.log(response.choices[0].message.content);
}
main();流式传输:
const stream = await client.chat.completions.create({
model: 'MiniMaxAI/MiniMax-M2.7',
messages: [{ role: 'user', content: 'Explain async/await' }],
stream: true,
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content || '';
process.stdout.write(content);
}工具调用:
const response = await client.chat.completions.create({
model: 'MiniMaxAI/MiniMax-M2.7',
messages: [{ role: 'user', content: 'Convert 100 USD to EUR' }],
tools: [{
type: 'function',
function: {
name: 'convert_currency',
description: 'Currency conversion',
parameters: {
type: 'object',
properties: {
amount: { type: 'number' },
from: { type: 'string' },
to: { type: 'string' },
},
required: ['amount', 'from', 'to'],
},
},
}],
});
const toolCall = response.choices[0].message.tool_calls?.[0];
console.log(`Function: ${toolCall?.function.name}`);
console.log(`Arguments: ${toolCall?.function.arguments}`);所有示例均使用官方 OpenAI SDK——无需任何额外的库。只需替换你的 base_url 和 api_key 即可。
支持的 API 参数
JoinGonka Gateway 支持所有标准的 OpenAI Chat Completions API 参数:
| 参数 | 类型 | 说明 |
|---|---|---|
model | string | 模型:MiniMaxAI/MiniMax-M2.7 |
messages | array | 消息历史(system、user、assistant) |
stream | boolean | 流式生成(SSE)。默认:false |
temperature | number | 回复创意度(0.0 — 2.0) |
max_tokens | integer | 最大回复长度(上限:8192,DeepSeek V4 Flash 为 32768;不设置 max_tokens 时默认为 1500) |
tools | array | 用于 tool calling 的函数定义 |
tool_choice | string/object | 函数调用策略 |
网络模型参数:上下文窗口 — MiniMax M2.7 为 200K tokens(DeepSeek V4 Flash 为 380K,GLM-5.3 Flash 为 390K),最大回复 — 最多 8192 tokens(DeepSeek V4 Flash 最多 32768)。模型列表可通过 GET /v1/models 获取。
两个端点:
- OpenAI 格式:
POST https://gate.joingonka.ai/v1/chat/completions - Anthropic 格式:
POST https://gate.joingonka.ai/v1/messages
身份认证:Authorization: Bearer jg-your-key(OpenAI)或 x-api-key: jg-your-key(Anthropic)
响应格式与 OpenAI 和 Anthropic 完全兼容 — 任何支持 OpenAI 或 Anthropic API 的 SDK、库或框架,都能无需修改直接与 JoinGonka Gateway 配合使用。Claude Code 可通过 Anthropic 格式直接接入。