An OpenCode plugin that adds CrofAI as a first-class provider.
CrofAI provides cheap access to open-weight LLMs. This plugin dynamically discovers available models from CrofAI's API, so you always see the latest models without updating the plugin.
opencode plugin oc-crofai- Get an API key from crof.ai
- OpenCode will prompt you to enter your CrofAI API key when you first use the provider
- Select "CrofAI" as your provider and choose a model
Alternatively, set the CROFAI_API_KEY environment variable:
export CROFAI_API_KEY="your-api-key-here"The plugin uses three OpenCode hooks:
config— Registers CrofAI as a provider with@ai-sdk/openai-compatibleSDK integrationprovider— Fetcheshttps://crof.ai/v1/modelson startup and maps the response (context length, pricing, reasoning capabilities) to OpenCode's model schema. Models are sorted alphabetically and cached to disk for instant startup, with background refresh to keep them current.auth— Provides interactive API key entry with automaticCROFAI_API_KEYenv var fallback
- Disk cache with background refresh — Models load instantly from cache on startup; fresh data is fetched in the background so subsequent calls always see the latest models
- 1-hour cache TTL — Stale caches are discarded and re-fetched automatically
- 10s fetch timeout — Prevents hangs if the API is unreachable
- Model sorting — Models are sorted alphabetically for consistent ordering in the UI
All reasoning-capable models include four variants for controlling thinking depth:
| Variant | Reasoning Effort | Effect |
|---|---|---|
none |
"none" |
Disables reasoning — reduces latency and cost |
low |
"low" |
Minimal thinking, faster responses |
medium |
"medium" |
Balanced (default) |
high |
"high" |
Maximum thinking, best reasoning |
To use a variant, set it in your OpenCode agent config:
agent:
build:
model: crofai/kimi-k2.6
variant: highMIT