Skip to content

[codex] Add Crof provider#872

Merged
steipete merged 1 commit intosteipete:mainfrom
baanish:codex/add-crofai-provider
May 9, 2026
Merged

[codex] Add Crof provider#872
steipete merged 1 commit intosteipete:mainfrom
baanish:codex/add-crofai-provider

Conversation

@baanish
Copy link
Copy Markdown
Contributor

@baanish baanish commented May 8, 2026

Summary

Adds Crof as an API-key provider in CodexBar. The new provider calls GET https://crof.ai/usage_api/ with a bearer token, parses credits, requests_plan, and usable_requests, and renders request quota as the primary usage row with credit balance as the secondary row.

The menu keeps the exact request count visible on the right, infers the daily reset from midnight America/Chicago based on Crof's current support guidance, and links to the Crof dashboard. The provider also supports CROF_API_KEY, CROFAI_API_KEY, and the existing ~/.codexbar/config.json API-key flow.

Screenshot

image

Testing

  • swift test --filter 'CrofUsageFetcherTests|CrofMenuCardTests|CrofProviderImplementationTests|ProviderIconResourcesTests'
  • pnpm check
  • git diff --check HEAD~1 HEAD

Notes

  • Full swift test was not used as the final gate because the existing Mistral date parser test is failing independently on this machine (MistralUsageParserTests.swift:69, expected month 11, got 10).
  • Crof's API does not currently return reset metadata, so the reset is based on what they said in Twitter DMs

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fda4bc80c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +45 to +46
resetsAt: nil,
resetDescription: creditsDetail)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid encoding Crof credit balance as a reset string

Storeing Crof credits in secondary.resetDescription while secondary.resetsAt is nil makes generic renderers print a misleading reset message (e.g., "Resets 10 credits") because UsageFormatter.resetLine prepends "Resets" whenever only resetDescription is present (Sources/CodexBarCore/UsageFormatter.swift, resetLine). This affects paths that were not given Crof-specific overrides (notably CLI/text renderers), so users can see credit balance presented as if it were a reset time.

Useful? React with 👍 / 👎.

@baanish baanish force-pushed the codex/add-crofai-provider branch from 4fda4bc to 0a1380f Compare May 8, 2026 22:22
@baanish baanish force-pushed the codex/add-crofai-provider branch from 0a1380f to 64f2eed Compare May 8, 2026 22:26
@steipete steipete merged commit c727684 into steipete:main May 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants