{"record":{"id":"e320609efe13f3d4","repo":"can1357/oh-my-pi","slug":"no-api-key-available-for-model-provider-model","errorCode":null,"errorMessage":"No API key available for ${model.provider}/${model.id}. Configure credentials for this provider or choose another vision-capable model.","messagePattern":"No API key available for (.+?)/(.+?)\\. Configure credentials for this provider or choose another vision-capable model\\.","errorType":"exception","errorClass":"ToolError","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/tools/inspect-image.ts","lineNumber":203,"sourceCode":"\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tconst activeProvider = resolvePattern(activeModelPattern)?.provider;\n\t\tmodel ??= availableModels.find(\n\t\t\tcandidate => candidate.provider === activeProvider && candidate.input.includes(\"image\"),\n\t\t);\n\t\tmodel ??= availableModels.find(candidate => candidate.input.includes(\"image\"));\n\t\tif (!model) {\n\t\t\tconst textOnly = resolvePattern(\"@vision\") ?? resolvePattern(\"@default\") ?? resolvePattern(activeModelPattern);\n\t\t\tif (!textOnly) throw new ToolError(\"Unable to resolve a model for inspect_image.\");\n\t\t\tthrow new ToolError(\n\t\t\t\t`Resolved model ${textOnly.provider}/${textOnly.id} does not support image input. Configure a vision-capable model for modelRoles.vision.`,\n\t\t\t);\n\t\t}\n\n\t\tconst apiKey = await modelRegistry.getApiKey(model);\n\t\tif (!apiKey) {\n\t\t\tthrow new ToolError(\n\t\t\t\t`No API key available for ${model.provider}/${model.id}. Configure credentials for this provider or choose another vision-capable model.`,\n\t\t\t);\n\t\t}\n\n\t\tlet imageInput: LoadedImageInput | null;\n\t\tconst autoResize = this.session.settings.get(\"images.autoResize\");\n\t\tconst excludeWebP = webpExclusionForModel(model);\n\t\tconst attachmentReference = parseImageAttachmentReference(params.path);\n\t\tconst imageTarget = attachmentReference\n\t\t\t? undefined\n\t\t\t: await splitPathAndSelPreferringLiteral(params.path, this.session.cwd);\n\t\tconst isSvgImage = imageTarget?.sel?.toLowerCase() === \"img\";\n\t\ttry {\n\t\t\tif (attachmentReference) {\n\t\t\t\timageInput = await loadAttachmentReferenceInput({\n\t\t\t\t\tpath: params.path,\n\t\t\t\t\treference: attachmentReference,\n\t\t\t\t\tattachments: this.session.getImageAttachments?.() ?? [],","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/tools/inspect-image.ts#L185-L221","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n# no key for google\n// after\nexport GEMINI_API_KEY=...  # or: omp auth login google","handlingStrategy":"validation","validationCode":"const model = /* resolved vision model */;\nconst key = await session.modelRegistry.getApiKey(model);\nif (!key) {\n  // prompt for credentials or fall back to another provider before calling inspect_image\n}","typeGuard":null,"tryCatchPattern":"try {\n  await inspectImageTool.execute(id, params, signal);\n} catch (e) {\n  if (e instanceof ToolError && e.message.includes(\"No API key available\")) {\n    // run provider auth setup or pick a model with credentials\n  } else throw e;\n}","preventionTips":["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."],"tags":["api-key","authentication","credentials","configuration"],"backgroundTag":"missing-api-key","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}