@tretrauit/opencode-crofai
v1.2.10
Published
Adds CrofAI provider support to OpenCode.
Downloads
1,678
Readme
opencode-crofai
OpenCode plugin for CrofAI's OpenAI-compatible API.
What it does
- registers CrofAI models from
GET /v1/models - caches model metadata in the OpenCode cache under
.cache/crofai-models.json - uses cached models immediately on startup
- refreshes the cache in background
- falls back to cached models if the endpoint is unavailable
- normalizes variant names like
LightningandPrecision
Install
Via a LLM
Install the opencode-crofai plugin and configure it by following: https://raw.githubusercontent.com/teppyboy/opencode-crofai/main/installation.mdVia OpenCode CLI
opencode plugin -g @tretrauit/opencode-crofaiThen run /connect in OpenCode and enter your CrofAI API key.
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@tretrauit/opencode-crofai"]
}Local development
git clone https://github.com/teppyboy/opencode-crofai
cd opencode-crofai
bun run buildUse this in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["./dist/index.js"]
}Forking
Reusable factory is published from @tretrauit/opencode-crofai/factory and lives in
src/openai-compatible-plugin.ts.
Create a thin wrapper like:
import { createOpenAICompatiblePlugin } from '@tretrauit/opencode-crofai/factory';
export const ExamplePlugin = createOpenAICompatiblePlugin({
providerID: 'example',
providerName: 'ExampleAI',
baseURL: 'https://example.com/v1',
authLabel: 'API Key',
authPlaceholder: 'example-...',
authPromptMessage: 'Enter your ExampleAI API key',
cacheFileName: 'example-models.json',
});Development
bun run build
bun test
bun run lint
bun run formatRelease
GitHub Actions can publish to npm automatically from tags.
Repository setup:
- configure npm trusted publishing for this GitHub repository
- allow this workflow to publish
@tretrauit/opencode-crofai
Release flow:
# bump package.json version first
git commit -am "chore: bump version to vX.Y.Z"
git tag vX.Y.Z
git push
git push --tagsWorkflow behavior:
- triggers on tags matching
v* - verifies tag matches
package.jsonversion - runs tests and build
- runs
npm pack --dry-run - publishes to npm with provenance via GitHub Actions OIDC
Links
- OpenCode plugin docs: https://opencode.ai/docs/plugins/
- OpenCode config docs: https://opencode.ai/docs/config/
- CrofAI docs: https://crof.ai/docs
License
See the LICENSE file for details.
