can1357/oh-my-pi · error · Error
Kimi search credentials not found. Kimi web search uses the
Error message
Kimi search credentials not found. Kimi web search uses the Kimi Code service (api.kimi.com); set MOONSHOT_SEARCH_API_KEY / KIMI_SEARCH_API_KEY to a Kimi Code Console key, or login with 'omp /login kimi-code'. A Moonshot Open Platform key (MOONSHOT_API_KEY) is not accepted here.
What it means
Thrown by searchKimi when no usable Kimi search credential can be resolved from auth storage or environment. Kimi web search requires a Kimi Code Console key (MOONSHOT_SEARCH_API_KEY / KIMI_SEARCH_API_KEY or 'omp /login kimi-code'); a regular Moonshot Open Platform key (MOONSHOT_API_KEY) is deliberately not accepted because the search API lives on the Kimi Code service.
Source
Thrown at packages/coding-agent/src/web/search/providers/kimi.ts:150
const classified = classifyProviderHttpError("kimi", response.status, errorText);
if (classified) throw classified;
throw new SearchProviderError(
"kimi",
`Kimi search API error (${response.status}): ${errorText}`,
response.status,
);
}
const data = (await response.json()) as KimiSearchResponse;
const requestId = response.headers.get("x-request-id") ?? response.headers.get("x-msh-request-id") ?? undefined;
return { response: data, requestId };
}
/** Execute Kimi web search. */
export async function searchKimi(params: KimiSearchParams): Promise<SearchResponse> {
const keyOrResolver = await resolveKey(params.authStorage, params.sessionId, params.signal);
if (!keyOrResolver) {
throw new Error(
"Kimi search credentials not found. Kimi web search uses the Kimi Code service (api.kimi.com); set MOONSHOT_SEARCH_API_KEY / KIMI_SEARCH_API_KEY to a Kimi Code Console key, or login with 'omp /login kimi-code'. A Moonshot Open Platform key (MOONSHOT_API_KEY) is not accepted here.",
);
}
const parsed = params.parsedQuery ?? parseSearchQuery(params.query);
const query = parsed.hasDirectives ? formatQuery(parsed, KIMI_QUERY_SYNTAX) : params.query;
const limit = clampNumResults(params.num_results, DEFAULT_NUM_RESULTS, MAX_NUM_RESULTS);
const { response, requestId } = await withAuth(
keyOrResolver,
key =>
callKimiSearch(key, {
query,
limit,
includeContent: params.include_content ?? false,
signal: params.signal,
timeoutMs: params.timeoutMs,
fetch: params.fetch,
}),View on GitHub (pinned to 9690622007)
Solutions
- Set MOONSHOT_SEARCH_API_KEY or KIMI_SEARCH_API_KEY to a Kimi Code Console key
- Run 'omp /login kimi-code' to store credentials interactively
- Do not reuse MOONSHOT_API_KEY — obtain a console key from the Kimi Code service
- Check the auth storage for an expired/missing entry and re-login
Example fix
// before export MOONSHOT_API_KEY=sk-... # platform key — not accepted // after export MOONSHOT_SEARCH_API_KEY=kimi-code-console-key # or: omp /login kimi-code
Defensive patterns
Strategy: validation
Validate before calling
// check credential availability before calling
const key = process.env.MOONSHOT_SEARCH_API_KEY ?? process.env.KIMI_SEARCH_API_KEY;
if (!key && !isLoggedIn('kimi-code')) {
console.error('Set MOONSHOT_SEARCH_API_KEY or run: omp /login kimi-code');
process.exit(1);
} Try / catch
try {
const res = await searchKimi({ query, authStorage });
} catch (err) {
if (err.message.includes('credentials not found')) {
// prompt user to run 'omp /login kimi-code' or set the env var
} else throw err;
} Prevention
- Set MOONSHOT_SEARCH_API_KEY (Kimi Code Console key) in your shell profile
- Run 'omp /login kimi-code' once per machine
- Do not confuse MOONSHOT_API_KEY (platform) with the search key
- Document the credential requirement in onboarding/CI setup
When it happens
Trigger: searchKimi called with resolveKey returning null — no MOONSHOT_SEARCH_API_KEY/KIMI_SEARCH_API_KEY in env, no stored credential for the session, and no logged-in kimi-code account.
Common situations: User set only MOONSHOT_API_KEY (wrong service); fresh machine without 'omp /login kimi-code'; CI environment lacking the search-specific env var; credential expired or scoped to another session.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- No image API credentials found. Connect a Codex (ChatGPT) su
- Parallel credentials not found. Set PARALLEL_API_KEY or logi
- credentials ${usernameKey} and ${passwordKey} must be config
- No xAI credentials. Run /login → xAI Grok OAuth (SuperGrok o
- No API key available for ${model.provider}/${model.id}. Conf
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/7a445b90761fd219.
Report an issue: GitHub.