> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Govern ChatGPT and Codex with Formal

> Route OpenAI traffic through Formal and distinguish Codex from provider traffic.

The Endpoint recognizes Codex by its process, and ChatGPT by its hostnames.

## Use cases

| Use case | Guide |
| - | - |
| Allow Codex to reach only models and approved MCP servers | [Restrict Codex Desktop Egress](https://docs.formal.ai/docs/guides/example-use-cases/restrict-codex-desktop-egress.md) |
| Route OpenAI API calls from your apps through a Connector | [LLM Resources](https://docs.formal.ai/docs/guides/core-concepts/resources/llm.md) |
| See which models and MCP servers people use | [AI Usage](https://docs.formal.ai/docs/guides/ai-governance/usage.md) |
| Block MCP servers and skills outside your Catalog | [Guardrails](https://docs.formal.ai/docs/guides/ai-governance/guardrails.md) |
| Cap token spend per user | [LLM Spend](https://docs.formal.ai/docs/guides/ai-governance/spend.md) |
| Redact SSNs from prompts | [Mask PII](https://docs.formal.ai/docs/guides/policies/mask-pii.md#4-redact-ssns-from-llm-requests) |

## What Formal sees

| Surface | Detected by |
| - | - |
| Codex CLI and app | `process.is_codex_cli_rs` |
| ChatGPT desktop and web | Hostname `chatgpt.com` |
| OpenAI API | Hostname `api.openai.com` |
| Apps and SDKs | An [LLM resource](https://docs.formal.ai/docs/guides/core-concepts/resources/llm.md) on a Connector |
| Remote MCP tools | [MCP Gateway](https://docs.formal.ai/docs/guides/core-concepts/connectors/mcp-gateway.md) |

## 1. Add a network rule

Create this [Network Rule](https://app.formal.ai/network-rules) to inspect Codex, ChatGPT, and OpenAI API traffic, and set it to **Active**:

```cel theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
{
  "condition": {
    "pre_tcp": port == 443,
    "pre_tls": process.is_codex_cli_rs ||
      hostname == "chatgpt.com" || hostname.endsWith(".chatgpt.com") ||
      hostname == "api.openai.com" || hostname.endsWith(".api.openai.com"),
    "post_tls": technology == "llm"
  }
}
```

## 2. Check the logs

Enable [Transparent Mode](https://docs.formal.ai/docs/guides/client-apps/desktop-app.md#transparent-mode), send a prompt in ChatGPT or Codex, then search [Logs](https://app.formal.ai/logs):

```text theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
source:desktop AND resource.technology:llm
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.