Created
April 24, 2026 03:26
-
-
Save u007/3c1dfa2d410521ed5155eab05163ecf8 to your computer and use it in GitHub Desktop.
add kimi k2.6, and gemma from chutes to opencode. and gemma 31b from deepinfra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Add Kimi K2.6 and Gemma 4 models from DeepInfra to opencode models.dev cache | |
| # Run this after opencode fetches models from models.dev | |
| set -e | |
| # Find the models.json cache file | |
| # opencode stores it at ~/.cache/opencode/models-<hash>.json or ~/.cache/opencode/models.json | |
| CACHE_DIR="$HOME/.cache/opencode" | |
| MODELS_FILE="" | |
| # Look for the models cache file | |
| if [ -f "$CACHE_DIR/models.json" ]; then | |
| MODELS_FILE="$CACHE_DIR/models.json" | |
| else | |
| # Find models-*.json files | |
| MODELS_FILE=$(find "$CACHE_DIR" -maxdepth 1 -name "models-*.json" -type f 2>/dev/null | head -1) | |
| fi | |
| if [ -z "$MODELS_FILE" ] || [ ! -f "$MODELS_FILE" ]; then | |
| echo "Error: models cache not found at $CACHE_DIR" | |
| echo "Run opencode first to initialize the models cache." | |
| exit 1 | |
| fi | |
| echo "Adding models to: $MODELS_FILE" | |
| python3 << EOF | |
| import json | |
| import sys | |
| MODELS_FILE = "$MODELS_FILE" | |
| try: | |
| with open(MODELS_FILE, 'r') as f: | |
| models_data = json.load(f) | |
| deepinfra = models_data.get('deepinfra', {}) | |
| deepinfra_models = deepinfra.get('models', {}) | |
| kimi_exists = 'moonshotai/Kimi-K2.6' in deepinfra_models | |
| gemma_exists = 'google/gemma-4-31B-it' in deepinfra_models | |
| if kimi_exists and gemma_exists: | |
| print("✓ All models already exist in models cache") | |
| sys.exit(0) | |
| # Add Kimi K2.6 from DeepInfra | |
| if not kimi_exists: | |
| kimi_k26 = { | |
| "id": "moonshotai/Kimi-K2.6", | |
| "name": "Kimi K2.6", | |
| "family": "kimi", | |
| "release_date": "2026-04-20", | |
| "last_updated": "2026-04-24", | |
| "attachment": True, | |
| "reasoning": True, | |
| "temperature": True, | |
| "tool_call": True, | |
| "knowledge": "2025-12", | |
| "open_weights": True, | |
| "structured_output": True, | |
| "interleaved": { | |
| "field": "reasoning" | |
| }, | |
| "cost": { | |
| "input": 0.75, | |
| "output": 3.50, | |
| "cache_read": 0.15 | |
| }, | |
| "limit": { | |
| "context": 262144, | |
| "output": 262144 | |
| }, | |
| "modalities": { | |
| "input": ["text", "image", "video"], | |
| "output": ["text"] | |
| } | |
| } | |
| deepinfra_models['moonshotai/Kimi-K2.6'] = kimi_k26 | |
| print("✓ Added Kimi K2.6 (DeepInfra)") | |
| else: | |
| print(" Kimi K2.6 (DeepInfra) already exists") | |
| # Add Gemma 4 31B from DeepInfra | |
| if not gemma_exists: | |
| gemma_4_31b = { | |
| "id": "google/gemma-4-31B-it", | |
| "name": "Gemma 4 31B", | |
| "family": "gemma", | |
| "release_date": "2026-04-23", | |
| "last_updated": "2026-04-24", | |
| "attachment": True, | |
| "reasoning": False, | |
| "temperature": True, | |
| "tool_call": True, | |
| "knowledge": "2025-12", | |
| "open_weights": True, | |
| "structured_output": True, | |
| "cost": { | |
| "input": 0.13, | |
| "output": 0.38 | |
| }, | |
| "limit": { | |
| "context": 262144, | |
| "output": 262144 | |
| }, | |
| "modalities": { | |
| "input": ["text", "image"], | |
| "output": ["text"] | |
| } | |
| } | |
| deepinfra_models['google/gemma-4-31B-it'] = gemma_4_31b | |
| print("✓ Added Gemma 4 31B (DeepInfra)") | |
| else: | |
| print(" Gemma 4 31B (DeepInfra) already exists") | |
| deepinfra['models'] = deepinfra_models | |
| models_data['deepinfra'] = deepinfra | |
| with open(MODELS_FILE, 'w') as f: | |
| json.dump(models_data, f, indent=2) | |
| print("✓ Successfully updated models cache") | |
| except Exception as e: | |
| print(f"✗ Error: {e}") | |
| sys.exit(1) | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment