Skip to content

fix: add ChatGPT-Account-Id header for organization subscriptions#7603

Merged
rekram1-node merged 3 commits into
anomalyco:devfrom
fdematos:fix/openai-organization-subscription-7570
Jan 10, 2026
Merged

fix: add ChatGPT-Account-Id header for organization subscriptions#7603
rekram1-node merged 3 commits into
anomalyco:devfrom
fdematos:fix/openai-organization-subscription-7570

Conversation

@fdematos
Copy link
Copy Markdown
Contributor

@fdematos fdematos commented Jan 10, 2026

Summary

  • Extracts ChatGPT account/workspace ID from OAuth JWT claims (including nested auth claims).
  • Stores accountId in OAuth credentials and reuses it for Codex API requests.
  • Adds unit tests for JWT parsing and account ID extraction.

Details

  • Uses ChatGPT-Account-Id header required by organization plans.
  • Preserves accountId during token refresh.

Testing

  • bun test test/plugin/codex.test.ts

Issue

Fixes #7570

Store and reuse ChatGPT workspace identifiers from OAuth tokens so Codex API
requests include the account header needed for organization plans. Add unit
tests for JWT claim parsing and account id extraction.
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Users with organization subscriptions who were already authenticated
before this fix will need to re-authenticate (opencode auth logout
then opencode auth login) to get the accountId stored.
Remove custom base64UrlDecode function in favor of built-in Buffer API.
@rekram1-node rekram1-node merged commit 1662e14 into anomalyco:dev Jan 10, 2026
5 checks passed
triklozoid pushed a commit to triklozoid/opencode that referenced this pull request Feb 2, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/opencode that referenced this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI does Not work when trying with Organization Subscription

2 participants