feat: add support for claude pro and max plans (#327)
This commit is contained in:
@@ -2,6 +2,7 @@ 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";
|
||||
|
||||
export async function getClient() {
|
||||
@@ -68,6 +69,10 @@ 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();
|
||||
|
||||
return new Letta({
|
||||
apiKey,
|
||||
baseURL,
|
||||
|
||||
@@ -7,6 +7,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 { getAllLettaToolNames, getToolNames } from "../tools/manager";
|
||||
import { getClient } from "./client";
|
||||
|
||||
@@ -25,7 +26,10 @@ function buildModelSettings(
|
||||
updateArgs?: Record<string, unknown>,
|
||||
): ModelSettings {
|
||||
const isOpenAI = modelHandle.startsWith("openai/");
|
||||
const isAnthropic = modelHandle.startsWith("anthropic/");
|
||||
// Include our custom Anthropic OAuth provider (claude-pro-max)
|
||||
const isAnthropic =
|
||||
modelHandle.startsWith("anthropic/") ||
|
||||
modelHandle.startsWith(`${ANTHROPIC_PROVIDER_NAME}/`);
|
||||
const isGoogleAI = modelHandle.startsWith("google_ai/");
|
||||
const isGoogleVertex = modelHandle.startsWith("google_vertex/");
|
||||
const isOpenRouter = modelHandle.startsWith("openrouter/");
|
||||
|
||||
Reference in New Issue
Block a user