# Outbound proxies The `network` settings section sends outbound connections directly or through a named proxy, for everything or per service. [`sdk/network`](../packages/albedo_sdk/src/albedo_sdk/network.gleam) declares the section, parses its values, and resolves a service's route. [`core_settings`](../apps/albedo/src/albedo/settings/core_settings.gleam) registers it beside the daemon's other sections, so `/config` lists it under Tools. This is separate from the inbound [OpenAI-compatible proxy](proxy.md). ## Configure routes The section has three optional fields in `extensions.json`: - `proxies` names proxy URLs. - `services` picks a route per service id. `default` is the route for every service without its own, and unset `default` connects directly. - `profiles` picks a route per provider profile name for that profile's model requests (generation, Fast and Daybreak checks, Codex image generation), overriding its extension's service route. Quota polls, sign-in, catalogs, and discovery share accounts across profiles and keep the service route. A route is `direct` or a name from `proxies`. `/config` shows `services` and `profiles` as one picker per service or saved profile. A proxy URL has a scheme, host, and port: - `socks5://host:port` resolves the destination locally. - `socks5h://host:port` sends the destination hostname to the proxy. - `http://host:port` uses HTTP CONNECT, including for HTTP destinations. A user, password, path, query, or fragment is refused. Proxy authentication is not supported. Setting a route does not start a proxy; it must already be reachable from the machine that connects. ```json { "network": { "proxies": { "tunnel": "socks5h://127.0.0.1:1080", "tor": "socks5h://127.0.0.1:9050" }, "services": { "default": "tunnel", "models": "direct" }, "profiles": { "work": "tor" } } } ``` The service ids are `discord`, `colab`, `mcp`, `models` (the models.dev catalog), and each provider or search extension's id, such as `claude`, `codex`, `openai`, or `exa`; an unknown id is refused. Tool jobs, SSH commands, and the browser opened for OAuth are not routed. ## Failures An invalid saved value fails every routed call rather than connecting directly, and so does a proxy that refuses or cannot be reached. Destination TLS still verifies the certificate and hostname through the tunnel. Command-based quota feeds and AWS `credential_process` cannot honor a proxy, so they are refused under one. ## Ownership A route is the [`albedo_http`](workspace-packages.md) package's [`route.Route`](../packages/albedo_http/src/albedo_http/route.gleam): `Direct`, or a `Proxy` with its scheme, host, and port. `sdk/network` owns only the policy that picks one. The client never looks a route up; its caller passes one in. [`network_context`](../packages/albedo_sdk/src/albedo_sdk/network_context.gleam) keeps the route for the calling process. `routed(service, run)` resolves and runs under a service's route; a spawned worker keeps its caller's route through `carried`, which is also the `carry` a [parallel map](../packages/albedo_process/src/albedo_process/parallel.gleam) takes in `map_carrying`. `connection_options()` turns the current route, with albedo's trusted roots, into the options a connection opens with. The roots are the host's: core's [trust policy](../apps/albedo/src/albedo/network/trust.gleam) keeps the OS store without the roots albedo blocks, and the host lends them through [host resources](runtime.md#host-resources), which `connection_options` reads each time a connection opens; [`sdk/http`](../packages/albedo_sdk/src/albedo_sdk/http.gleam), MCP's HTTP transport, and Codex image generation pass it. `transport()` adds the provider budget cap to those options for the stream pump [`albedo_model_stream/http`](../packages/albedo_model_stream/src/albedo_model_stream/http.gleam), which takes them as an argument and reads no route itself. Build either in the process that sends, since a route belongs to the calling process. `sdk/http` passes it to [`albedo_http/buffered`](../packages/albedo_http/src/albedo_http/buffered.gleam), which sends a direct request through httpc and a proxied one through the streaming client, and verifies HTTPS against those roots either way. Do not set process-wide proxy environment variables or the global `httpc` proxy to route one service. [`extension`](../packages/albedo_sdk/src/albedo_sdk/extension.gleam) routes model provider requests, streams, catalogs, and search by extension id. [Quota](quota.md) and [`oauth_flows`](../packages/albedo_sdk/src/albedo_sdk/oauth_flows.gleam) route polls and sign-in exchanges the same way. The client's [connection coordinator](../packages/albedo_http/src/albedo_http/connect.gleam) negotiates the tunnel before destination TLS, and pool keys distinguish routes. The Discord helper and Colab's SSH bridge get the route as `ALBEDO_OUTBOUND_PROXY`, read by [`albedo_plugins.proxy`](../python/albedo_plugins/proxy.py). ## Related pages - [Persisted settings](settings.md) - [Provider requests](provider-requests.md) - [Discord](discord.md) - [Colab](colab.md) - [MCP](mcp.md)