Brifing

Running DeepSeek, MiniMax and GLM in Claude Code and Android Studio

A unified configuration launcher for managing multiple LLM providers without credential leakage or profile conflicts.

ProAndroidDev - Medium4 min

1The Configuration Conflict Problem

Claude Code defaults to a single ~/.claude directory, causing providers to overwrite shared settings. When users switch between models like DeepSeek or MiniMax, the shared settings.json file creates state collisions. This leads to sessions resuming with incorrect model names, as the environment fails to isolate provider-specific configurations and API keys.

2Environment-Based Profile Isolation

The fix leverages the CLAUDE_CONFIG_DIR environment variable to map each provider to a unique directory. By setting this per process, terminal sessions remain isolated. This approach avoids file copying entirely, ensuring that history, plugins, and provider-specific choices do not bleed across different active sessions or concurrent terminal windows.

3Centralized Credential Management

To eliminate plaintext keys in JSON files, all credentials reside in a single chmod 600 protected credentials.env file. The launcher uses a subshell to resolve the selected key, injecting it into the process environment only at runtime. This ensures that sensitive API tokens never persist on disk within configuration files.

4Defining Provider-Specific Parameters

Each provider requires a dedicated configuration file defining its endpoint, models, and context window. Fields like ANTHROPIC_BASE_URL and AUTO_COMPACT_WINDOW are set explicitly. These values must align with the provider's official documentation as of October 2026, as model IDs and context limits change frequently, requiring periodic updates to these configuration files.

5The Unified CC Launcher

The custom cc launcher script serves as the single entry point for all operations. It utilizes two core functions: resolve_key for secure credential retrieval and prepare_env for environment setup. By unsetting legacy variables like ANTHROPIC_API_KEY, the script prevents conflicts with existing shell exports, ensuring the chosen provider's settings take precedence.

6Android Studio Agent Integration

Android Studio spawns agents as subprocesses that inherit the IDE's environment rather than the user's shell. This causes standard shell aliases to fail. The solution involves using the cc acp subcommand, which explicitly sets the environment for the Agent Client Protocol, ensuring the IDE uses the correct provider configuration.

7Maintaining Clean ACP Streams

The cc acp command is designed to keep stdout clean, as any stray log lines corrupt the JSON-RPC stream used by the IDE. By redirecting all logs to stderr, the agent can communicate reliably with the IDE. This prevents the common failure where the agent refuses to start due to protocol corruption.

8Custom Agent Server Setup

Users can define multiple custom agents in the ~/.jetbrains/acp.json file. By mapping specific commands like cc acp deepseek to distinct entries, developers can select their desired provider directly from the AI Chat agent picker. This provides a seamless UX, enabling provider switching without manually editing arguments or environment variables.

9Troubleshooting Provider Errors

When encountering 401 errors or unknown models, verify the exact ID in provider documentation. Running cc status provides visibility into the active configuration, while the /status command inside a session confirms the base URL. If the IDE agent fails, check that npx is reachable by setting the CC_NPX variable to an absolute path.

10Security and Design Caveats

While the chmod 600 protection secures keys from other users, it does not protect against malware running under the same user account. The design relies on the user maintaining the credentials.env file manually. By keeping the logic in one prepare_env function, the system ensures consistency between terminal and IDE usage.

11Comparison of Approaches

The new architecture replaces manual file copying with dynamic environment injection. Previously, users relied on scripts that drifted apart, leading to inconsistent key lookups. Now, a single source of truth for keys and configurations ensures that updates to a model ID in a .conf file propagate instantly to all entry points.

12Systemic Workflow Benefits

This modular setup transforms Claude Code from a single-provider tool into a flexible multi-model environment. By decoupling configuration from the filesystem and centralizing key management, developers gain reliable access to diverse LLMs. This robust framework minimizes operational overhead, allowing engineers to focus on coding rather than debugging their agent's infrastructure.

Original article: ProAndroidDev - Medium — Running DeepSeek, MiniMax and GLM in Claude Code and Android Studio