Quanta

← Back to Briefings

Claude Code with Private Packages and Internal APIs

Coding agents at scaleEN237 reads

A private dependency and a staging endpoint should not require an unrestricted coding agent. This Quanta Briefings walkthrough uses npm as the package-manager example and separates model routing, package installation, and internal API access. Start in a disposable development environment with an existing lockfile and a narrowly scoped task.

01 · Step 1: Define Three Separate Access Boundaries

Before launching Claude Code, write down what each connection needs. Treat this as your initial access policy, not merely a troubleshooting checklist:

  • › Model relay: a Quanta credential used only for model requests.
  • › Package registry: a read-only credential restricted to the required private packages.
  • › Internal API: a short-lived staging identity limited to approved operations.

Require organizational approval before sending proprietary source code, package contents, or API responses through an external relay. Review proposed commands before approval; Claude Code’s security documentation explicitly leaves that responsibility with the operator.

02 · Step 2: Route Model Requests Through Quanta

For sustained engineering workloads, Quanta provides pay-as-you-go access with one balance across supported models and clients. Open a Quanta account, create your relay credential, and retrieve the Claude Code connection instructions.

In the shell that will launch Claude Code, set ANTHROPIC_BASE_URL to Quanta’s supplied API base address. Configure the credential using the authentication variable specified by Quanta. Claude Code supports ANTHROPIC_AUTH_TOKEN for bearer authentication and ANTHROPIC_API_KEY for API-key authentication; use the header your gateway expects rather than setting both indiscriminately.

Launch the client from that shell and make a minimal test request before exposing repository context. Select a supported model using Quanta’s documented identifier, not a guessed conversion of its display name.

03 · Step 3: Scope npm Authentication to the Private Registry

In the project’s .npmrc, map your organization’s package scope to its approved registry. Keep the authentication entry in a user-level configuration file outside the repository. For an illustrative registry host, the entry would be //packages.example.internal/:_authToken=${NPM_TOKEN}. Replace the host and include any registry path required by your deployment.

Inject NPM_TOKEN through your approved secret-management workflow. npm supports environment-variable substitution in configuration files and requires authentication settings to be scoped to a registry host or path. Do not paste the token into a prompt or commit its literal value.

04 · Step 4: Prove Dependency Installation Before Agent Work

Run npm ci --ignore-scripts yourself in the disposable environment. npm ci requires a lockfile, fails when it disagrees with package.json, and replaces an existing node_modules directory. The ignore-scripts option suppresses package lifecycle scripts during installation.

If installation fails, resolve registry mapping, authorization, certificate trust, or network connectivity before asking Claude Code to modify application code. Review any required lifecycle scripts separately, then approve only the build steps the project actually needs.

05 · Step 5: Give Internal APIs a Narrow Interface

Prepare a reviewed helper that retrieves its staging credential outside the repository, calls one approved operation, and returns only necessary, redacted fields. Prefer a fixed staging destination over an arbitrary URL argument. Start with read-only operations and synthetic records; reserve mutations for a separate approval.

Configure corporate proxy settings and certificate trust before starting Claude Code. Its documented network configuration supports proxy variables and custom certificate authorities; shell environment changes do not update an already-running session. Do not disable certificate verification to bypass a trust problem.

06 · Step 6: Restrict Network Access and Run One Task

Where supported, enable Claude Code’s sandbox and allow only the package, artifact, and staging hosts the workflow requires. Remember that its shell sandbox does not cover file tools, MCP servers, or hooks; review those access paths separately.

Give the agent a bounded assignment: update one client method using the installed private package, run existing tests, and validate the response shape through the staging helper. Require confirmation before publishing packages, changing credentials, or making write requests.

07 · Step 7: Review Changes and Measure Token Usage

Inspect the diff, lockfile changes, test results, and redacted API output before merging. Remove temporary credentials and retain only sanitized diagnostic material.

Review Quanta usage alongside the engineering result. Calls are metered on real tokens, with cache writes and cache reads priced separately. Keep reusable instructions stable and avoid repeatedly feeding large logs into the session. The goal is a reproducible, bounded workflow—not simply a successful first request.