feat: replace /connect claude with /connect codex for OpenAI OAuth (#527)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
jnjpng
2026-01-15 13:57:39 -08:00
committed by GitHub
parent 46d7f7ae45
commit bbb2c987e5
13 changed files with 858 additions and 1079 deletions

View File

@@ -2,7 +2,6 @@ import { hostname } from "node:os";
import Letta from "@letta-ai/letta-client";
import packageJson from "../../package.json";
import { LETTA_CLOUD_API_URL, refreshAccessToken } from "../auth/oauth";
import { ensureAnthropicProviderToken } from "../providers/anthropic-provider";
import { settingsManager } from "../settings-manager";
import { createTimingFetch, isTimingsEnabled } from "../utils/timing";
@@ -76,9 +75,8 @@ export async function getClient() {
process.exit(1);
}
// Ensure Anthropic OAuth token is valid and provider is updated
// This checks if token is expired, refreshes it, and updates the provider
await ensureAnthropicProviderToken();
// Note: OpenAI Codex OAuth token refresh is handled by the Letta backend
// when using the chatgpt_oauth provider type
return new Letta({
apiKey,

View File

@@ -8,7 +8,7 @@ import type {
OpenAIModelSettings,
} from "@letta-ai/letta-client/resources/agents/agents";
import type { LlmConfig } from "@letta-ai/letta-client/resources/models/models";
import { ANTHROPIC_PROVIDER_NAME } from "../providers/anthropic-provider";
import { OPENAI_CODEX_PROVIDER_NAME } from "../providers/openai-codex-provider";
import { getClient } from "./client";
type ModelSettings =
@@ -25,11 +25,14 @@ function buildModelSettings(
modelHandle: string,
updateArgs?: Record<string, unknown>,
): ModelSettings {
const isOpenAI = modelHandle.startsWith("openai/");
// Include our custom Anthropic OAuth provider (claude-pro-max)
// Include our custom OpenAI Codex OAuth provider (chatgpt-plus-pro)
const isOpenAI =
modelHandle.startsWith("openai/") ||
modelHandle.startsWith(`${OPENAI_CODEX_PROVIDER_NAME}/`);
// Include legacy custom Anthropic OAuth provider (claude-pro-max)
const isAnthropic =
modelHandle.startsWith("anthropic/") ||
modelHandle.startsWith(`${ANTHROPIC_PROVIDER_NAME}/`);
modelHandle.startsWith("claude-pro-max/");
const isZai = modelHandle.startsWith("zai/");
const isGoogleAI = modelHandle.startsWith("google_ai/");
const isGoogleVertex = modelHandle.startsWith("google_vertex/");