feat: add CrofAI provider#412
Conversation
There was a problem hiding this comment.
1 issue found across 7 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src-tauri/src/plugin_engine/host_api.rs">
<violation number="1" location="src-tauri/src/plugin_engine/host_api.rs:18">
P1: Adding `CROFAI_API_KEY` to the global plugin env allowlist exposes a sensitive credential to any plugin via `host.env.get`, because env access is not scoped per plugin.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review, or fix all with cubic.
| "CODEX_HOME", | ||
| "CLAUDE_CONFIG_DIR", | ||
| "CLAUDE_CODE_OAUTH_TOKEN", | ||
| "CROFAI_API_KEY", |
There was a problem hiding this comment.
P1: Adding CROFAI_API_KEY to the global plugin env allowlist exposes a sensitive credential to any plugin via host.env.get, because env access is not scoped per plugin.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src-tauri/src/plugin_engine/host_api.rs, line 18:
<comment>Adding `CROFAI_API_KEY` to the global plugin env allowlist exposes a sensitive credential to any plugin via `host.env.get`, because env access is not scoped per plugin.</comment>
<file context>
@@ -11,10 +11,11 @@ use std::path::{Path, PathBuf};
"CODEX_HOME",
"CLAUDE_CONFIG_DIR",
"CLAUDE_CODE_OAUTH_TOKEN",
+ "CROFAI_API_KEY",
"USER_TYPE",
"USE_STAGING_OAUTH",
</file context>
robinebers
left a comment
There was a problem hiding this comment.
Hey! 👋 This is Rob's AI reviewer. Thanks for the contribution!
Nice clean provider plugin overall. The API call is scoped, tests are solid, docs are included, and the env var whitelist was updated. Three things to fix before merge:
-
Icon theming —
plugins/crofai/icon.svguses a fixed gradient fill. OpenUsage icons should usecurrentColorso they work in light/dark themes. -
Show zero credits — if CrofAI returns
credits: 0, the plugin hides the Credits line. A valid zero balance should show$0.00, not disappear. -
Fail clearly on unexpected data — if
creditsorusable_requestshas the wrong type, the plugin currently treats it like0. Better to show a clear “usage response invalid” error so bad API data does not look like real usage.
Everything else looks good: manifest shape, README/docs, tests, env whitelist, and request URL all match the repo’s patterns.
There was a problem hiding this comment.
1 issue found across 5 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="docs/providers/crofai.md">
<violation number="1" location="docs/providers/crofai.md:55">
P3: Malformed Markdown table in Errors section: separator row declares 3 columns while header/data rows have 2.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| ## Errors | ||
|
|
||
| | Condition | Message | | ||
| |---|---|---| |
There was a problem hiding this comment.
P3: Malformed Markdown table in Errors section: separator row declares 3 columns while header/data rows have 2.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/providers/crofai.md, line 55:
<comment>Malformed Markdown table in Errors section: separator row declares 3 columns while header/data rows have 2.</comment>
<file context>
@@ -46,15 +46,15 @@ Response:
| Condition | Message |
-|---|---|
+|---|---|---|
| Missing `CROFAI_API_KEY` env var | `No CROFAI_API_KEY found. Set up environment variable first.` |
| HTTP 401/403 | `API key invalid. Check your CrofAI API key.` |
</file context>
| |---|---|---| | |
| |---|---| |
Description
Adds CrofAI provider as plugin. Bar chart is not used since usage api from provider doesn't have a total/limit response.
Type of Change
Testing
bun run buildand it succeededbun run testand all tests passbun tauri devChecklist
mainbranchSummary by cubic
Adds the
crofaiprovider plugin to show CrofAI credits and daily request counts. No bar chart is shown because the API doesn’t provide total/limit data.New Features
GET https://crof.ai/usage_api/withCROFAI_API_KEY(Bearer).docs/providers/crofai.md; README updated; env var whitelisted.Migration
CROFAI_API_KEYin your environment and restart the app.Written for commit 129b2ba. Summary will update on new commits. Review in cubic