Use Moonshot's Kimi K2.7 Code (frontier open-weight coding model, 256K context, vision, native tool calling, extended reasoning) from the OpenAI SDK by changing only the base_url. In the $5 signup credit shortlist — no card required.
Kimi K2.7 Code is Moonshot's frontier open-weight coding model — 256K context, native tool calling, vision input, and extended reasoning. Coding-tuned and agentic: built for the multi-step, tool-heavy edit loops that coding agents run, at a fraction of frontier-closed pricing.
AIgateway hosts it behind an OpenAI-compatible endpoint. So instead of installing a Moonshot SDK, integrating their auth flow, or porting your tool-call schema, you change one line in your existing OpenAI SDK code.
The only difference from a normal OpenAI client is the base_url and the model slug. Streaming, tool calling, vision, reasoning_content, JSON mode all work the same.
from openai import OpenAI
client = OpenAI(
base_url="https://api.aigateway.sh/v1",
api_key="sk-aig-...",
)
stream = client.chat.completions.create(
model="moonshot/kimi-k2.7-code",
messages=[
{"role": "system", "content": "You are a coding agent."},
{"role": "user", "content": "Refactor this module to remove the dead branches."},
],
tools=my_tools,
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Same swap on the JS side — change the baseURL, change the model slug.
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.aigateway.sh/v1",
apiKey: process.env.AIGATEWAY_API_KEY,
});
const stream = await client.chat.completions.create({
model: "moonshot/kimi-k2.7-code",
messages: [{ role: "user", content: "hello" }],
stream: true,
});Every OpenAI-compatible coding agent slots in by changing the base URL and the model ID. Cursor: Settings → Models → Override OpenAI Base URL to https://api.aigateway.sh/v1, add model moonshot/kimi-k2.7-code. Cline: API Provider → OpenAI Compatible, same base URL, Model ID moonshot/kimi-k2.7-code.
# LangChain
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="moonshot/kimi-k2.7-code",
base_url="https://api.aigateway.sh/v1",
api_key="sk-aig-...",
)
print(llm.invoke("Hello!").content)Every new AIgateway account gets $5 in signup credit, no card required. Kimi K2.7 Code is the Moonshot chat model in the curated shortlist the credit spends on — the others are BGE-M3 embeddings, FLUX-2 Klein image, Gemma 4 vision, Aura 2 TTS, Whisper Turbo STT, and Llama Guard moderation. The credit expires 30 days after signup; once you top up any amount, the full catalog opens at pass-through + 5%.
Pricing is $0.95 / 1M input tokens and $4.00 / 1M output tokens — provider prompt-cached input bills at 50% ($0.475 / 1M). Get your key at aigateway.sh/signin and use the snippet above.