Skip to content

monotykamary/pi-crofai-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

83 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— pi-crofai-provider

Open-weight models through CrofAI

A pi provider extension with reasoning, vision, and live usage status.

pi extension license


Features

  • OpenAI-compatible API - Uses CrofAI's /v1/chat/completions endpoint
  • Reasoning models - Support for thinking models with reasoning_effort parameter
  • Vision models - Image input support on Kimi K2.5, Kimi K2.6, GLM 5.1 (Precision), and Qwen 3.5 / 3.6
  • Tool use - Function calling support
  • Streaming - Real-time token streaming
  • Free tier - Some models available at no cost (GLM 4.7 Flash, Qwen3.5 9B)
  • Usage status bar β€” Displays your remaining credits and daily request count in the pi footer, updated live across sessions

Available Models

Model Context Vision Reasoning Input $/M Output $/M
DeepSeek V3.2 164K ❌ βœ… $0.18 $0.35
DeepSeek V4 Flash 1.0M ❌ βœ… $0.12 $0.21
DeepSeek V4 Pro 1.0M ❌ βœ… $0.35 $0.80
DeepSeek V4 Pro (Lightning) 1.0M ❌ βœ… $0.80 $1.60
Gemma 4 31B IT 262K ❌ βœ… $0.10 $0.30
GLM 4.7 203K ❌ βœ… $0.25 $1.10
GLM 4.7 Flash 203K ❌ βœ… $0.04 $0.30
GLM 5 203K ❌ βœ… $0.48 $1.90
GLM 5.1 203K ❌ βœ… $0.45 $2.15
GLM 5.2 1.0M ❌ βœ… $0.30 $1.05
Greg (Roleplay) 229K ❌ ❌ $0.10 $0.30
Greg 1 Mini 229K ❌ ❌ $0.07 $0.15
Greg 2 Super 229K ❌ ❌ $1.50 $5.00
Greg 2 Ultra 229K ❌ ❌ $3.00 $10.00
Kimi K2.5 262K βœ… βœ… $0.35 $1.70
Kimi K2.5 (Lightning) 131K βœ… βœ… $1.00 $3.00
Kimi K2.6 262K βœ… βœ… $0.50 $1.99
Kimi K2.7 Code 262K ❌ βœ… $0.55 $2.25
MiMo-V2.5-Pro 1.0M ❌ βœ… $0.40 $0.80
MiniMax M2.5 205K ❌ βœ… $0.11 $0.95
Qwen3.5 397B A17B 262K βœ… βœ… $0.35 $1.75
Qwen3.5 9B 262K βœ… βœ… $0.04 $0.15
Qwen3.6 27B 262K βœ… βœ… $0.20 $1.50

Installation

Option 1: Using pi install (Recommended)

Install directly from GitHub:

pi install https://github.com/monotykamary/pi-crofai-provider

Then set your API key and run pi:

# Recommended: add to auth.json
# See Authentication section below

# Or set as environment variable
export CROFAI_API_KEY=your-api-key-here

pi

Get your API key from crof.ai.

Option 2: Manual Clone

  1. Clone this repository:

    git clone https://github.com/monotykamary/pi-crofai-provider.git
    cd pi-crofai-provider
  2. Set your CrofAI API key:

    # Recommended: add to auth.json
    # See Authentication section below
    
    # Or set as environment variable
    export CROFAI_API_KEY=your-api-key-here
  3. Run pi with the extension:

    pi -e /path/to/pi-crofai-provider

Authentication

The CrofAI API key can be configured in multiple ways (resolved in this order):

  1. auth.json (recommended) β€” Add to ~/.pi/agent/auth.json:
    { "crofai": { "type": "api_key", "key": "your-api-key" } }
    The key field supports literal values, env var names, and shell commands (prefix with !). See pi's auth file docs for details.
  2. Runtime override β€” Use the --api-key CLI flag
  3. Environment variable β€” Set CROFAI_API_KEY

Get your API key from crof.ai.

Environment Variables

Variable Required Description
CROFAI_API_KEY No Your CrofAI API key (fallback if not in auth.json)

Configuration

Add to your pi configuration for automatic loading:

{
  "extensions": [
    "/path/to/pi-crofai-provider"
  ]
}

Usage

Once loaded, select a model with:

/model crofai kimi-k2.5

Or use /models to browse all available CrofAI models.

Reasoning Effort

For reasoning models, control thinking depth:

/reasoning high

Values: none, low, medium, high

Usage Status Bar

Once authenticated, the pi footer shows your CrofAI account status:

$12.35 | ⇄ 450
  • $X.XX β€” Remaining credit balance (hidden when $0)
  • ⇄ N β€” Daily requests remaining (hidden when not on a subscription plan)

The count is fetched from CrofAI's usage API on session start and after each user prompt. Between syncs, the request count is decremented locally per turn to avoid unnecessary API calls.

API Compatibility

The CrofAI proxy differs from native provider APIs in several ways. These are handled via patch.json:

Aspect Native APIs CrofAI
Max tokens field max_completion_tokens max_tokens
Thinking format Varies (openai, zai, qwen-chat-template) openai (always reasoning_content)
Developer role Varies per model βœ… Supported on all models
Reasoning effort Varies per model Accepted by all reasoning models
store parameter Varies ❌ Not supported

Note: The CrofAI /v1/models endpoint does not reliably report reasoning capability. Many models that support thinking are missing the custom_reasoning or reasoning_effort flags. patch.json corrects these based on E2E testing.

API Documentation

  • CrofAI Docs: https://crof.ai/docs
  • OpenAI-compatible endpoint: https://crof.ai/v1
  • Models endpoint: https://crof.ai/v1/models
  • Usage endpoint: https://crof.ai/usage_api/

License

MIT

About

A pi extension to enable crof.ai as a model provider.

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors