Configure Kimi for Claude Code and Codex

Use these files to run Kimi models in Claude Code and Codex. Each tool expects different keys, so copy the file for your tool.

.claude/settings-kimi.json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "promptCacheTtl": "1h",
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your_moonshot_api_key",
    "ANTHROPIC_BASE_URL": "https://api.moonshot.ai/anthropic",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR": "1",
    "DISABLE_BUG_COMMAND": "1",
    "DISABLE_ERROR_REPORTING": "1",
    "CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY": "1",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k3[1m]",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2.7-code",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-k2.6",
    "ANTHROPIC_DEFAULT_FABLE_MODEL": "kimi-k3[1m]",
    "MAX_MCP_OUTPUT_TOKENS": "40000",
    "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "500000",
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1",
    "ENABLE_TOOL_SEARCH": "false",
    "CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL": "1",
    "CLAUDE_CODE_ENABLE_FINE_GRAINED_TOOL_STREAMING": "1",
    "CLAUDE_CODE_NEW_INIT": "1",
    "CLAUDE_CODE_NO_FLICKER": "1",
    "SLASH_COMMAND_TOOL_CHAR_BUDGET": "60000"
  },
  "attribution": {
    "commit": "",
    "pr": "",
    "sessionUrl": false
  },
  "permissions": {
    "defaultMode": "default",
    "allow": [
      "Bash(find:*)",
      "Bash(rg:*)",
      "Bash(echo:*)",
      "Bash(grep:*)",
      "Bash(ls:*)",
      "Bash(wc:*)",
      "Bash(cat:*)",
      "Bash(sed:*)",
      "Bash(tree:*)",
      "Bash(tail:*)",
      "Bash(pgrep:*)",
      "Bash(ps:*)",
      "Bash(sort:*)",
      "Bash(dmesg:*)",
      "Bash(done)",
      "Bash(ruff:*)",
      "Bash(nvidia-smi:*)",
      "Bash(pdflatex:*)",
      "Bash(biber:*)",
      "Bash(tmux ls:*)",
      "Bash(tmux capture-pane:*)",
      "Bash(tmux list-sessions:*)",
      "Bash(tmux list-windows:*)",
      "Bash(tmux has-session:*)",
      "Bash(tmux new-session:*)",
      "Bash(gh pr list:*)",
      "Bash(gh pr view:*)",
      "Bash(gh pr diff:*)",
      "Bash(gh api user:*)",
      "Bash(gh repo view:*)",
      "Bash(gh issue view:*)",
      "Bash(gh search:*)",
      "Bash(git branch --show-current:*)",
      "Bash(git diff:*)",
      "Bash(git status:*)",
      "Bash(git rev-parse:*)",
      "Bash(git push:*)",
      "Bash(git log:*)",
      "Bash(git -C :* branch --show-current:*)",
      "Bash(git -C :* diff:*)",
      "Bash(git -C :* status:*)",
      "Bash(git -C :* rev-parse:*)",
      "Bash(git -C :* push:*)",
      "Bash(git -C :* log:*)",
      "Bash(git fetch --prune:*)",
      "Bash(git worktree list:*)",
      "Bash(git show:*)",
      "Bash(uv run ruff:*)",
      "Bash(python --version:*)",
      "Bash(python -c:*)",
      "Bash(python3 -c:*)",
      "Bash(python -m json.tool:*)",
      "Bash(sleep:*)",
      "Bash(source .venv/bin/activate:*)",
      "Bash(mkdir -p:*)",
      "WebSearch",
      "WebFetch(domain:openai.com)",
      "WebFetch(domain:anthropic.com)",
      "WebFetch(domain:docs.anthropic.com)",
      "WebFetch(domain:ai.google.dev)",
      "WebFetch(domain:github.com)",
      "WebFetch(domain:gradio.app)",
      "WebFetch(domain:arxiv.org)",
      "WebFetch(domain:dl.acm.org)",
      "WebFetch(domain:openaccess.thecvf.com)",
      "WebFetch(domain:www.semanticscholar.org)",
      "WebFetch(domain:openreview.net)",
      "WebFetch(domain:doi.org)",
      "WebFetch(domain:link.springer.com)",
      "WebFetch(domain:pypi.org)",
      "WebFetch(domain:docs.ultralytics.com)",
      "WebFetch(domain:sli.dev)",
      "WebFetch(domain:docs.vllm.ai)",
      "WebFetch(domain:developer.themoviedb.org)",
      "mcp__tavily__tavily_extract",
      "mcp__tavily__tavily_search",
      "mcp__context7__resolve-library-id",
      "mcp__context7__get-library-docs",
      "mcp__github__get_me",
      "mcp__github__pull_request_read",
      "mcp__github__get_file_contents",
      "mcp__github__get_workflow_run",
      "mcp__github__get_job_logs",
      "mcp__github__get_pull_request_comments",
      "mcp__github__get_pull_request_reviews",
      "mcp__github__issue_read",
      "mcp__github__list_pull_requests",
      "mcp__github__list_commits",
      "mcp__github__list_workflows",
      "mcp__github__list_workflow_runs",
      "mcp__github__list_workflow_jobs",
      "mcp__github__search_pull_requests",
      "mcp__github__search_issues",
      "mcp__github__search_code",
      "mcp__wandb__query_wandb_tool",
      "mcp__wandb__query_wandb_entity_projects",
      "mcp__mongodb__list_databases",
      "mcp__mongodb__list_collections",
      "mcp__mongodb__get_collection_schema",
      "mcp__mongodb__collection-indexes",
      "mcp__mongodb__db-stats",
      "mcp__mongodb__count",
      "mcp__supabase__list_tables",
      "mcp__gcloud-observability__list_log_entries"
    ]
  },
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'CMD=$(jq -r \".tool_input.command\"); if ! echo \"$CMD\" | rg -qP \"(\\brm\\s+-|\\brm\\s+/|\\brmdir\\b|shutil\\.rmtree|os\\.remove|os\\.unlink|\\bsubprocess\\b|os\\.system|\\bopen\\(.*[\\x27\\\"]w|\\bcurl\\s|\\bwget\\s|\\bpip\\s+install|\\bkill\\s|\\bpkill\\b|\\bchmod\\b|\\bchown\\b|\\bmv\\s+|\\bcp\\s+|\\bdd\\s|\\bmkfs\\b|\\bgit\\s+push|\\bgit\\s+commit|\\bgit\\s+add|\\bgit\\s+stash|\\bgit\\s+rebase|\\bgit\\s+clean|\\bgit\\s+branch\\s+-[dD]|\\bgit\\s+reset|\\bgit\\s+checkout\\s+\\.|\\bapt\\s|\\byum\\s|\\bbrew\\s+install|\\bnpm\\s+install|\\bsudo\\s|\\bdocker\\s|\\bkubectl\\s|>\\s+/|>>\\s+/)\"; then printf \"{\\\"hookSpecificOutput\\\":{\\\"hookEventName\\\":\\\"PreToolUse\\\",\\\"permissionDecision\\\":\\\"allow\\\"}}\"; else printf \"{\\\"hookSpecificOutput\\\":{\\\"hookEventName\\\":\\\"PreToolUse\\\",\\\"permissionDecision\\\":\\\"ask\\\",\\\"permissionDecisionReason\\\":\\\"contains destructive operation, review carefully\\\"}}\"; fi'"
          }
        ]
      },
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "bash -c 'CMD=$(jq -r \".tool_input.command\"); S=$(printf \"%s\" \"$CMD\" | sed -e \"s/'\\''[^'\\'']*'\\''//g\" -e \"s/\\\"[^\\\"]*\\\"//g\"); if printf \"%s\" \"$S\" | grep -qE \"(^|[;&|(){}]|[[:space:]]do|[[:space:]]then|[[:space:]]else)[[:space:]]*timeout[[:space:]]\"; then printf \"{\\\"hookSpecificOutput\\\":{\\\"hookEventName\\\":\\\"PreToolUse\\\",\\\"permissionDecision\\\":\\\"deny\\\",\\\"permissionDecisionReason\\\":\\\"macOS has no timeout command on this host, so timeout N ... exits 127 with empty output and silently hides the real result (a remote ssh sweep can look idle when it is not). Use ssh -o ConnectTimeout=N, or gtimeout N (brew coreutils), or for a remote Linux host put timeout inside the ssh quotes.\\\"}}\"; fi'"
          }
        ]
      }
    ]
  },
  "outputStyle": "Concise",
  "model": "opus",
  "enabledPlugins": {
    "heroui-skills@claude-settings": true,
    "typescript-skills@claude-settings": true,
    "reusable-app-components@claude-settings": true,
    "qa@claude-settings": true,
    "agent-browser@claude-settings": true,
    "intelligent-compact@claude-settings": true,
    "github-dev@claude-settings": true,
    "humanize@claude-settings": true
  },
  "extraKnownMarketplaces": {
    "claude-settings": {
      "source": {
        "source": "github",
        "repo": "fcakyon/claude-codex-settings"
      }
    }
  },
  "showThinkingSummaries": true,
  "autoDreamEnabled": true,
  "spinnerTipsEnabled": false,
  "alwaysThinkingEnabled": true,
  "effortLevel": "medium",
  "cleanupPeriodDays": 9999,
  "showClearContextOnPlanAccept": false,
  "autoUpdatesChannel": "latest",
  "skillListingBudgetFraction": 0.02
}
.codex/config-kimi.toml
# Start a local Responses proxy before using this config:
#   export KIMI_API_KEY="your_kimi_api_key"
#   npx @codeproxy/cli --base-url https://api.kimi.com/coding/v1 --model k3 --apikey "$KIMI_API_KEY"

model = "k3"
model_provider = "kimi"
model_context_window = 1048576
model_reasoning_effort = "high"
model_supports_reasoning_summaries = false

[model_providers.kimi]
name = "Kimi K3 via local proxy"
base_url = "http://127.0.0.1:8787/v1"
wire_api = "responses"
stream_idle_timeout_ms = 600000