StudioRelay
Connect Android Studio's AI Agent to the AI Models You Choose.
Tagline: One IDE Agent. Multiple AI Models. Zero Vendor Lock-in.
Overview
Android Studio's AI agent is powerful, but connecting it to alternative AI providers can involve compatibility challenges.
StudioRelay is an open-source compatibility gateway designed to bridge that gap.
It translates API requests and responses between Android Studio's AI agent and supported LLM providers, helping different models work within the same agentic development workflow.
Use Kimi. Use DeepSeek. Add more providers. Keep your IDE agent.
Android Studio's AI agent remains responsible for its agentic workflow, including understanding coding tasks, using project context, interacting with tools, and coordinating development operations. StudioRelay provides the local compatibility infrastructure between that IDE agent and your selected LLM provider, handling the protocol adaptation necessary for supported providers to work with the IDE's expected API behavior.
Problem Statement
When connecting Android Studio's AI agent to alternative LLM providers (such as DeepSeek or Kimi / Moonshot AI), developers frequently encounter API protocol divergences:
- Unsupported Message Roles (
HTTP 422: unknown variant developer): Android Studio sends system/developer prompts withrole: "developer". Strict upstream APIs (such as DeepSeek's deserializer) reject this role before inference begins. - Missing Endpoint (
POST /v1/responses 404): Android Studio AI Assistant calls the newer OpenAI Responses API (/v1/responses). Most alternative LLM providers only expose/v1/chat/completions. - Incompatible Request Parameters: Parameters like
store,metadata, orparallel_tool_callstrigger deserialization errors on alternative providers. - Blank Thinking Output: Models like DeepSeek Reasoner emit thinking in
reasoning_contentwhile leaving finalcontentempty, causing standard OpenAI clients to display blank answers. - Port and Service Conflicts: Running multiple alternative providers simultaneously typically causes port collisions and model dropdown confusion.
How StudioRelay Works
StudioRelay acts as a transparent, high-performance local proxy:
- Local Gateway: Binds locally (
127.0.0.1:5001for DeepSeek,127.0.0.1:5002for Kimi) with zero external exposure. - Protocol Adaptation: Intercepts
/v1/chat/completionsand/v1/responses, mapsdevelopermessages tosystem, filters unsupported parameters, and translates Responses API schemas into Chat Completions. - Reasoning Fallback: When thinking models return
reasoning_contentwith empty finalcontent, StudioRelay surfaces the reasoning as visible text so answers are never blank. - Zero-Latency Streaming: Translates Server-Sent Events (SSE) line-by-line in real time.
- Dual Service Isolation: Runs dedicated background service daemons on separate ports so both DeepSeek and Kimi can be active in Android Studio simultaneously.
Architecture Overview
Android Studio AI Agent
(or Cursor, VS Code, Aider, Open WebUI)
│
▼
┌──────────────────┐
│ StudioRelay │
│ Local Gateway │
│ (127.0.0.1) │
└────────┬─────────┘
│
▼
┌──────────────────┐
│ Compatibility │
│ Engine │
│ - Role Adapter │
│ - Param Filter │
│ - Responses API │
│ - Reasoning Map │
└────────┬─────────┘
│
┌──────────────┴──────────────┐
▼ ▼
DeepSeek Profile Kimi/Moonshot Profile
(Port 5001 / v1) (Port 5002 / v1)
│ │
▼ ▼
api.deepseek.com api.moonshot.ai
Supported Providers
- DeepSeek (
https://api.deepseek.com):- Supported models:
deepseek-chat,deepseek-reasoner,deepseek-v3-pro,deepseek-flash,deepseek-v3,deepseek-r1 - Automatic alias rewriting:
deepseek-chat➔deepseek-flash,deepseek-reasoner➔deepseek-flashwithreasoning_effort=high,deepseek-v3-pro➔deepseek-v4-pro - Normalizes
developerrole tosystemto prevent HTTP 422 errors - Normalizes
reasoning_contentfallback whencontentis empty
- Supported models:
- Kimi / Moonshot AI (
https://api.moonshot.ai):- Supported models:
kimi-k3,moonshot-v1-8k,moonshot-v1-32k,moonshot-v1-128k - Normalizes
developerrole tosystem - Strips unsupported parameters (
store,metadata,parallel_tool_calls)
- Supported models:
- OpenAI / Generic Passthrough:
- Preserves standard schema for native OpenAI endpoints or generic proxies
Features
- ⚡ Zero-Latency Streaming: Line-by-line SSE chunk forwarding.
- 🔄 Responses API Bridge: Seamless support for Android Studio's
/v1/responsesqueries. - 🧠 Reasoning Fallback: Always displays reasoning content if final content is empty.
- 🛡️ Zero Secret Logging: Never logs
Authorizationheaders, API keys, or tokens. - 🔌 Intelligent Port Allocation: Automatically detects port availability and avoids conflicts (
--auto-port). - 🖥️ Background Service Daemons: Native
systemduser units on Linux,launchdLaunchAgents on macOS, andTask Scheduleron Windows. - 📦 Zero Runtime Dependencies: Built entirely on the Python Standard Library (
http.server,urllib,dataclasses,argparse). - 🔙 Full Backward Compatibility: Seamlessly supports existing
kimibridgecommands, imports, configurations, and service files.
Prerequisites
- Python:
3.10+(3.10, 3.11, or 3.12) - Operating System:
- Linux:
systemdwith user session support (systemctl --user),procps - macOS: macOS 11.0 (Big Sur) or newer with
launchd - Windows: Windows 10/11 with PowerShell 5.1+ and Task Scheduler
- Linux:
- Git:
2.20+
Installation
Recommended: 1-Step Setup for DeepSeek
Linux / macOS:
git clone https://github.com/SubhankarCodeGeek/studio-relay.git
cd studio-relay
./installers/install-deepseek.sh
Windows (PowerShell):
git clone https://github.com/SubhankarCodeGeek/studio-relay.git
cd studio-relay
.\installers\install-deepseek.ps1
1-Step Setup for Kimi / Moonshot AI
Linux / macOS:
./installers/install-kimi.sh
Windows (PowerShell):
.\installers\install.ps1 -Kimi
Interactive Installation (Choose or Run Multiple Providers)
- Linux / macOS:
./installers/install.sh - Windows (PowerShell):
.\installers\install.ps1
The installer sets up application files in ~/.studiorelay/app and registers your background service.
Upgrade from KimiBridge
StudioRelay provides a safe, non-destructive upgrade path for existing KimiBridge installations:
-
Step 1: Migrate Configuration (Optional, installer also handles this)
studiorelay migrate --dry-run studiorelay migrate
This safely copies configs from
~/.kimibridge/to~/.studiorelay/with an automated timestamped backup in~/.kimibridge/backups/. Secrets are never logged. -
Step 2: Update Application & Services
cd studio-relay && git pull origin main ./installers/install.sh
The installer automatically detects active legacy
kimibridge-*.serviceunits, stops and disables them to prevent port collisions, and enables the newstudiorelay-*.service. -
Step 3: Verify Upgrade
studiorelay doctor
(Note: Legacy kimibridge commands and ~/.kimibridge configuration files remain fully functional via backward-compatibility aliases).
Android Studio Configuration
Configure supported providers in Android Studio without touching IDE internals:
1. Configure DeepSeek
- Open Android Studio ➔ Settings (or Preferences on macOS) ➔ Tools ➔ AI Assistant.
- Select Custom OpenAI Provider (or OpenAI-compatible).
- Set Base URL:
http://127.0.0.1:5001/v1 - Set API Key: Your DeepSeek API Key
- Click Refresh to populate models (
deepseek-chat,deepseek-reasoner,deepseek-v3-pro,deepseek-flash). - Click Apply.
2. Configure Kimi / Moonshot AI
- Add a second OpenAI-compatible provider entry in Android Studio.
- Set Base URL:
http://127.0.0.1:5002/v1 - Set API Key: Your Moonshot / Kimi API Key
- Click Refresh to populate models (
kimi-k3,moonshot-v1-8k, etc.). - Click Apply.
Both providers run concurrently in the background with zero port collisions and zero dropdown interference!
Provider Configuration
Switch or reconfigure target providers anytime:
# Switch to DeepSeek
studiorelay setup deepseek
# Switch to Kimi / Moonshot
studiorelay setup kimi
# Expose both provider model lists concurrently
studiorelay setup all
CLI Usage
StudioRelay provides a complete management CLI:
# Check version
studiorelay --version
# Show help
studiorelay --help
# Run comprehensive system diagnostics
studiorelay doctor
# Inspect running provider endpoints
studiorelay status
# View recent service logs
studiorelay logs
studiorelay logs --provider deepseek
# Start server in foreground (development mode)
studiorelay start --auto-port
# Migrate legacy configurations
studiorelay migrate
(The kimibridge CLI executable is also installed as an alias to studiorelay).
Configuration Management
Configuration precedence is strictly deterministic:
- Explicit path argument (
--config /path/to/config.json) STUDIORELAY_CONFIGenvironment variableKIMIBRIDGE_CONFIGenvironment variable (legacy)- StudioRelay directory (
~/.studiorelay/config-<provider>.jsonorconfig.json) - Legacy KimiBridge directory (
~/.kimibridge/config-<provider>.jsonorconfig.json)
To inspect or update settings:
# View active configuration (secrets masked)
studiorelay config show
# Set custom port
studiorelay config set port 5003
# Set custom upstream base URL
studiorelay config set base-url https://api.deepseek.com
# Change compatibility mode
studiorelay config set compatibility-mode compatible
Service Management
Linux (systemd --user)
# Check service status
systemctl --user status studiorelay-deepseek
# View journal logs
journalctl --user -u studiorelay-deepseek -n 50 --no-pager
# Restart service via CLI
studiorelay restart --provider deepseek
macOS (launchd)
studiorelay restart
studiorelay logs
Windows (Task Scheduler)
studiorelay restart
studiorelay status
Health Checks
StudioRelay provides local health diagnostic endpoints:
# Check JSON health endpoint
curl http://127.0.0.1:5001/health
# Output:
# {"status": "ok", "service": "kimibridge", "gateway": "studiorelay", "provider": "deepseek", "port": 5001}
Or run studiorelay doctor for complete endpoint validation.
Troubleshooting
- Port in Use: If port 5001 is already taken by another application, run
studiorelay start --auto-portorstudiorelay setup deepseek --port 5003. - 422 Unknown Variant Developer: Ensure Android Studio base URL points to
http://127.0.0.1:5001/v1so StudioRelay normalizes the message role. - Empty Thinking Output: Ensure you are running StudioRelay 0.3.0+, which automatically extracts
reasoning_contentinto visible output. - For more solutions, see Troubleshooting Guide.
Security
- Localhost Loopback Only: The server binds exclusively to
127.0.0.1. - Credential Safety: StudioRelay never logs, saves, or prints
Authorizationheaders or API keys. - Client Header Forwarding: API keys entered in Android Studio are forwarded directly to upstream providers via secure HTTPS.
- For complete details, see Security Policy.
Development Setup
# Clone the repository
git clone https://github.com/SubhankarCodeGeek/studio-relay.git
cd studio-relay
# (Optional) Create virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Verify bytecode compilation
python3 -m compileall studiorelay kimibridge tests
Running Tests
Run the full automated unit and integration test suite:
python3 -m unittest discover -s tests
All tests execute with local mocks and require zero external API credits or credentials.
Contributing
We welcome contributions! Please review our Contributing Guide for architecture details, testing conventions, and pull request guidelines.
License
MIT © StudioRelay contributors.
Metadata
Release files for studiorelay 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| studiorelay-0.3.0.tar.gz | 66.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| studiorelay-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 127.1 kB
Release files / studiorelay-0.3.0.tar.gz
| Download URL | studiorelay-0.3.0.tar.gz |
|---|---|
| Size | 66.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1038f33059df6da78899e5584e5ea9fad2e4541bfd556b89b93626a3d8304058
|
|
BLAKE2b-256 checksum How to use checksums |
36b0e2bb53871991d51d3cb12ae81ec12e83efd408c1a1fd5cdb403420018228
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency logRelease files / studiorelay-0.3.0-py3-none-any.whl
| Download URL | studiorelay-0.3.0-py3-none-any.whl |
|---|---|
| Size | 60.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7a0b16fbf6fb28ea4895010bc113b266368c74584ef8b319cec989cad955b17b
|
|
BLAKE2b-256 checksum How to use checksums |
ad0570c0bb146c24d1c9e2dcd0cab1521bacf99215fa27f8395cde4cfc9c9efc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.
Transparency log