Skip to content

Commit 8b903e7

Browse files
CopilotMossaka
andauthored
docs: add API Proxy section to CLI reference (#1607)
* Initial plan * docs: add API Proxy section to CLI reference Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/055ecfbc-1cb0-45bb-b1bd-53018b6a4256 Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
1 parent 283019c commit 8b903e7

File tree

1 file changed

+179
-0
lines changed

1 file changed

+179
-0
lines changed

docs-site/src/content/docs/reference/cli-reference.md

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ awf [options] -- <command>
5252
| `--enable-dind` | flag | `false` | Enable Docker-in-Docker by exposing host Docker socket |
5353
| `--enable-dlp` | flag | `false` | Enable DLP scanning to block credential exfiltration |
5454
| `--agent-image <value>` | string | `default` | Agent container image (default, act, or custom) |
55+
| `--enable-api-proxy` | flag | `false` | Enable API proxy sidecar for secure credential injection |
56+
| `--copilot-api-target <host>` | string | `api.githubcopilot.com` | Target hostname for Copilot API requests |
57+
| `--openai-api-target <host>` | string | `api.openai.com` | Target hostname for OpenAI API requests |
58+
| `--openai-api-base-path <path>` | string || Base path prefix for OpenAI API requests |
59+
| `--anthropic-api-target <host>` | string | `api.anthropic.com` | Target hostname for Anthropic API requests |
60+
| `--anthropic-api-base-path <path>` | string || Base path prefix for Anthropic API requests |
61+
| `--rate-limit-rpm <n>` | number | `600` | Max requests per minute per provider |
62+
| `--rate-limit-rph <n>` | number | `10000` | Max requests per hour per provider |
63+
| `--rate-limit-bytes-pm <n>` | number | `52428800` (~50 MB) | Max request bytes per minute per provider |
64+
| `--no-rate-limit` | flag || Disable rate limiting in API proxy |
5565
| `-V, --version` | flag || Display version |
5666
| `-h, --help` | flag || Display help |
5767

@@ -573,6 +583,174 @@ sudo awf --enable-dlp --allow-domains github.com \
573583
Enable DLP scanning as a defense-in-depth measure when running untrusted code that has access to environment variables or files containing credentials.
574584
:::
575585

586+
### `--enable-api-proxy`
587+
588+
Enable the API proxy sidecar for secure credential injection. The sidecar is a Node.js proxy (`172.30.0.30`) that holds real API credentials so the agent never sees them. The agent sends unauthenticated requests to the sidecar, which injects the credentials and forwards the request through Squid to the upstream API.
589+
590+
```bash
591+
# Enable with keys from environment
592+
export OPENAI_API_KEY="sk-..."
593+
export ANTHROPIC_API_KEY="sk-ant-..."
594+
sudo -E awf --enable-api-proxy \
595+
--allow-domains api.openai.com,api.anthropic.com \
596+
-- command
597+
```
598+
599+
**Required environment variables** (at least one):
600+
601+
| Variable | Provider |
602+
|----------|----------|
603+
| `OPENAI_API_KEY` | OpenAI / Codex |
604+
| `ANTHROPIC_API_KEY` | Anthropic / Claude |
605+
| `COPILOT_GITHUB_TOKEN` | GitHub Copilot |
606+
607+
**Sidecar ports:**
608+
609+
| Port | Provider |
610+
|------|----------|
611+
| `10000` | OpenAI |
612+
| `10001` | Anthropic |
613+
| `10002` | GitHub Copilot |
614+
| `10004` | OpenCode |
615+
616+
:::tip
617+
Use `sudo -E` to preserve environment variables like API keys through sudo.
618+
:::
619+
620+
:::danger[Security]
621+
API keys are held exclusively in the sidecar container. The agent container receives only the sidecar proxy URL — never the actual credentials.
622+
:::
623+
624+
### `--copilot-api-target <host>`
625+
626+
Target hostname for GitHub Copilot API requests. Useful for GitHub Enterprise Server (GHES) deployments where the Copilot API endpoint differs from the public default. Can also be set via the `COPILOT_API_TARGET` environment variable.
627+
628+
- **Default:** `api.githubcopilot.com`
629+
- **Requires:** `--enable-api-proxy`
630+
631+
```bash
632+
sudo -E awf --enable-api-proxy \
633+
--copilot-api-target api.github.mycompany.com \
634+
--allow-domains api.github.mycompany.com \
635+
-- command
636+
```
637+
638+
### `--openai-api-target <host>`
639+
640+
Target hostname for OpenAI API requests. Useful for custom OpenAI-compatible endpoints such as Azure OpenAI, internal LLM routers, vLLM, or TGI. Can also be set via the `OPENAI_API_TARGET` environment variable.
641+
642+
- **Default:** `api.openai.com`
643+
- **Requires:** `--enable-api-proxy`
644+
645+
```bash
646+
sudo -E awf --enable-api-proxy \
647+
--openai-api-target llm-router.internal.example.com \
648+
--allow-domains llm-router.internal.example.com \
649+
-- command
650+
```
651+
652+
### `--openai-api-base-path <path>`
653+
654+
Base path prefix prepended to every upstream OpenAI API request path. Use this when the upstream endpoint requires a URL prefix (e.g., Databricks serving endpoints, Azure OpenAI deployments). Can also be set via the `OPENAI_API_BASE_PATH` environment variable.
655+
656+
- **Default:** none
657+
- **Requires:** `--enable-api-proxy`
658+
659+
```bash
660+
# Databricks serving endpoint
661+
sudo -E awf --enable-api-proxy \
662+
--openai-api-target myworkspace.cloud.databricks.com \
663+
--openai-api-base-path /serving-endpoints \
664+
--allow-domains myworkspace.cloud.databricks.com \
665+
-- command
666+
```
667+
668+
### `--anthropic-api-target <host>`
669+
670+
Target hostname for Anthropic API requests. Useful for custom Anthropic-compatible endpoints such as internal LLM routers. Can also be set via the `ANTHROPIC_API_TARGET` environment variable.
671+
672+
- **Default:** `api.anthropic.com`
673+
- **Requires:** `--enable-api-proxy`
674+
675+
```bash
676+
sudo -E awf --enable-api-proxy \
677+
--anthropic-api-target llm-router.internal.example.com \
678+
--allow-domains llm-router.internal.example.com \
679+
-- command
680+
```
681+
682+
### `--anthropic-api-base-path <path>`
683+
684+
Base path prefix prepended to every upstream Anthropic API request path. Use this when the upstream endpoint requires a URL prefix. Can also be set via the `ANTHROPIC_API_BASE_PATH` environment variable.
685+
686+
- **Default:** none
687+
- **Requires:** `--enable-api-proxy`
688+
689+
```bash
690+
sudo -E awf --enable-api-proxy \
691+
--anthropic-api-target custom-llm.example.com \
692+
--anthropic-api-base-path /anthropic \
693+
--allow-domains custom-llm.example.com \
694+
-- command
695+
```
696+
697+
### `--rate-limit-rpm <n>`
698+
699+
Maximum number of requests per minute per provider. Rate limiting is opt-in — it is only enabled when at least one `--rate-limit-*` flag is provided.
700+
701+
- **Default:** `600` (when rate limiting is enabled)
702+
- **Requires:** `--enable-api-proxy`
703+
704+
```bash
705+
sudo -E awf --enable-api-proxy \
706+
--rate-limit-rpm 100 \
707+
--allow-domains api.openai.com \
708+
-- command
709+
```
710+
711+
### `--rate-limit-rph <n>`
712+
713+
Maximum number of requests per hour per provider.
714+
715+
- **Default:** `10000` (when rate limiting is enabled)
716+
- **Requires:** `--enable-api-proxy`
717+
718+
```bash
719+
sudo -E awf --enable-api-proxy \
720+
--rate-limit-rph 5000 \
721+
--allow-domains api.anthropic.com \
722+
-- command
723+
```
724+
725+
### `--rate-limit-bytes-pm <n>`
726+
727+
Maximum request bytes per minute per provider.
728+
729+
- **Default:** `52428800` (~50 MB, when rate limiting is enabled)
730+
- **Requires:** `--enable-api-proxy`
731+
732+
```bash
733+
sudo -E awf --enable-api-proxy \
734+
--rate-limit-bytes-pm 10485760 \
735+
--allow-domains api.openai.com \
736+
-- command
737+
```
738+
739+
### `--no-rate-limit`
740+
741+
Explicitly disable rate limiting in the API proxy, even if other `--rate-limit-*` flags are provided. Useful for overriding defaults in scripts or CI configurations.
742+
743+
- **Requires:** `--enable-api-proxy`
744+
745+
```bash
746+
sudo -E awf --enable-api-proxy --no-rate-limit \
747+
--allow-domains api.anthropic.com \
748+
-- command
749+
```
750+
751+
:::caution
752+
When using a custom `--openai-api-target` or `--anthropic-api-target`, you must add the target domain to `--allow-domains` so the firewall permits outbound traffic. AWF emits a warning if a custom target is set but not in the allowlist.
753+
:::
576754

577755
## Exit Codes
578756

@@ -885,6 +1063,7 @@ Denied Requests (3):
8851063

8861064
## See Also
8871065

1066+
- [API Proxy Sidecar](/gh-aw-firewall/reference/api-proxy-sidecar) - Secure credential injection architecture and configuration
8881067
- [Domain Filtering Guide](/gh-aw-firewall/guides/domain-filtering) - Allowlists, blocklists, and wildcards
8891068
- [SSL Bump Reference](/gh-aw-firewall/reference/ssl-bump/) - HTTPS content inspection and URL filtering
8901069
- [Quick Start Guide](/gh-aw-firewall/quickstart) - Getting started with examples

0 commit comments

Comments
 (0)