Initial commit: cross-platform MiMo-to-Anthropic local gateway
Adds a FastAPI-based local proxy that remaps Claude model IDs to Xiaomi MiMo and forwards requests to MiMo's Anthropic-compatible API. Includes launchers for Windows (start.ps1), macOS/Linux (start.sh), and Docker. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Load .env into the environment (skip comments and blank lines)
|
||||
if [ -f .env ]; then
|
||||
while IFS= read -r line; do
|
||||
line="${line%%#*}" # strip inline comments
|
||||
line="$(echo "$line" | xargs)" # trim whitespace
|
||||
[ -z "$line" ] && continue
|
||||
case "$line" in *=*) ;; *) continue ;; esac
|
||||
key="${line%%=*}"
|
||||
val="${line#*=}"
|
||||
val="${val%\"}"
|
||||
val="${val#\"}"
|
||||
export "$key=$val"
|
||||
done < .env
|
||||
fi
|
||||
|
||||
if [ -z "${MIMO_API_KEY:-}" ]; then
|
||||
echo "Error: MIMO_API_KEY is not set. Copy .env.example to .env and add your Xiaomi MiMo API key." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOST="${HOST:-127.0.0.1}"
|
||||
PORT="${PORT:-8787}"
|
||||
|
||||
# Prefer python3, fall back to python
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
PYTHON=python3
|
||||
elif command -v python >/dev/null 2>&1; then
|
||||
PYTHON=python
|
||||
else
|
||||
echo "Error: Python 3.11 or newer was not found. Install Python, then run this script again." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$PYTHON" -m uvicorn mimo_gateway:app --host "$HOST" --port "$PORT"
|
||||
Reference in New Issue
Block a user