Generate code using Moonshot AI provider integration
Promptfoo example comparing Moonshot's kimi-k3 and kimi-k2.6 models on a summarization task with plain keyword assertions.
Why it matters
Test and validate AI code generation capabilities by integrating the Moonshot AI provider into your promptfoo evaluation workflow.
Outcomes
What it gets done
Configure Moonshot AI provider connection in promptfoo
Run code generation prompts through Moonshot models
Evaluate Moonshot provider responses against test cases
Compare Moonshot output quality with other AI providers
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-provider-moonshot | bash Steps
Steps in the chain
Overview
Provider Moonshot
A Promptfoo example comparing Moonshot's kimi-k3 flagship thinking model against the cheaper kimi-k2.6 on a summarization task. Use to compare Kimi's flagship and prior-generation models on the same task, or as a starting point for evaluating any Moonshot-hosted model.
What it does
Compares two Moonshot AI (Kimi) models on a short summarization task, both authenticated with a single MOONSHOT_API_KEY: kimi-k3, Moonshot's flagship "thinking" model that reasons before answering (with showThinking: false keeping that reasoning out of the graded output), against kimi-k2.6, the cheaper previous-generation thinking model with reasoning explicitly disabled via the K2.x-only passthrough: { thinking: { type: disabled } } control. Grading uses plain icontains/icontains-any assertions rather than embeddings-based checks, since Moonshot doesn't expose an embeddings endpoint.
When to use - and when NOT to
Use this to compare Kimi's current flagship reasoning model against its cheaper prior-generation model on the same task, or as a starting point for evaluating any Moonshot-hosted model. Leave temperature and other sampling parameters unset - Kimi models pin these to fixed values themselves, so setting them yourself has no effect. Model IDs rotate over time, so if a configured model 404s, swap in a current ID from Moonshot's own model list rather than assuming the example is broken.
Inputs and outputs
npx promptfoo@latest init --example provider-moonshot
cd provider-moonshot
Requires only a MOONSHOT_API_KEY environment variable, obtained from the Kimi/Moonshot platform's API-keys console. Run the eval with promptfoo eval and inspect the side-by-side comparison with promptfoo view.
Integrations
Integrates Moonshot AI's Kimi models (kimi-k3, kimi-k2.6) as Promptfoo providers, authenticated via MOONSHOT_API_KEY, with no other external service required since the example avoids embeddings-based assertions entirely.
Who it's for
Teams evaluating Moonshot/Kimi models who want a working comparison between a current flagship thinking model and a cheaper prior-generation one, using simple keyword assertions rather than an embeddings-dependent grading setup.
Source README
provider-moonshot (Moonshot AI / Kimi)
You can run this example with:
npx promptfoo@latest init --example provider-moonshot
cd provider-moonshot
Usage
Set your MOONSHOT_API_KEY environment variable. You can get a key from the Kimi (Moonshot) platform.
Then run:
promptfoo eval
View the results with promptfoo view.
What this shows
- Two Kimi generations compared on a short summarisation task, both on a single
MOONSHOT_API_KEY:kimi-k3- Moonshot's flagship Kimi thinking model. It reasons before answering;showThinking: falsekeeps that reasoning out of the graded output.kimi-k2.6- the cheaper previous-generation thinking model, with reasoning turned off via the K2.x-onlypassthrough: { thinking: { type: disabled } }control.
- Plain
icontains/icontains-anyassertions, so the example runs with nothing but aMOONSHOT_API_KEY(Moonshot does not expose an embeddings endpoint).
Kimi (kimi-k3 / kimi-k2.x) models pin temperature and the other sampling params to fixed values, so leave them unset - the provider handles that for you. Model names rotate over time; if one 404s, pick a current id from the Kimi model list.
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.