API Key Portability as a First-Class Feature in Cloud Agent Platforms
Owning your key is not enough; custody and feature limits matter.

A bring-your-own API key runner for cloud coding agents should let the customer own the model-provider relationship while the platform runs the work. API key portability is a first-class infrastructure requirement because it determines billing, data routing, credential exposure, and the ability to leave. Running Claude Code or Codex in the cloud without managing infrastructure, on a platform such as Replicas, which runs each task in its own isolated VM and returns a pull request while customers bring their own model accounts, should not require surrendering control of provider access.
Why the way a cloud agent platform holds your API keys is an infrastructure decision, not a settings choice
A platform either resells model access from its own account or orchestrates work using a credential the customer owns. That choice establishes who controls the provider relationship. Under Bring Your Own Key, or BYOK, the buyer creates and owns the API key with the model provider, which bills the buyer directly, while the platform supplies orchestration.
Ownership, however, does not establish where a key is stored or which features accept it. A customer-owned key can still sit in a vendor’s hosted credential store, and a platform can accept that key for only part of its workflow. Those distinctions shape both exposure and exit leverage. The infrastructure decision therefore includes custody, supported execution paths, and revocation authority.
What a real breach looks like when credentials are held centrally
OpenCode disclosed on October 17, 2026, that a breach the previous night had exposed provider keys saved in hosted Console workspaces. Its statement said the incident “impacted 1.4% of OpenCode Console users.” The customer email warned that “Third party provider keys (eg OpenAI, Anthropic) saved in your workspace may have been exposed”. In this hosted credential-store incident, centralization had put multiple customers’ provider access within the reach of one infrastructure breach.
The co-founder made the boundary explicit in the statement “note this is the OpenCode Console, not OpenCode itself, those keys never come to us”. CLI users whose keys never left their local machine were outside that blast radius. The architectural distinction was that the optional hosted layer held credentials that the local tool did not send to the vendor.
Local storage presents a separate threat surface. Gen Digital reported that infostealers look for AI coding agent files by path, while Symantec reported that they look for agent credential files in a similar way. Keeping keys off a vendor’s servers thus closes off one way they can be exposed, but leaves the developer’s disk to be secured. BYOK without vendor-side custody addresses centralized storage risk, while keychain use and local credential hygiene address another.
How the thirteen agents in active use actually store keys, and where vendor-held storage appears
The October 2026 credential-storage landscape covered thirteen agents, including Aider, Claude Code, Cline CLI, Codex CLI, Crush, Gemini CLI, GitHub Copilot CLI, Goose, Kilo CLI, OpenCode, Pi, Qwen Code, and Atomic Agent. Most wrote plaintext files by default, fewer used the operating system keychain, and three vendors let customers store provider keys on their servers. This was not a uniform security model. A team using several harnesses could find that they stored keys in different ways even on the same machine.
Goose used the OS keychain to store provider keys by default on each operating system. GitHub Copilot CLI likewise defaulted to the system keychain for its GitHub login when one was available, with plaintext storage offered on headless Linux without a keychain. Two other agents used keychains only in part. Claude Code did so on macOS, while Gemini CLI used one for API keys entered into the app when available, but never on WSL.
Nine agents wrote plaintext files by default. Seven of those restricted the files to owner-only permissions, expressed as mode 0600, while Aider and Qwen Code used the default umask. The exceptions also need close attention. Goose without a keyring, Copilot CLI without a keychain, and Gemini CLI’s OAuth login all ended in plaintext files. For Claude Code on Linux and Windows, plaintext was the primary storage mechanism.
OpenCode Console and Kilo’s web BYOK page offered places to save provider keys. GitHub offered hosted BYOK in public preview for Copilot Enterprise and Business customers, configurable by enterprise and organization administrators. The presence of BYOK therefore did not identify a single custody model across these products.
Why Cursor’s removal of BYOK for agent features is the portability cautionary tale
Secure custody alone cannot preserve a workflow’s portability. A platform can protect a customer’s key while reserving important features for access billed through its own subscription. Cursor’s policy change illustrates this separate dependency. In late 2025, it restricted BYOK to standard chat models and required a paid Pro subscription, moving developers who had used their own keys onto paid subscriptions. The backlash was immediate, but the company did not reverse course.
The feature boundary is more precise than saying Cursor rejects customer keys altogether. Its BYOK support covers standard local chat and Agent requests. Tab completion, Auto routing, Cloud/Background Agents, Automations, and the Edit feature instead use Cursor’s tuned models or infrastructure and are metered through the subscription. A raw API key does not unlock those paths. Local Agent support and cloud-agent portability are therefore different procurement questions.
For teams that had built agent workflows around BYOK, the change repriced those workflows without a migration path. No credential theft was required for that disruption. It happened because the platform could decide which features a customer-owned credential could use. This is a structural policy risk wherever model access depends on vendor-controlled feature boundaries.
How Claude Code and OpenCode approach provider portability differently, and what each trades away
Claude Code offers key ownership within Anthropic’s ecosystem, running on Anthropic keys with routing available through Amazon Bedrock or Google Vertex AI, but does not accept a different model provider’s key. Its model portability remains within that ecosystem. That constraint is a deliberate design choice, and its cost and compliance implications follow from the provider relationship.
Storage introduces a separate operating-system distinction. Claude Code uses macOS Keychain by default, while on Linux it stores credentials in ~/.claude/.credentials.json with mode 0600. On Windows, it uses %USERPROFILE%\.claude\.credentials.json, which gets its access controls from the user profile directory. A deployment review needs to distinguish the provider restriction from the protection applied to the credential itself.
OpenCode, maintained by Anomaly under the MIT license, supports 75+ LLM providers and any OpenAI-compatible API. It also runs local models through Ollama, LM Studio, or llama.cpp, giving it the broadest provider portability in the surveyed set. Its local CLI preserves that choice without sending keys to the Console. The optional hosted store added another way keys could be exposed, as the October 2026 breach showed.
The comparison separates three properties that a BYOK label can blur, namely provider choice, credential ownership, and credential custody. Claude Code limits the first without necessarily surrendering the second. OpenCode broadens provider choice, but its hosted convenience layer changed where credentials were held. Neither posture can be understood from the number of supported models alone, because cloud workspaces and managed authentication can add centralized dependencies around an otherwise portable harness.
How do you run Claude Code or Codex in the cloud while retaining key ownership and isolation?
The infrastructure has connected requirements: run agents for the customer, use scoped credentials that the customer owns, and keep each task in an isolated environment. An agent in its own VM with its own scoped key limits credential exposure to that task. Isolation without credential scoping leaves provider access broader than the task boundary, while scoped keys alone do not establish an isolated runtime.
Managed AI key solutions can remove credential administration from individual developers while concentrating systemic risk at the platform level. A BYOK architecture with secure, scoped credentials instead lets security teams map narrow permissions to individual agents. The credential’s scope then bounds the downstream actions available to a compromised agent. For agentic workloads, that boundary should align with per-VM execution rather than depend solely on account-wide access controls.
Groundcover Agent Mode’s June 2026 update illustrates the related requirement for action-level attribution. Each action is tied to a specific authorized user and runs under that user’s permissions. Attribution reaches beyond the session as a whole. Applied to cloud-agent evaluation, the principle is that managed execution should preserve an identifiable authority for each action, rather than obscure it behind a shared platform identity.
What compliance and regulated-industry teams need to verify before adopting a cloud agent platform
Teams in regulated industries need to check both who owns the credentials and where the data goes. Source code, prompts, and model interactions may travel to third-party cloud services during an agent task, so the provider’s billing relationship does not establish whether the deployment meets compliance requirements. The deployment path needs its own review. A customer-owned key says who authorizes model access, but not where the platform executes work or which systems receive the code.
A practical procurement review should first establish whether the platform retains a copy of provider credentials or orchestrates with keys that remain under customer control. It should then trace where source code travels during execution, distinguishing the platform’s cloud, the model provider, and an isolated customer-controlled environment. Where data residency is a hard requirement, the next question is whether self-hosted or customer-cloud deployment is supported.
The review should also check whether every agent run records its harness, model, credential, and how long it ran. Those fields support access review and cost accountability. Reviewers need to check who enforces spend limits and rotates keys: the platform or administrators working manually in each provider dashboard. An answer that depends on manual provider administration is different from a platform-enforced control, even when both deployments advertise BYOK.
A security reviewer should be able to read how tokens are stored, encrypted, and refreshed rather than infer those controls from a marketing page. A closed, shared credential store concentrates exposure across tenants. The review therefore needs evidence of the custody boundary as well as a description of the customer-facing authentication feature.
How to evaluate a cloud agent platform’s credential posture before committing to it
A platform evaluation should test runtime behavior. First, establish where the key goes after submission, including whether the platform stores it, passes it through only at runtime, or never holds it. The answer should be documented. It should also identify which agent features use that credential, so a chat-only BYOK option is not mistaken for portable cloud execution.
A breach can reach different things when credentials sit in a shared store than when a key is scoped to one task in an isolated environment. Evaluators should ask whether provider accounts become reachable through the platform’s stored credentials. They should also inspect per-run attribution by harness, model, and credential, because a narrow permission model is difficult to review when the record does not identify the authority used.
Revocation provides a direct test of ownership. The customer should be able to rotate a key at the provider and remove the platform’s access without waiting for vendor cooperation. The OpenCode Console breach response supplied a concrete remediation lesson after one user reported total losses of $1,700. Revoke at the provider first, and confirm that the old key returns 401 before treating it as dead. The provider relationship is authoritative, while the platform’s access is subordinate to it.
Finally, the evaluation should distinguish emergency revocation from an orderly exit. The former tests whether credentials can be withdrawn independently, while the latter tests whether harnesses and workflows can move without being repriced through vendor-only features. Both need to be established before adoption. Retroactive mitigation cannot undo a period of unauthorized access or a workflow’s dependence on a subscription-only execution path.


