Knowledge Base Sections ▾
Navigation
▸ Start here By rolesCategories
- OpenCode: free models, providers and API key
- Cursor + Gonka AI - cheap LLM for coding
- Claude Code + Gonka AI - LLM for the terminal
- DeepSeek Harness: Your Own Provider via JoinGonka Gateway
- Codex CLI: your own key instead of a subscription
- Pi + JoinGonka Gateway — terminal agent on cheap inference
- omp (Oh My Pi) + JoinGonka Gateway: an agent with model roles
- Zoo Code + JoinGonka Gateway: Migrating from Roo Code to Gonka models
- Kilo Code + Gonka AI — AI-Agent in VS Code
- ZCode: GLM Coding Plan tiers, prices and limits
- Hermes Agent + DeepSeek on the Gonka network — an autonomous agent for pennies
- OpenClaw + Gonka AI - affordable AI agents
- 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
- 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
- How to buy AI tokens and an API key: 3 methods in 2026
- Free AI API: tokens on sign-up and for referrals
- Cursor Pro request limit reached — breakdown and cheaper alternative
- Cheaper Claude Code: GLM and DeepSeek instead of Claude
- Claude Code + DeepSeek V4 Flash: How to Connect It and What a Task Costs
- Cline is burning money — why the agent spends so much
- OpenClaw is expensive — why the agent burns through tokens and how to save
- OpenRouter alternative: the same models, many times cheaper
- 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
- JetBrains IDE + JoinGonka Gateway — your own endpoint instead of credits
- GitHub Copilot BYOK — own models instead of quotas
- Zed + JoinGonka Gateway — cheap inference in your editor
- MiniMax Code: MiniMax agent with your own key via Gonka
- Warp + JoinGonka Gateway — terminal agent on your own endpoint
- Trae + JoinGonka Gateway — Gonka network models in AI-IDE
- Cherry Studio + JoinGonka Gateway — desktop AI client
- OpenHands + JoinGonka Gateway: agent on your own endpoint
- Qwen Code after the closure of qwen-oauth: working via JoinGonka Gateway
- Goose + JoinGonka Gateway: your own provider and key in the keyring
- Crush + JoinGonka Gateway: Charm agent on Gonka network models
- Kimi Code CLI: Moonshot AI agent on your key via Gonka
- Factory Droid + JoinGonka Gateway: BYOK on Gonka network models
- MiMo Code + JoinGonka Gateway: Xiaomi agent on Gonka network models
Tools
LlamaIndex + Gonka AI — RAG applications for pennies
LlamaIndex is a leading framework for building RAG applications and AI agents in Python (there is also a TypeScript version, LlamaIndex.TS). It handles document loading, chunking, indexing, vector search, and response synthesis—you describe the data, and LlamaIndex turns it into a Q&A system over any LLM.
There is one problem — the cost of inference. RAG is inherently resource-intensive: for every question, the model receives the query plus several retrieved context fragments, and for indexing large collections, embeddings are added. At production volumes, this means thousands of requests per day. With OpenAI ($2.50–$15 per 1M tokens) or Anthropic ($3–$15 per 1M), even a modest Q&A service turns into tens of thousands of dollars per month.
LlamaIndex works natively with any OpenAI-compatible endpoint via the OpenAILike class. This means JoinGonka Gateway connects in just a few lines — without custom providers or patches. The result: the same RAG system runs for $0.0062/1M input tokens (output ×3) via the decentralized Gonka network — hundreds and thousands of times cheaper than cloud APIs.
Quick Start: Connecting via OpenAILike
JoinGonka API key: sign up at gate.joingonka.ai/register — you get 3M free tokens to start — and create a jg-xxx key in the Dashboard.
Installation:
pip install llama-index llama-index-llms-openai-likeFor any OpenAI-compatible API, LlamaIndex provides the OpenAILike class from the llama_index.llms.openai_like package. Here's a minimal request to Gonka:
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
api_base="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
model="MiniMaxAI/MiniMax-M2.7",
is_chat_model=True, # Gonka is a chat endpoint
is_function_calling_model=True, # native tool calling is supported
context_window=180000, # MiniMax M2.7 context window
max_tokens=8192, # Gateway output cap
)
response = llm.complete("Explain what RAG is in three sentences.")
print(response)Important about OpenAILike: always set is_chat_model=True — otherwise LlamaIndex will hit the legacy Completions endpoint with a raw prompt instead of a chat. is_function_calling_model=True enables native tool calls. Set context_window per model so LlamaIndex chunks context correctly.
Example: RAG pipeline with query engine
The classic LlamaIndex scenario — an index over your documents with queries against it through query_engine. The global LLM is set once via Settings.llm, and from then on the whole pipeline uses Gonka automatically.
from llama_index.core import (
VectorStoreIndex,
SimpleDirectoryReader,
Settings,
)
from llama_index.llms.openai_like import OpenAILike
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
# 1. LLM via Gonka (set once, globally)
Settings.llm = OpenAILike(
api_base="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
model="MiniMaxAI/MiniMax-M2.7",
is_chat_model=True,
context_window=180000,
max_tokens=8192,
)
# 2. Local embeddings (free, no OpenAI)
Settings.embed_model = HuggingFaceEmbedding(
model_name="BAAI/bge-small-en-v1.5"
)
# 3. Load and index documents from the ./data folder
documents = SimpleDirectoryReader("data").load_data()
index = VectorStoreIndex.from_documents(documents)
# 4. Query the knowledge base
query_engine = index.as_query_engine()
response = query_engine.query("What is this document about?")
print(response)A critical caveat about embeddings: by default VectorStoreIndex uses OpenAI embeddings (text-embedding-ada-002) — those are separate paid calls to OpenAI, not to Gonka. To move fully off OpenAI, set a local embedding model via Settings.embed_model (as in the example above — HuggingFaceEmbedding, package pip install llama-index-embeddings-huggingface). Then generation runs through Gonka while vectorization happens locally and for free.
Cost: a single RAG pipeline request (retrieval + generation) consumes ~2–5K LLM tokens. Through Gonka that's fractions of a cent; through OpenAI/Anthropic it's 3–4 orders of magnitude more expensive. At a volume of thousands of requests per day, the difference turns into tens of thousands of dollars in monthly savings.
Comparison of RAG Load Costs
A RAG application isn't a one-off chat, it's a constant stream of requests: every user question pulls in 2–5K LLM tokens (the question itself plus the retrieved context fragments). Let's tally up typical volumes and what they cost across different providers. Gonka prices through JoinGonka Gateway: input ~$0.0062/1M, output ×3.
| Scenario | LLM tokens | OpenAI / Anthropic | JoinGonka Gonka |
|---|---|---|---|
| One question to a knowledge base | ~4K | $0.01 — $0.06 | ~$0.00004 |
| Support chatbot (1K requests/day) | ~4M/day | $10 — $60 per day | ~$0.038 per day |
| Indexing + Q&A over a corpus (1M words) | ~5M | $12 — $75 | ~$0.048 |
| Production service, 50K requests/month | ~200M/month | $500 — $3,000 per month | ~$1.92 per month |
With the free 3M tokens, you can run your first RAG pipeline requests, index a test corpus, and push through thousands of queries — without spending a cent. At production volumes, JoinGonka Gateway turns RAG from an expensive service into a line item you barely even notice.
Agents, tool calling and model selection
LlamaIndex can do more than answer questions over documents — it can also build agents with tools. All three Gonka models support native tool calling: agents invoke functions in a structured way, with no text parsing. Here's an example of an agent with a tool:
import asyncio
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(
api_base="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
model="MiniMaxAI/MiniMax-M2.7",
is_chat_model=True,
is_function_calling_model=True,
context_window=180000,
max_tokens=8192,
)
def multiply(a: float, b: float) -> float:
"""Multiplies two numbers."""
return a * b
agent = FunctionAgent(
tools=[multiply],
llm=llm,
system_prompt="You are a helpful assistant. Use the tools for calculations.",
)
async def main():
result = await agent.run("What is 1234 multiplied by 5678?")
print(result)
asyncio.run(main())Choosing a model (the model field and the corresponding context_window / max_tokens limits):
Model (model) | Context | Max output | When to use |
|---|---|---|---|
MiniMaxAI/MiniMax-M2.7 | 180K | 8192 | Default (as in the example): tool calling, agents, RAG |
deepseek-ai/DeepSeek-V4-Flash-0731 | 380K | 32768 | Second-longest context on the network, longest output, cheap large prompts |
zai-org/GLM-5.3-Flash | 390K | 8192 | Reasoning model: complex logic, longest context on the network; reasoning consumes part of max_tokens |
The max_tokens limit through the Gateway is up to 8192 for MiniMax M2.7 and GLM-5.3 Flash, and up to 32768 for DeepSeek V4 Flash. If max_tokens is not set for a non-streaming request, up to 1500 tokens are returned by default — for RAG answers and agent steps, set the value explicitly.
TypeScript: LlamaIndex.TS offers a mirror path — the OpenAI class from the @llamaindex/openai package accepts baseURL and apiKey (or reads the OPENAI_BASE_URL / OPENAI_API_KEY environment variables), so the same Gateway plugs into a Node.js stack too. If you're building AI applications on Python frameworks as well, check out the LangChain guide too.