feat: migrate Kimi from Moonshot to Artemox OpenAI API

- Add claude-openai-anthropic-proxy.py (Anthropic ↔ OpenAI translator)
- Rewrite claude_kimi to use native kimi CLI instead of Claude wrapper
- Add OpenAI-compatible API test helpers (_claude_test_openai_api, _handle_openai_api_response)
- Replace 127.0.0.1 with localhost for broader compatibility
- Add test for query-string handling in Kimi proxy
- Update README to reflect Artemox API usage
This commit is contained in:
2026-05-31 17:55:57 +07:00
parent a1bf8023a9
commit 42546b4dc1
4 changed files with 548 additions and 65 deletions

View File

@@ -13,6 +13,7 @@ fail() { echo "[FAIL] $1"; FAIL=$((FAIL+1)); }
# Extract sections
GPT_SECTION=$(awk '/^cat > "\$BIN_DIR\/claude_gpt"/,/^GPTEOF/' "$SCRIPT")
GEMINI_SECTION=$(awk '/^cat > "\$BIN_DIR\/claude_gemini"/,/^GEMINIEOF/' "$SCRIPT")
OPENAI_PROXY_SECTION=$(awk '/^cat > "\$OPENAI_ANTHROPIC_PROXY_BIN"/,/^PYEOF/' "$SCRIPT")
# ── Fix 2: trap EXIT kills proxy ──────────────────────────────────────────────
test_fix2_trap_exit() {
@@ -82,6 +83,15 @@ test_fix7_trap_tmp() {
fi
}
# ── Kimi/OpenAI proxy: Claude Code sends /v1/messages?beta=true ─────────────
test_kimi_proxy_accepts_query_string() {
if echo "$OPENAI_PROXY_SECTION" | grep -q 'urlparse(self.path).path'; then
ok "Kimi proxy: strips query string before routing /messages"
else
fail "Kimi proxy: does not handle /v1/messages?beta=true"
fi
}
# ── bash syntax of the whole script ─────────────────────────────────────────
test_script_syntax() {
if bash -n "$SCRIPT" 2>&1; then
@@ -99,6 +109,7 @@ test_fix3b_exit7_logic
test_fix4_gpt_revalidate
test_fix5_gemini_revalidate
test_fix7_trap_tmp
test_kimi_proxy_accepts_query_string
echo ""
echo "Results: $PASS passed, $FAIL failed"