can1357/oh-my-pi · error · ToolError
No API key available for ${model.provider}/${model.id}. Conf
Error message
No API key available for ${model.provider}/${model.id}. Configure credentials for this provider or choose another vision-capable model. What it means
A vision-capable model was resolved, but modelRegistry.getApiKey(model) returned no credential, so inspect_image cannot authenticate the one-shot vision request. The error names the exact provider/model so you can add credentials or pick a different vision model.
Source
Thrown at packages/coding-agent/src/tools/inspect-image.ts:203
break;
}
}
const activeProvider = resolvePattern(activeModelPattern)?.provider;
model ??= availableModels.find(
candidate => candidate.provider === activeProvider && candidate.input.includes("image"),
);
model ??= availableModels.find(candidate => candidate.input.includes("image"));
if (!model) {
const textOnly = resolvePattern("@vision") ?? resolvePattern("@default") ?? resolvePattern(activeModelPattern);
if (!textOnly) throw new ToolError("Unable to resolve a model for inspect_image.");
throw new ToolError(
`Resolved model ${textOnly.provider}/${textOnly.id} does not support image input. Configure a vision-capable model for modelRoles.vision.`,
);
}
const apiKey = await modelRegistry.getApiKey(model);
if (!apiKey) {
throw new ToolError(
`No API key available for ${model.provider}/${model.id}. Configure credentials for this provider or choose another vision-capable model.`,
);
}
let imageInput: LoadedImageInput | null;
const autoResize = this.session.settings.get("images.autoResize");
const excludeWebP = webpExclusionForModel(model);
const attachmentReference = parseImageAttachmentReference(params.path);
const imageTarget = attachmentReference
? undefined
: await splitPathAndSelPreferringLiteral(params.path, this.session.cwd);
const isSvgImage = imageTarget?.sel?.toLowerCase() === "img";
try {
if (attachmentReference) {
imageInput = await loadAttachmentReferenceInput({
path: params.path,
reference: attachmentReference,
attachments: this.session.getImageAttachments?.() ?? [],View on GitHub (pinned to 9690622007)
Solutions
- Set the provider's API key (env var or auth config) for the named provider.
- Run the provider auth/login flow for that provider.
- Choose a different vision-capable model from a provider you do have credentials for via modelRoles.vision.
- In CI, inject the key as a secret/environment variable.
Example fix
// before # no key for google // after export GEMINI_API_KEY=... # or: omp auth login google
Defensive patterns
Strategy: validation
Validate before calling
const model = /* resolved vision model */;
const key = await session.modelRegistry.getApiKey(model);
if (!key) {
// prompt for credentials or fall back to another provider before calling inspect_image
} Try / catch
try {
await inspectImageTool.execute(id, params, signal);
} catch (e) {
if (e instanceof ToolError && e.message.includes("No API key available")) {
// run provider auth setup or pick a model with credentials
} else throw e;
} Prevention
- Authenticate every provider referenced by modelRoles before use.
- Inject API keys as environment variables/secrets in CI.
- Periodically re-verify keys (expiry/rotation) so they don't lapse silently.
When it happens
Trigger: The resolved model's provider has no API key in the environment, auth config, or key resolver — e.g. provider configured by id but never authenticated, key present only for a different provider, or key resolution scoped to another session id.
Common situations: modelRoles.vision set to a provider you never signed into (e.g. vision role on Google while only Anthropic is authenticated); API key env var missing in CI/containers; key revoked/expired; using OAuth-auth provider where the tool needs a key resolver entry.
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
- Gemini Files API credential is required
- credentials ${usernameKey} and ${passwordKey} must be config
- No API key for ${model.provider}/${model.id}
- No API key available for model ${model.provider}/${model.id}
- Provider ${providerName}: "apiKey" or "oauth" is required wh
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e320609efe13f3d4.
Report an issue: GitHub.