Coding guideVerified July 20, 2026

Use Kimi K3 in OpenCode

Follow the official provider flow to authenticate Moonshot, select Kimi K3 and verify max reasoning before you edit a repository.

OpenCode CLIMoonshot providermax variant
Difficulty: BeginnerAbout 8 minutes

Prerequisites

Confirm the CLI and account requirements first.

  • OpenCode 1.18.3 or newer
  • A Moonshot platform API key
  • A repository opened from your terminal
  • A clean or understood Git working tree before Agent edits

Configure OpenCode

Authenticate first, then select both the model and reasoning variant.

  1. 1

    Start provider authentication

    Run the login command from OpenCode's terminal workflow.

    Terminal
    opencode auth login
  2. 2

    Choose Moonshot AI (China)

    Select the provider named in Moonshot's official OpenCode guide and paste your API key when prompted.

  3. 3

    Select Kimi K3

    Open the model picker and choose Kimi K3 under the authenticated Moonshot provider.

    OpenCode command
    /models
  4. 4

    Select the max variant

    Open the variant picker and choose max, which matches Kimi K3's currently documented reasoning effort.

    OpenCode command
    /variants

Verify before editing

Check the active session, not just the stored credential.

  • The status bar shows Kimi K3
  • The provider shows Moonshot AI (China)
  • The selected variant shows max
  • Git status is understood before allowing edits

Troubleshooting

Fix provider, model and variant mismatches at their source.

SymptomLikely causeDirect fix
Kimi K3 is missing from /modelsMoonshot is not authenticated or the CLI is outdatedUpdate OpenCode, repeat auth login and choose Moonshot AI (China)
The session is not using maxThe model was selected without changing its variantRun /variants and select max

OpenCode FAQ

What to know before the first coding session.

Define a controlled coding Agent workflow

Specify repository boundaries, allowed tools and acceptance checks before granting an Agent write access.