openclaw - 💡(How to fix) Fix Kimi Code integration broken in 2026.5.7 — TLS bug + cached broken endpoint

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

OpenClaw 2026.5.7 has native support for the kimi provider (Kimi Code), but three critical issues prevent direct usage without workarounds.

Error Message

Error: SSLV3_ALERT_BAD_RECORD_MAC (intermittent) or Expecting value: line 1 column 1 (char 0) (when SSL handshake succeeds but response is not JSON).

Root Cause

Root cause: Node.js 22.22.0's TLS stack has compatibility issues with Kimi Code's HTTPS endpoint. curl (system OpenSSL) works perfectly, but Node.js does not.

Fix Action

Fix / Workaround

OpenClaw 2026.5.7 has native support for the kimi provider (Kimi Code), but three critical issues prevent direct usage without workarounds.

Workaround: Local curl proxy

BugStatusWorkaround
TLS/SSL with Node.jsUnresolvedProxy with curl
Cached broken endpointUnresolvedManually edit openclaw.json
Config file ambiguityUnresolvedAlways use openclaw.json
kimi-coding tool formatReported in #41852Use kimi without hyphen

Code Example

[SSL: SSLV3_ALERT_BAD_RECORD_MAC] ssl/tls alert bad record mac (_ssl.c:2658)

---

import http.server, socketserver, subprocess

PORT = 9876
TARGET = 'https://api.kimi.com/coding'

class Handler(http.server.BaseHTTPRequestHandler):
    def do_POST(self):
        content_len = int(self.headers.get('Content-Length', 0))
        body = self.rfile.read(content_len)
        target_url = TARGET + self.path
        
        cmd = ['curl', '-s', '-w', '\nHTTP_CODE:%{http_code}', '--max-time', '60',
               '-X', 'POST', target_url]
        for k, v in self.headers.items():
            if k.lower() not in ('host', 'content-length', 'connection', 'accept-encoding'):
                cmd.extend(['-H', f'{k}: {v}'])
        cmd.extend(['-d', '@-'])
        
        result = subprocess.run(cmd, input=body, capture_output=True, timeout=65)
        stdout = result.stdout
        lines = stdout.split(b'\n')
        http_code = 200
        resp_body = stdout
        for i in range(len(lines) - 1, -1, -1):
            if lines[i].startswith(b'HTTP_CODE:'):
                http_code = int(lines[i].split(b':')[1])
                resp_body = b'\n'.join(lines[:i])
                break
        
        self.send_response(http_code)
        self.send_header('Content-Type', 'application/json')
        self.send_header('Content-Length', len(resp_body))
        self.end_headers()
        self.wfile.write(resp_body)
    
    def log_message(self, format, *args):
        pass

with socketserver.TCPServer(('127.0.0.1', PORT), Handler) as httpd:
    httpd.serve_forever()

---

systemd-run --user --unit=kimi-proxy --service-type=simple \
  -- bash -c 'python3 /tmp/kimi_curl_proxy.py > /tmp/kimi_curl_proxy.log 2>&1'

---

{
  "env": {
    "KIMI_API_KEY": "sk-kimi-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "kimi/kimi-for-coding"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "kimi": {
        "baseUrl": "http://127.0.0.1:9876",
        "apiKey": "${KIMI_API_KEY}",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "kimi-for-coding",
            "name": "Kimi Code",
            "contextWindow": 200000,
            "maxTokens": 8192,
            "reasoning": true
          }
        ]
      }
    }
  }
}

---

sudo systemctl restart openclaw.service
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw 2026.5.7 has native support for the kimi provider (Kimi Code), but three critical issues prevent direct usage without workarounds.

Issues Found

1. Node.js TLS incompatibility with api.kimi.com

Error: SSLV3_ALERT_BAD_RECORD_MAC (intermittent) or Expecting value: line 1 column 1 (char 0) (when SSL handshake succeeds but response is not JSON).

Root cause: Node.js 22.22.0's TLS stack has compatibility issues with Kimi Code's HTTPS endpoint. curl (system OpenSSL) works perfectly, but Node.js does not.

Evidence:

[SSL: SSLV3_ALERT_BAD_RECORD_MAC] ssl/tls alert bad record mac (_ssl.c:2658)

2. Cached broken endpoint in openclaw.json

The provider kimi was found with baseUrl: "http://127.0.0.1:18794" (a non-existent local proxy) in ~/.openclaw/openclaw.json. This causes all requests to fail immediately.

