Knowledge Base Sections ▾
Navigation
▸ Start here By rolesCategories
- Cursor + Gonka AI - cheap LLM for coding
- Claude Code + Gonka AI - LLM for the terminal
- OpenClaw + Gonka AI - affordable AI agents
- OpenCode + Gonka AI - free AI for code
- Continue.dev + Gonka AI - AI for VS Code/JetBrains
- Cline + Gonka AI - AI agent in VS Code
- Aider + Gonka AI - pair programming with AI
- LangChain + Gonka AI - AI applications for pennies
- n8n + Gonka AI - automation with cheap AI
- Open WebUI + Gonka AI - your own ChatGPT
- LibreChat + Gonka AI — open-source ChatGPT
- Hermes Agent + Gonka AI — Autonomous Agent for Pennies
- Kilo Code + Gonka AI — AI-Agent in VS Code
- Roo Code + Gonka AI — Autonomous AI Agent in VS Code
- LlamaIndex + Gonka AI — RAG applications for pennies
- PydanticAI + Gonka — typed AI agents for pennies
- Vercel AI SDK + Gonka AI — AI applications in TypeScript for pennies
- TanStack AI + Gonka — AI applications in TypeScript for pennies
- API quick start — curl, Python, TypeScript
- JoinGonka Gateway — a full overview
- Management Keys — SaaS on Gonka
- Cheapest AI API: Provider Comparison 2026
- Cursor Pro request limit reached — breakdown and cheaper alternative
- Claude Code is cheaper — bill breakdown and switching
- Cline is burning money — why the agent spends so much
- OpenClaw is expensive — why the agent burns through tokens and how to save
- OpenRouter: Cheap Alternative — Comparison with JoinGonka Gateway
- Best AI model for coding in 2026: comparison and prices
- Cheap alternative to GitHub Copilot without limits
- A cheap Windsurf alternative without credits or limits
- The cheapest API for AI agents in 2026
- ZCode: Cheap GLM inference instead of GLM Coding Plan
Tools
API quick start — curl, Python, TypeScript
JoinGonka Gateway provides an OpenAI + Anthropic compatible API to the decentralized Gonka network. Any code written for the OpenAI API (/v1/chat/completions) works with Gonka—just change base_url and api_key. And tools using the Anthropic API (Claude Code) connect via /v1/messages—directly, without a proxy.
This article provides ready-to-use code examples for the three most popular tools: curl (command line), Python, and TypeScript/Node.js (OpenAI format). For Anthropic format, see the Claude Code instructions.
What you need: a JoinGonka API key (jg-xxx format). Get it for free at gate.joingonka.ai/register along with a bonus of 10M tokens.
curl — request from terminal
The fastest way to test the API is via curl:
Standard request:
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?"}
]
}'Streaming:
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
}'The response comes in JSON format (standard) or Server-Sent Events (streaming) — fully compatible with the OpenAI API.
Python — openai SDK
The official OpenAI Python SDK works with JoinGonka Gateway without any changes:
pip install openaiRegular request:
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)Streaming:
stream = client.chat.completions.create(
model="MiniMaxAI/MiniMax-M2.7",
messages=[{"role": "user", "content": "Write a sort function in Python"}],
stream=True,
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")Tool calling:
import json
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get 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}")Kimi K2.6 supports native tool calling — functions are called correctly, without parsing text responses.
TypeScript/Node.js — openai SDK
Installation:
npm install openaiRegular request:
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();Streaming:
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);
}Tool calling:
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}`);All examples use the official OpenAI SDK — no additional libraries required. Just replace base_url and api_key.
Supported API parameters
JoinGonka Gateway supports all standard OpenAI Chat Completions API parameters:
| Parameter | Type | Description |
|---|---|---|
model | string | Model: MiniMaxAI/MiniMax-M2.7 |
messages | array | Message history (system, user, assistant) |
stream | boolean | Streaming generation (SSE). Default: false |
temperature | number | Response creativity (0.0 — 2.0) |
max_tokens | integer | Maximum response length (max: 8192 for all network models; default without max_tokens — 1500) |
tools | array | Function definitions for tool calling |
tool_choice | string/object | Function calling strategy |
Network model parameters: context window — 200K tokens, max response — up to 8192 tokens (for all network models). A list of models is available via GET /v1/models.
Two endpoints:
- OpenAI format:
POST https://gate.joingonka.ai/v1/chat/completions - Anthropic format:
POST https://gate.joingonka.ai/v1/messages
Authentication: Authorization: Bearer jg-your-key (OpenAI) or x-api-key: jg-your-key (Anthropic)
The response format is fully compatible with OpenAI and Anthropic — any SDK, library, or framework that supports the OpenAI or Anthropic API works with JoinGonka Gateway without modifications. Claude Code connects via the Anthropic format directly.