Skip to content

feat(inference): reuse Codex and Copilot subscriptions - #2432

Open
PsiACE wants to merge 2 commits into
masterfrom
codex/subscription-inference
Open

PsiACE wants to merge 2 commits into
masterfrom
codex/subscription-inference

Conversation

@PsiACE

@PsiACE PsiACE commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Which issue or RFC does this PR close?

No linked issue or RFC.

Rationale for this change

Allow PowerContext to use existing Codex and GitHub Copilot subscriptions for generation. Upgrading Pydantic AI provides credential reuse without adding a login flow.

What changes are included in this PR?

  • Upgrade pydantic-ai-slim to >=2.64.0,<3 and adapt inference clients, error handling, tracing, and integration context history.
  • Preserve MiniMax embeddings and Jev reranking with HTTPX2 clients.
  • Document credential reuse, configuration, and limitations in English and Chinese.

Are there any user-facing changes?

Use openai-codex:<model> with an existing Codex login file, or github-copilot:<model> with an existing OAuth token and a Chat Completions model. These providers support Memory, Experience, and Profile generation. Topic Memory, Dream, and built-in inference protection are unavailable with these providers.

SDK callers supplying HTTP clients for MiniMax embeddings or Jev reranking must use httpx2.AsyncClient.

How was this change tested?

  • UV_NO_SYNC=1 make check.
  • Regression tests across 20 affected inference, embedding, reranking, Server, evaluation, and Pydantic AI integration test files: 512 passed, 11 skipped.
  • Live validation with local subscriptions: openai-codex:gpt-6.1-sol and github-copilot:claude-haiku-4.5. Both passed Server readiness, Memory extraction and storage by a spawned worker, and readback after restart. The Codex login file remained unchanged.

AI usage statement

OpenAI Codex assisted with implementation, documentation, and validation.

@PsiACE
PsiACE marked this pull request as ready for review November 3, 2026 03:24
Copilot AI balanced review requested due to automatic review settings November 3, 2026 03:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@AlexStocks AlexStocks added the 1.5.1 v1.5.1 release tracking label Nov 3, 2026

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dependency upgrade breaks authentication for existing Anthropic-compatible endpoints that require the configured API key in x-api-key.

Comment thread pyproject.toml
"jieba==0.42.1",
"packaging>=24,<27",
"pydantic-ai-slim[anthropic,openai]>=2.27.1,<3",
"pydantic-ai-slim[anthropic,openai]>=2.64.0,<3",

@hidb4ai hidb4ai Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Preserve the Anthropic x-api-key header across the SDK upgrade. With generation_model=anthropic:..., a custom base URL, and generation_headers={"x-api-key": "test-key"}, composition removes that header and passes it as api_key to the upgraded Anthropic SDK, which now sends Authorization: Bearer test-key instead. I reproduced this through open_builtin_runtime against a local Anthropic-compatible endpoint requiring x-api-key: it received no such header, returned 401, and generation readiness became misconfigured: provider-rejected. The same change affects ANTHROPIC_API_KEY on custom endpoints. Please preserve the existing header contract for these endpoints and verify both explicit-header and environment-key configurations against a server that enforces authentication.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.5.1 v1.5.1 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants