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: your own model in the terminal
- 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 + DeepSeek on the Gonka network — an 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
- How to buy AI tokens and an API key: 3 methods in 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
- 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
- Pi + JoinGonka Gateway — terminal agent on cheap inference
- Codex CLI: your own key instead of a subscription
- DeepSeek Harness: Your Own Provider via JoinGonka Gateway
- 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
- omp (Oh My Pi) + JoinGonka Gateway: an agent with model roles
- 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
- Zoo Code + JoinGonka Gateway: Migrating from Roo Code to Gonka 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
LangChain + Gonka AI - AI applications for pennies
LangChain is the most popular framework for building AI applications in Python and JavaScript. RAG pipelines, chains, agents, document handling — LangChain provides abstractions for all of this.
LangChain natively supports OpenAI-compatible APIs via the ChatOpenAI class. This means JoinGonka Gateway integrates in 3 lines of code — without additional packages or configuration.
Result: A RAG system, chatbot, or AI agent working for $0.0069/1M tokens instead of $2.50-15 at OpenAI.
Quick Start: 3 lines of code
A minimal example — connecting LangChain to Gonka:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
model="MiniMaxAI/MiniMax-M2.7",
)
response = llm.invoke("Explain what RAG is")
print(response.content)That's it. Three lines — and your LangChain project runs through the decentralized Gonka network for pennies.
Installing dependencies:
pip install langchain langchain-openaiRecommendation: explicitly set max_tokens=8192 — this is the output cap through JoinGonka Gateway for MiniMax M2.7 and GLM-5.3 Flash (DeepSeek V4 Flash goes up to 32768). The context window is 200K tokens for MiniMax M2.7 (380K for DeepSeek V4 Flash, 390K for GLM-5.3 Flash) — keep this in mind when setting chunk_size in RAG pipelines.
Example: RAG pipeline with Gonka
RAG (Retrieval-Augmented Generation) is the most popular pattern for AI applications. You load documents, split them into chunks, create embeddings, retrieve relevant fragments, and generate an answer with context.
from langchain_openai import ChatOpenAI
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain.chains import RetrievalQA
from langchain_community.vectorstores import FAISS
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.document_loaders import TextLoader
# 1. LLM via Gonka
llm = ChatOpenAI(
base_url="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
model="MiniMaxAI/MiniMax-M2.7",
streaming=True,
)
# 2. Load and index documents
loader = TextLoader("docs/my_document.txt")
docs = loader.load()
splitter = RecursiveCharacterTextSplitter(chunk_size=1000)
chunks = splitter.split_documents(docs)
# 3. Vector store (local, free)
embeddings = HuggingFaceEmbeddings()
vectorstore = FAISS.from_documents(chunks, embeddings)
# 4. RAG chain
qa = RetrievalQA.from_chain_type(
llm=llm,
retriever=vectorstore.as_retriever(),
)
# 5. Query
result = qa.invoke("What is this document about?")
print(result["result"])Cost: a single RAG pipeline request (retrieval + generation) uses ~2-5K LLM tokens. Through Gonka that's $0.00001-0.000024. Through OpenAI — $0.005-0.05. The difference — 1,300x.
For production systems handling thousands of requests a day, the savings add up to tens of thousands of dollars a month.
Example: AI agent with tool calling
LangChain lets you build agents with tools. The network's models support native tool calling — agents work reliably, without parsing text responses.
from langchain_openai import ChatOpenAI
from langchain.agents import create_openai_tools_agent, AgentExecutor
from langchain.tools import tool
from langchain.prompts import ChatPromptTemplate
llm = ChatOpenAI(
base_url="https://gate.joingonka.ai/v1",
api_key="jg-your-key",
model="MiniMaxAI/MiniMax-M2.7",
)
@tool
def calculator(expression: str) -> str:
"""Evaluates a math expression."""
return str(eval(expression))
@tool
def search_web(query: str) -> str:
"""Searches the web for information."""
return f"Search results for: {query}"
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful assistant."),
("human", "{input}"),
("placeholder", "{agent_scratchpad}"),
])
agent = create_openai_tools_agent(llm, [calculator, search_web], prompt)
executor = AgentExecutor(agent=agent, tools=[calculator, search_web])
result = executor.invoke({"input": "What is 2**10 * 3.14?"})
print(result["output"])The agent calls calculator, gets the result, and forms an answer. The whole cycle costs ~$0.00005 through Gonka. Through OpenAI — $0.01-0.05. For systems with thousands of users, that's a difference of tens of thousands of dollars.