3. Config file confusion

OpenClaw reads ~/.openclaw/openclaw.json as the primary config, but many users (and docs) reference ~/.openclaw/config.json. Changes to config.json are ignored.

Workaround: Local curl proxy

We solved this by creating a local HTTP proxy that forwards OpenClaw's requests to Kimi Code via curl (which uses system OpenSSL and works correctly).

Proxy script

Save to /tmp/kimi_curl_proxy.py:

import http.server, socketserver, subprocess

PORT = 9876
TARGET = 'https://api.kimi.com/coding'

class Handler(http.server.BaseHTTPRequestHandler):
    def do_POST(self):
        content_len = int(self.headers.get('Content-Length', 0))
        body = self.rfile.read(content_len)
        target_url = TARGET + self.path
        
        cmd = ['curl', '-s', '-w', '\nHTTP_CODE:%{http_code}', '--max-time', '60',
               '-X', 'POST', target_url]
        for k, v in self.headers.items():
            if k.lower() not in ('host', 'content-length', 'connection', 'accept-encoding'):
                cmd.extend(['-H', f'{k}: {v}'])
        cmd.extend(['-d', '@-'])
        
        result = subprocess.run(cmd, input=body, capture_output=True, timeout=65)
        stdout = result.stdout
        lines = stdout.split(b'\n')
        http_code = 200
        resp_body = stdout
        for i in range(len(lines) - 1, -1, -1):
            if lines[i].startswith(b'HTTP_CODE:'):
                http_code = int(lines[i].split(b':')[1])
                resp_body = b'\n'.join(lines[:i])
                break
        
        self.send_response(http_code)
        self.send_header('Content-Type', 'application/json')
        self.send_header('Content-Length', len(resp_body))
        self.end_headers()
        self.wfile.write(resp_body)
    
    def log_message(self, format, *args):
        pass

with socketserver.TCPServer(('127.0.0.1', PORT), Handler) as httpd:
    httpd.serve_forever()

Run as systemd user service:

systemd-run --user --unit=kimi-proxy --service-type=simple \
  -- bash -c 'python3 /tmp/kimi_curl_proxy.py > /tmp/kimi_curl_proxy.log 2>&1'

OpenClaw config

Edit ~/.openclaw/openclaw.json (not config.json):

{
  "env": {
    "KIMI_API_KEY": "sk-kimi-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
  },
  "agents": {
    "defaults": {
      "model": {
        "primary": "kimi/kimi-for-coding"
      }
    }
  },
  "models": {
    "mode": "merge",
    "providers": {
      "kimi": {
        "baseUrl": "http://127.0.0.1:9876",
        "apiKey": "${KIMI_API_KEY}",
        "api": "anthropic-messages",
        "models": [
          {
            "id": "kimi-for-coding",
            "name": "Kimi Code",
            "contextWindow": 200000,
            "maxTokens": 8192,
            "reasoning": true
          }
        ]
      }
    }
  }
}

Then restart:

sudo systemctl restart openclaw.service

Technical Findings

Supported Kimi Code Models

  • kimi-for-coding — Main coding model
  • kimi-thinking — Reasoning variant

Correct Endpoint

  • Base URL: https://api.kimi.com/coding
  • Protocol: Anthropic Messages API (/v1/messages)
  • Do NOT use OpenAI endpoint (/v1/chat/completions) — returns access_terminated_error

Environment Variables

  • KIMI_API_KEY — Recognized natively by OpenClaw for the kimi provider

Native vs Custom Provider

  • Provider kimi is native in OpenClaw 2026.5.7
  • Using kimi-coding (with hyphen) triggers a hardcoded bug that forces OpenAI tool format (see #41852)
  • Always use kimi (no hyphen)

Bug Status

BugStatusWorkaround
TLS/SSL with Node.jsUnresolvedProxy with curl
Cached broken endpointUnresolvedManually edit openclaw.json
Config file ambiguityUnresolvedAlways use openclaw.json
kimi-coding tool formatReported in #41852Use kimi without hyphen

Environment

Related

  • #41852 — kimi-coding provider forces OpenAI tool format

Suggested Fixes

  1. Fix TLS connection to api.kimi.com in Node.js runtime
  2. Prevent caching of broken local proxy endpoints
  3. Clarify config file documentation (openclaw.json vs config.json)
  4. Respect baseUrl overrides for native providers when explicitly set

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Kimi Code integration broken in 2026.5.7 — TLS bug + cached broken endpoint