Skip to content

DusKing1/opencode-openai-residency

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencode-openai-residency

OpenCode plugin that adds the x-openai-internal-codex-residency header to OpenAI Codex API requests.

This is needed for OpenAI Enterprise workspaces with data residency requirements (e.g. US-only). Without this header, Codex API requests from non-US regions are rejected with 401 "Workspace is not authorized in this region".

This mirrors exactly how the official Codex CLI handles data residency.

Note: If OpenCode merges built-in residency support (PR #15844), this plugin becomes unnecessary and can be removed.

Install

Add to your opencode.json:

{
  "plugin": ["opencode-openai-residency"],
  "provider": {
    "openai": {
      "options": {
        "enforce_residency": "us",
      },
    },
  },
}

Restart OpenCode. The plugin is automatically installed and loaded.

How it works

On every LLM call to the OpenAI provider, the plugin checks provider.options.enforce_residency from your config. If set, it adds:

x-openai-internal-codex-residency: <value>

to the outgoing HTTP headers. If not set, it does nothing (zero impact).

License

MIT

About

OpenCode plugin: adds x-openai-internal-codex-residency header for OpenAI Enterprise data residency support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages