How to use Kimi K2.6 for free with Cloudflare Worker AI
Kimi K2.6 from Moonshot AI is the latest open source model that is on par with Opus 4.6 (Max) mode based on the benchmarks.
It is available in Cloudflare Worker AI which you can use it for free. Probably for your personal projects, the limit might be sufficient.
We’ll be using Cloudflare’s AI Gateway who takes care of the request/response transformation, etc so that we can just use it with any SDK like OpenAI’s SDK or Anthropic’s SDK.
Let’s first create a new AI gateway
Make sure to configure the auth. You can turn on logging, caching, rate limiting based on your needs :)
In the code samples select “Unified API” and “Worker AI”
And here you go. Just replace the $CF_AIG_TOKEN token with the token that you’ve created.
Now you should be able to access any models that is available in Cloudflare Workers AI.
curl -X POST https://gateway.ai.cloudflare.com/v1/$CF_ACCOUNT_ID/nesin-ai/compat/chat/completions \
--header "cf-aig-authorization: Bearer $CF_AIG_TOKEN" \
--header "Content-Type: application/json" \
--data '{
"model": "workers-ai/@cf/moonshotai/kimi-k2.6",
"messages": [
{
"role": "user",
"content": "Why sky is blue?"
}
]
}'
{"id":"id-1776784307643","object":"chat.completion","created":1776784307,"model":"@cf/moonshotai/kimi-k2.6","choices":[{"finish_reason":"stop","index":0,"logprobs":null,"matched_stop":163586,"message":{"content":"The sky is blue because of a phenomenon called **Rayleigh scattering**.\n\nHere is the step-by-step explanation:\n\n1. **Sunlight is white, but it’s a mix of colors.** White light from the sun is made up of all the colors of the rainbow, each with different wavelengths. ..... By the time the light reaches you, nearly all the blue and green light has been scattered away, leaving mostly the longer red and orange wavelengths.","reasoning_content":"The user is asking a classic science question: \"Why is the sky blue?\" I need to provide a clear, accurate explanation of Rayleigh scattering that is accessible but scientifically correct.\n\nKey points to cover:\n1. Sunlight appears white but is made of all colors (wavelengths) of the visible spectrum\n2. ...... \nTone should be helpful and educational.","role":"assistant","tool_calls":null}}],"usage":{"prompt_tokens":13,"completion_tokens":791,"total_tokens":804,"prompt_tokens_details":{"cached_tokens":3}}}
And their dashboard to view the logs and other metrics is so clean as well.