Every Alter call reaches the third party in one of two modes: retrieve or proxy. The SDK exposes them as two separate methods (Documentation Index
Fetch the complete documentation index at: https://docs.alterauth.com/llms.txt
Use this file to discover all available pages before exploring further.
request vs proxy_request), and each requires a different scope on the API key. Most operators only need to know the tradeoffs to pick a default; HITL forces the choice.
| Retrieve | Proxy | |
|---|---|---|
| SDK method | app.request(...) | app.proxy_request(...) |
| Scope | tokens:retrieve | proxy:execute |
| Token returned to SDK | Yes — to the SDK process, never to application code | No — stays on the backend |
| Who calls the third party | The SDK, from the application process | The Alter backend |
| HITL compatible | No — see below | Yes |
| Streaming / WebSocket | Yes | Limited |
| Audit granularity | Token issuance + outcome | Full wire-level request + response |
How a call flows in each mode
Retrieve
Proxy
When to pick retrieve
- The default for high-volume, low-stakes calls (a fleet of agents pulling calendar events).
- Long-lived SDK processes with pooled HTTP clients to the provider — the SDK keeps connection state the proxy can’t replay.
- Streaming endpoints, Server-Sent Events, WebSockets, or any protocol where an extra hop adds unacceptable latency.
- Calls that need provider-SDK features the proxy doesn’t surface (e.g., the Google SDK’s retry semantics, or a provider’s signed-request helper).
When to pick proxy
- Any grant that uses HITL approval — proxy is required. Retrieve mode fails closed with
hitl_grant_requires_proxy. - Centralized audit of the exact wire request and response, not just the token issuance event.
- Strong isolation of credentials from the application process (no token in caller memory, no risk of token leaking into crash dumps or APM traces).
- Centralized policy enforcement at the call site, not just at token mint — the backend can deny based on the actual request body, headers, or method.
- Token refresh handled transparently mid-call without the SDK observing the new token.
Why HITL is proxy-only
In retrieve mode the SDK holds the token. The approver sees a request payload at approval time; the SDK can then call the provider with a different payload using the same token. There is no integrity binding between the approved payload and the executed payload. In proxy mode the backend holds the token and the approved payload. The execution call uses both, atomically. The approver is reviewing the exact bytes that will reach the provider. This is enforced by the backend, not the SDK: any grant with HITL configured fails closed in retrieve mode with400 hitl_grant_requires_proxy. There is no policy knob to disable it.
Scoping a key for each mode
Alter scopes on the API key gate which mode the key can use:tokens:retrieve— required forapp.request().proxy:execute— required forapp.proxy_request().
What’s next
- Add human-in-the-loop approvals — the only path that mandates proxy mode.
- Scopes —
tokens:retrieveandproxy:executein the wider scope catalog. - Security architecture — the credential pipeline both modes share.