diff --git a/docs/providers/near-ai.md b/docs/providers/near-ai.md index c058e4b8e..fa3417b81 100644 --- a/docs/providers/near-ai.md +++ b/docs/providers/near-ai.md @@ -71,7 +71,7 @@ clawdbot onboard --non-interactive \ ### 3. Verify Setup ```bash -clawdbot chat --model near-ai/zai-org/GLM-4.7 "Hello, are you working?" +clawdbot chat --model nearai/zai-org/GLM-4.7 "Hello, are you working?" ``` ## Model Selection @@ -79,14 +79,14 @@ clawdbot chat --model near-ai/zai-org/GLM-4.7 "Hello, are you working?" After setup, you can use any available NEAR AI model: ```bash -clawdbot models set near-ai/zai-org/GLM-4.7 -clawdbot models set near-ai/deepseek-ai/DeepSeek-V3.1 +clawdbot models set nearai/zai-org/GLM-4.7 +clawdbot models set nearai/deepseek-ai/DeepSeek-V3.1 ``` List all available models: ```bash -clawdbot models list | grep near-ai +clawdbot models list | grep nearai ``` ## Available Models @@ -110,16 +110,16 @@ clawdbot models list | grep near-ai ```bash # Use default model (GLM 4.7) -clawdbot chat --model near-ai/zai-org/GLM-4.7 +clawdbot chat --model nearai/zai-org/GLM-4.7 # Use DeepSeek for reasoning tasks -clawdbot chat --model near-ai/deepseek-ai/DeepSeek-V3.1 +clawdbot chat --model nearai/deepseek-ai/DeepSeek-V3.1 # Use Qwen for long context (262K!) -clawdbot chat --model near-ai/Qwen/Qwen3-30B-A3B-Instruct-2507 +clawdbot chat --model nearai/Qwen/Qwen3-30B-A3B-Instruct-2507 # Send a message -clawdbot agent --message "Explain quantum computing" --model near-ai/zai-org/GLM-4.7 +clawdbot agent --message "Explain quantum computing" --model nearai/zai-org/GLM-4.7 ``` ## Troubleshooting @@ -128,7 +128,7 @@ clawdbot agent --message "Explain quantum computing" --model near-ai/zai-org/GLM ```bash echo $NEARAI_API_KEY -clawdbot models list | grep near-ai +clawdbot models list | grep nearai ``` Ensure the environment variable is set correctly. @@ -142,11 +142,11 @@ NEAR AI API is at `https://cloud-api.near.ai/v1`. Ensure your network allows HTT ```json5 { env: { NEARAI_API_KEY: "..." }, - agents: { defaults: { model: { primary: "near-ai/zai-org/GLM-4.7" } } }, + agents: { defaults: { model: { primary: "nearai/zai-org/GLM-4.7" } } }, models: { mode: "merge", providers: { - "near-ai": { + "nearai": { baseUrl: "https://cloud-api.near.ai/v1", apiKey: "${NEARAI_API_KEY}", api: "openai-completions" diff --git a/src/agents/model-auth.ts b/src/agents/model-auth.ts index f351a77c0..62fcac6bf 100644 --- a/src/agents/model-auth.ts +++ b/src/agents/model-auth.ts @@ -285,7 +285,7 @@ export function resolveEnvApiKey(provider: string): EnvApiKeyResult | null { venice: "VENICE_API_KEY", mistral: "MISTRAL_API_KEY", opencode: "OPENCODE_API_KEY", - "near-ai": "NEARAI_API_KEY", + nearai: "NEARAI_API_KEY", }; const envVar = envMap[normalized]; if (!envVar) return null; diff --git a/src/agents/models-config.providers.ts b/src/agents/models-config.providers.ts index 11cb1f9ac..09a1cedb9 100644 --- a/src/agents/models-config.providers.ts +++ b/src/agents/models-config.providers.ts @@ -416,10 +416,10 @@ export async function resolveImplicitProviders(params: { } const nearAiKey = - resolveEnvApiKeyVarName("near-ai") ?? - resolveApiKeyFromProfiles({ provider: "near-ai", store: authStore }); + resolveEnvApiKeyVarName("nearai") ?? + resolveApiKeyFromProfiles({ provider: "nearai", store: authStore }); if (nearAiKey) { - providers["near-ai"] = { ...buildNearAiProvider(), apiKey: nearAiKey }; + providers["nearai"] = { ...buildNearAiProvider(), apiKey: nearAiKey }; } const qwenProfiles = listProfilesForProvider(authStore, "qwen-portal"); diff --git a/src/agents/near-ai-models.ts b/src/agents/near-ai-models.ts index 3b3bf7e70..add323990 100644 --- a/src/agents/near-ai-models.ts +++ b/src/agents/near-ai-models.ts @@ -2,7 +2,7 @@ import type { ModelDefinitionConfig } from "../config/types.js"; export const NEAR_AI_BASE_URL = "https://cloud-api.near.ai/v1"; export const NEAR_AI_DEFAULT_MODEL_ID = "zai-org/GLM-4.7"; -export const NEAR_AI_DEFAULT_MODEL_REF = `near-ai/${NEAR_AI_DEFAULT_MODEL_ID}`; +export const NEAR_AI_DEFAULT_MODEL_REF = `nearai/${NEAR_AI_DEFAULT_MODEL_ID}`; // NEAR AI uses credit-based pricing (per million tokens). export const NEAR_AI_DEFAULT_COST = { diff --git a/src/commands/auth-choice-options.ts b/src/commands/auth-choice-options.ts index 28e29127e..f4c1bc190 100644 --- a/src/commands/auth-choice-options.ts +++ b/src/commands/auth-choice-options.ts @@ -22,7 +22,7 @@ export type AuthChoiceGroupId = | "minimax" | "synthetic" | "venice" - | "near-ai" + | "nearai" | "qwen"; export type AuthChoiceGroup = { @@ -75,7 +75,7 @@ const AUTH_CHOICE_GROUP_DEFS: { choices: ["venice-api-key"], }, { - value: "near-ai", + value: "nearai", label: "NEAR AI", hint: "Private and verifiable inference (TEE)", choices: ["near-ai-api-key"], diff --git a/src/commands/auth-choice.apply.api-providers.ts b/src/commands/auth-choice.apply.api-providers.ts index 4b849fa97..b8fd270c2 100644 --- a/src/commands/auth-choice.apply.api-providers.ts +++ b/src/commands/auth-choice.apply.api-providers.ts @@ -87,7 +87,7 @@ export async function applyAuthChoiceApiProviders( authChoice = "synthetic-api-key"; } else if (params.opts.tokenProvider === "venice") { authChoice = "venice-api-key"; - } else if (params.opts.tokenProvider === "near-ai") { + } else if (params.opts.tokenProvider === "nearai") { authChoice = "near-ai-api-key"; } else if (params.opts.tokenProvider === "opencode") { authChoice = "opencode-zen"; @@ -531,7 +531,7 @@ export async function applyAuthChoiceApiProviders( if (authChoice === "near-ai-api-key") { let hasCredential = false; - if (!hasCredential && params.opts?.token && params.opts?.tokenProvider === "near-ai") { + if (!hasCredential && params.opts?.token && params.opts?.tokenProvider === "nearai") { await setNearAiApiKey(normalizeApiKeyInput(params.opts.token), params.agentDir); hasCredential = true; } @@ -547,7 +547,7 @@ export async function applyAuthChoiceApiProviders( ); } - const envKey = resolveEnvApiKey("near-ai"); + const envKey = resolveEnvApiKey("nearai"); if (envKey) { const useExisting = await params.prompter.confirm({ message: `Use existing NEARAI_API_KEY (${envKey.source}, ${formatApiKeyPreview(envKey.apiKey)})?`, @@ -567,7 +567,7 @@ export async function applyAuthChoiceApiProviders( } nextConfig = applyAuthProfileConfig(nextConfig, { profileId: "nearai:default", - provider: "near-ai", + provider: "nearai", mode: "api_key", }); { diff --git a/src/commands/auth-choice.preferred-provider.ts b/src/commands/auth-choice.preferred-provider.ts index 42246f408..ddfc47a89 100644 --- a/src/commands/auth-choice.preferred-provider.ts +++ b/src/commands/auth-choice.preferred-provider.ts @@ -20,7 +20,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial> = { "zai-api-key": "zai", "synthetic-api-key": "synthetic", "venice-api-key": "venice", - "near-ai-api-key": "near-ai", + "near-ai-api-key": "nearai", "github-copilot": "github-copilot", "copilot-proxy": "copilot-proxy", "minimax-cloud": "minimax", diff --git a/src/commands/onboard-auth.config-core.ts b/src/commands/onboard-auth.config-core.ts index 95b528ac7..5defb127e 100644 --- a/src/commands/onboard-auth.config-core.ts +++ b/src/commands/onboard-auth.config-core.ts @@ -429,7 +429,7 @@ export function applyNearAiProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig { }; const providers = { ...cfg.models?.providers }; - const existingProvider = providers["near-ai"]; + const existingProvider = providers["nearai"]; const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : []; const nearAiModels = NEAR_AI_MODEL_CATALOG.map(buildNearAiModelDefinition); const mergedModels = [ @@ -442,7 +442,7 @@ export function applyNearAiProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig { > as { apiKey?: string }; const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined; const normalizedApiKey = resolvedApiKey?.trim(); - providers["near-ai"] = { + providers["nearai"] = { ...existingProviderRest, baseUrl: NEAR_AI_BASE_URL, api: "openai-completions", diff --git a/src/commands/onboard-auth.credentials.ts b/src/commands/onboard-auth.credentials.ts index bbf0b14dd..4fb403102 100644 --- a/src/commands/onboard-auth.credentials.ts +++ b/src/commands/onboard-auth.credentials.ts @@ -118,7 +118,7 @@ export async function setNearAiApiKey(key: string, agentDir?: string) { profileId: "nearai:default", credential: { type: "api_key", - provider: "near-ai", + provider: "nearai", key, }, agentDir: resolveAuthAgentDir(agentDir),