Skip to content

Use Kimi K2.7 Code With Aider on WSL

Connect Aider to Kimi K2.7 Code through Moonshot's OpenAI-compatible API in WSL, with the current model ID and safe git workflow.

MGMCSA Guru Team August 27, 2026 2 min read
Aider using Kimi K2.7 Code inside WSL

Kimi K2.7 Code is Moonshot’s current coding-specific API model. It has a 256K context window and costs less than the K3 flagship, which makes it a sensible match for Aider’s text-based repository workflow.

Install Aider in WSL

If needed, install WSL using the Windows 11 WSL guide. Inside the Linux shell, install Aider with pipx:

sudo apt update
sudo apt install -y pipx
pipx install aider-chat
pipx ensurepath

Close and reopen the shell, then check aider --version.

Configure Moonshot

Create a Moonshot API key, then export the direct API endpoint and key:

export OPENAI_API_BASE="https://api.moonshot.ai/v1"
export OPENAI_API_KEY="YOUR_MOONSHOT_API_KEY"

Run Aider inside a git repository:

cd ~/projects/example
aider --model openai/kimi-k2.7-code

The openai/ prefix tells Aider to use its OpenAI-compatible client. OPENAI_API_BASE redirects that client to Moonshot.

Save the model choice

You can put the non-secret default in .aider.conf.yml:

model: openai/kimi-k2.7-code

Keep the API key in an environment variable or secret manager. Do not add it to this file.

Work from a clean repository

Aider uses git to track its changes. Commit or stash your own work before starting, then review each diff and test result. Keeping the project in the WSL Linux file system, such as ~/projects, usually gives better filesystem performance than working under /mnt/c.

K2.7 Code is text-based. If the task depends on a screenshot or diagram, describe the relevant details or use a separate vision-capable model before asking Aider to edit code.

Troubleshooting

If requests go to OpenAI, OPENAI_API_BASE is missing from the current shell. If authentication fails, check OPENAI_API_KEY. A model-not-found error usually means the ID is misspelled or the key belongs to a service that expects a subscription alias.

If Aider is not found after installation, run pipx ensurepath, reopen WSL, and check again.

Kimi K2.7 Code Aider check

  • Install Aider with pipx inside WSL
  • Create a Moonshot API key
  • Set OPENAI_API_BASE to https://api.moonshot.ai/v1
  • Run openai/kimi-k2.7-code
  • Start from a clean git tree and review every diff

K2.7 Code is the current lower-cost Kimi model for Aider’s coding workflow. Use K3 instead when a task needs native vision, a larger context window, or Moonshot’s strongest flagship reasoning.

Frequently asked questions

Which Kimi model should I use with Aider?

Use kimi-k2.7-code for the current coding-specific pay-as-you-go model. Kimi Code subscription aliases are different.

What base URL does Aider use for Moonshot?

Use https://api.moonshot.ai/v1 with Aider's OpenAI-compatible provider.

Why use WSL?

Aider relies on git and shell tools. WSL provides the Linux environment used by most Aider instructions and avoids common Windows quoting problems.

Sources & further reading

Official vendor documentation referenced while writing this guide.

MG

MCSA Guru Team

IT & Systems Administration

We are working IT pros and system administrators who spend our days in Windows Server, Microsoft 365, and the wider Microsoft stack. MCSA Guru is where we write down the fixes and walkthroughs we wish we had found the first time.

MCSA Guru provides independent, educational IT guidance. Microsoft, Windows, Windows Server, Microsoft 365, Exchange, and Microsoft Teams are trademarks of Microsoft Corporation; Docker is a trademark of Docker, Inc. MCSA Guru is not affiliated with or endorsed by Microsoft or Docker. Always test changes in a safe environment before applying them in production.

Related guides

Fixing something right now?

Jump straight into the guide library or search for the exact error or task you are dealing with.