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,38 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if (Test-Path -LiteralPath ".env") {
|
||||
Get-Content -LiteralPath ".env" | ForEach-Object {
|
||||
$line = $_.Trim()
|
||||
if ($line -and -not $line.StartsWith("#") -and $line.Contains("=")) {
|
||||
$name, $value = $line -split "=", 2
|
||||
[Environment]::SetEnvironmentVariable($name.Trim(), $value.Trim(), "Process")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $env:MIMO_API_KEY) {
|
||||
Write-Error "MIMO_API_KEY is not set. Copy .env.example to .env and add your Xiaomi MiMo API key."
|
||||
}
|
||||
|
||||
$hostAddress = if ($env:HOST) { $env:HOST } else { "127.0.0.1" }
|
||||
$portNumber = if ($env:PORT) { $env:PORT } else { "8787" }
|
||||
|
||||
$installedPython = Join-Path $env:LOCALAPPDATA "Programs\Python\Python313\python.exe"
|
||||
if (Test-Path -LiteralPath $installedPython) {
|
||||
& $installedPython -m uvicorn mimo_gateway:app --host $hostAddress --port $portNumber
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
$python = Get-Command python -ErrorAction SilentlyContinue
|
||||
if ($python -and $python.Source -notlike "*WindowsApps*") {
|
||||
& $python.Source -m uvicorn mimo_gateway:app --host $hostAddress --port $portNumber
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
$pyLauncher = Get-Command py -ErrorAction SilentlyContinue
|
||||
if ($pyLauncher) {
|
||||
& $pyLauncher.Source -3 -m uvicorn mimo_gateway:app --host $hostAddress --port $portNumber
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
Write-Error "Python 3.11 or newer was not found. Install Python, then run this script again."
|
||||
Reference in New Issue
Block a user