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
|
### 3. Verify Setup
|
||||||
|
|
||||||
```bash
|
```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
|
## 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:
|
After setup, you can use any available NEAR AI model:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
clawdbot models set near-ai/zai-org/GLM-4.7
|
clawdbot models set nearai/zai-org/GLM-4.7
|
||||||
clawdbot models set near-ai/deepseek-ai/DeepSeek-V3.1
|
clawdbot models set nearai/deepseek-ai/DeepSeek-V3.1
|
||||||
```
|
```
|
||||||
|
|
||||||
List all available models:
|
List all available models:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
clawdbot models list | grep near-ai
|
clawdbot models list | grep nearai
|
||||||
```
|
```
|
||||||
|
|
||||||
## Available Models
|
## Available Models
|
||||||
@ -110,16 +110,16 @@ clawdbot models list | grep near-ai
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Use default model (GLM 4.7)
|
# 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
|
# 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!)
|
# 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
|
# 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
|
## Troubleshooting
|
||||||
@ -128,7 +128,7 @@ clawdbot agent --message "Explain quantum computing" --model near-ai/zai-org/GLM
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
echo $NEARAI_API_KEY
|
echo $NEARAI_API_KEY
|
||||||
clawdbot models list | grep near-ai
|
clawdbot models list | grep nearai
|
||||||
```
|
```
|
||||||
|
|
||||||
Ensure the environment variable is set correctly.
|
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
|
```json5
|
||||||
{
|
{
|
||||||
env: { NEARAI_API_KEY: "..." },
|
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: {
|
models: {
|
||||||
mode: "merge",
|
mode: "merge",
|
||||||
providers: {
|
providers: {
|
||||||
"near-ai": {
|
"nearai": {
|
||||||
baseUrl: "https://cloud-api.near.ai/v1",
|
baseUrl: "https://cloud-api.near.ai/v1",
|
||||||
apiKey: "${NEARAI_API_KEY}",
|
apiKey: "${NEARAI_API_KEY}",
|
||||||
api: "openai-completions"
|
api: "openai-completions"
|
||||||
|
|||||||
@ -285,7 +285,7 @@ export function resolveEnvApiKey(provider: string): EnvApiKeyResult | null {
|
|||||||
venice: "VENICE_API_KEY",
|
venice: "VENICE_API_KEY",
|
||||||
mistral: "MISTRAL_API_KEY",
|
mistral: "MISTRAL_API_KEY",
|
||||||
opencode: "OPENCODE_API_KEY",
|
opencode: "OPENCODE_API_KEY",
|
||||||
"near-ai": "NEARAI_API_KEY",
|
nearai: "NEARAI_API_KEY",
|
||||||
};
|
};
|
||||||
const envVar = envMap[normalized];
|
const envVar = envMap[normalized];
|
||||||
if (!envVar) return null;
|
if (!envVar) return null;
|
||||||
|
|||||||
@ -416,10 +416,10 @@ export async function resolveImplicitProviders(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const nearAiKey =
|
const nearAiKey =
|
||||||
resolveEnvApiKeyVarName("near-ai") ??
|
resolveEnvApiKeyVarName("nearai") ??
|
||||||
resolveApiKeyFromProfiles({ provider: "near-ai", store: authStore });
|
resolveApiKeyFromProfiles({ provider: "nearai", store: authStore });
|
||||||
if (nearAiKey) {
|
if (nearAiKey) {
|
||||||
providers["near-ai"] = { ...buildNearAiProvider(), apiKey: nearAiKey };
|
providers["nearai"] = { ...buildNearAiProvider(), apiKey: nearAiKey };
|
||||||
}
|
}
|
||||||
|
|
||||||
const qwenProfiles = listProfilesForProvider(authStore, "qwen-portal");
|
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_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_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).
|
// NEAR AI uses credit-based pricing (per million tokens).
|
||||||
export const NEAR_AI_DEFAULT_COST = {
|
export const NEAR_AI_DEFAULT_COST = {
|
||||||
|
|||||||
@ -22,7 +22,7 @@ export type AuthChoiceGroupId =
|
|||||||
| "minimax"
|
| "minimax"
|
||||||
| "synthetic"
|
| "synthetic"
|
||||||
| "venice"
|
| "venice"
|
||||||
| "near-ai"
|
| "nearai"
|
||||||
| "qwen";
|
| "qwen";
|
||||||
|
|
||||||
export type AuthChoiceGroup = {
|
export type AuthChoiceGroup = {
|
||||||
@ -75,7 +75,7 @@ const AUTH_CHOICE_GROUP_DEFS: {
|
|||||||
choices: ["venice-api-key"],
|
choices: ["venice-api-key"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: "near-ai",
|
value: "nearai",
|
||||||
label: "NEAR AI",
|
label: "NEAR AI",
|
||||||
hint: "Private and verifiable inference (TEE)",
|
hint: "Private and verifiable inference (TEE)",
|
||||||
choices: ["near-ai-api-key"],
|
choices: ["near-ai-api-key"],
|
||||||
|
|||||||
@ -87,7 +87,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
authChoice = "synthetic-api-key";
|
authChoice = "synthetic-api-key";
|
||||||
} else if (params.opts.tokenProvider === "venice") {
|
} else if (params.opts.tokenProvider === "venice") {
|
||||||
authChoice = "venice-api-key";
|
authChoice = "venice-api-key";
|
||||||
} else if (params.opts.tokenProvider === "near-ai") {
|
} else if (params.opts.tokenProvider === "nearai") {
|
||||||
authChoice = "near-ai-api-key";
|
authChoice = "near-ai-api-key";
|
||||||
} else if (params.opts.tokenProvider === "opencode") {
|
} else if (params.opts.tokenProvider === "opencode") {
|
||||||
authChoice = "opencode-zen";
|
authChoice = "opencode-zen";
|
||||||
@ -531,7 +531,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
if (authChoice === "near-ai-api-key") {
|
if (authChoice === "near-ai-api-key") {
|
||||||
let hasCredential = false;
|
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);
|
await setNearAiApiKey(normalizeApiKeyInput(params.opts.token), params.agentDir);
|
||||||
hasCredential = true;
|
hasCredential = true;
|
||||||
}
|
}
|
||||||
@ -547,7 +547,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const envKey = resolveEnvApiKey("near-ai");
|
const envKey = resolveEnvApiKey("nearai");
|
||||||
if (envKey) {
|
if (envKey) {
|
||||||
const useExisting = await params.prompter.confirm({
|
const useExisting = await params.prompter.confirm({
|
||||||
message: `Use existing NEARAI_API_KEY (${envKey.source}, ${formatApiKeyPreview(envKey.apiKey)})?`,
|
message: `Use existing NEARAI_API_KEY (${envKey.source}, ${formatApiKeyPreview(envKey.apiKey)})?`,
|
||||||
@ -567,7 +567,7 @@ export async function applyAuthChoiceApiProviders(
|
|||||||
}
|
}
|
||||||
nextConfig = applyAuthProfileConfig(nextConfig, {
|
nextConfig = applyAuthProfileConfig(nextConfig, {
|
||||||
profileId: "nearai:default",
|
profileId: "nearai:default",
|
||||||
provider: "near-ai",
|
provider: "nearai",
|
||||||
mode: "api_key",
|
mode: "api_key",
|
||||||
});
|
});
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,7 +20,7 @@ const PREFERRED_PROVIDER_BY_AUTH_CHOICE: Partial<Record<AuthChoice, string>> = {
|
|||||||
"zai-api-key": "zai",
|
"zai-api-key": "zai",
|
||||||
"synthetic-api-key": "synthetic",
|
"synthetic-api-key": "synthetic",
|
||||||
"venice-api-key": "venice",
|
"venice-api-key": "venice",
|
||||||
"near-ai-api-key": "near-ai",
|
"near-ai-api-key": "nearai",
|
||||||
"github-copilot": "github-copilot",
|
"github-copilot": "github-copilot",
|
||||||
"copilot-proxy": "copilot-proxy",
|
"copilot-proxy": "copilot-proxy",
|
||||||
"minimax-cloud": "minimax",
|
"minimax-cloud": "minimax",
|
||||||
|
|||||||
@ -429,7 +429,7 @@ export function applyNearAiProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const providers = { ...cfg.models?.providers };
|
const providers = { ...cfg.models?.providers };
|
||||||
const existingProvider = providers["near-ai"];
|
const existingProvider = providers["nearai"];
|
||||||
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
const existingModels = Array.isArray(existingProvider?.models) ? existingProvider.models : [];
|
||||||
const nearAiModels = NEAR_AI_MODEL_CATALOG.map(buildNearAiModelDefinition);
|
const nearAiModels = NEAR_AI_MODEL_CATALOG.map(buildNearAiModelDefinition);
|
||||||
const mergedModels = [
|
const mergedModels = [
|
||||||
@ -442,7 +442,7 @@ export function applyNearAiProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
|||||||
> as { apiKey?: string };
|
> as { apiKey?: string };
|
||||||
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
const resolvedApiKey = typeof existingApiKey === "string" ? existingApiKey : undefined;
|
||||||
const normalizedApiKey = resolvedApiKey?.trim();
|
const normalizedApiKey = resolvedApiKey?.trim();
|
||||||
providers["near-ai"] = {
|
providers["nearai"] = {
|
||||||
...existingProviderRest,
|
...existingProviderRest,
|
||||||
baseUrl: NEAR_AI_BASE_URL,
|
baseUrl: NEAR_AI_BASE_URL,
|
||||||
api: "openai-completions",
|
api: "openai-completions",
|
||||||
|
|||||||
@ -118,7 +118,7 @@ export async function setNearAiApiKey(key: string, agentDir?: string) {
|
|||||||
profileId: "nearai:default",
|
profileId: "nearai:default",
|
||||||
credential: {
|
credential: {
|
||||||
type: "api_key",
|
type: "api_key",
|
||||||
provider: "near-ai",
|
provider: "nearai",
|
||||||
key,
|
key,
|
||||||
},
|
},
|
||||||
agentDir: resolveAuthAgentDir(agentDir),
|
agentDir: resolveAuthAgentDir(agentDir),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user