fix: rename provider ID from near-ai to nearai
- Change provider ID 'near-ai' → 'nearai' throughout - Update model refs: near-ai/model → nearai/model - Update docs examples and grep patterns
This commit is contained in:
parent
739333487f
commit
b04459cbb1
@ -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"
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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"],
|
||||
|
||||
@ -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",
|
||||
});
|
||||
{
|
||||
|
||||
@ -20,7 +20,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial<Record<AuthChoice, string>> = {
|
||||
"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",
|
||||
|
||||
@ -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",
|
||||
|
||||
@ -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),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user