akhaliq HF Staff commited on
Commit
85de881
·
1 Parent(s): a91f0eb

add kimi k2 turbo

Browse files
Files changed (2) hide show
  1. README.md +4 -1
  2. app.py +11 -0
README.md CHANGED
@@ -19,7 +19,7 @@ AnyCoder is an AI-powered code generator that helps you create applications by d
19
 
20
  ## Features
21
 
22
- - **Multi-Model Support**: Choose from Moonshot Kimi-K2, DeepSeek V3, DeepSeek R1, ERNIE-4.5-VL, MiniMax M1, Qwen3-235B-A22B, Qwen3-30B-A3B-Instruct-2507, Qwen3-30B-A3B-Thinking-2507, SmolLM3-3B, GLM-4.1V-9B-Thinking, Gemini 2.5 Flash and Gemini 2.5 Pro (OpenAI-compatible)
23
  - Claude-Opus-4.1 (via Poe)
24
  - **Flexible Input**: Describe your app in text, upload a UI design image (for multimodal models), provide a reference file (PDF, TXT, MD, CSV, DOCX, or image), or enter a website URL for redesign
25
  - **Web Search Integration**: Enable real-time web search (Tavily, with advanced search depth) to enhance code generation with up-to-date information and best practices
@@ -48,6 +48,7 @@ export TAVILY_API_KEY="your_tavily_api_key" # Optional, for web search feature
48
  export DASHSCOPE_API_KEY="your_dashscope_api_key" # Required for Qwen3-30B models via DashScope
49
  export POE_API_KEY="your_poe_api_key" # Required for GPT-5 and Grok-4 via Poe
50
  export GEMINI_API_KEY="your_gemini_api_key" # Required for Gemini models
 
51
  ```
52
 
53
  ## Usage
@@ -71,6 +72,7 @@ python app.py
71
  ## Supported Models
72
 
73
  - Moonshot Kimi-K2
 
74
  - DeepSeek V3
75
  - DeepSeek R1
76
  - ERNIE-4.5-VL (multimodal)
@@ -129,6 +131,7 @@ python app.py
129
  - `HF_TOKEN`: Your Hugging Face API token (required)
130
  - `TAVILY_API_KEY`: Your Tavily API key (optional, for web search)
131
  - `GEMINI_API_KEY`: Your Google Gemini API key (required to use Gemini models)
 
132
 
133
  ## Project Structure
134
 
 
19
 
20
  ## Features
21
 
22
+ - **Multi-Model Support**: Choose from Moonshot Kimi-K2, Kimi K2 Turbo (Preview), DeepSeek V3, DeepSeek R1, ERNIE-4.5-VL, MiniMax M1, Qwen3-235B-A22B, Qwen3-30B-A3B-Instruct-2507, Qwen3-30B-A3B-Thinking-2507, SmolLM3-3B, GLM-4.1V-9B-Thinking, Gemini 2.5 Flash and Gemini 2.5 Pro (OpenAI-compatible)
23
  - Claude-Opus-4.1 (via Poe)
24
  - **Flexible Input**: Describe your app in text, upload a UI design image (for multimodal models), provide a reference file (PDF, TXT, MD, CSV, DOCX, or image), or enter a website URL for redesign
25
  - **Web Search Integration**: Enable real-time web search (Tavily, with advanced search depth) to enhance code generation with up-to-date information and best practices
 
48
  export DASHSCOPE_API_KEY="your_dashscope_api_key" # Required for Qwen3-30B models via DashScope
49
  export POE_API_KEY="your_poe_api_key" # Required for GPT-5 and Grok-4 via Poe
50
  export GEMINI_API_KEY="your_gemini_api_key" # Required for Gemini models
51
+ export MOONSHOT_API_KEY="your_moonshot_api_key" # Required for Kimi models
52
  ```
53
 
54
  ## Usage
 
72
  ## Supported Models
73
 
74
  - Moonshot Kimi-K2
75
+ - Kimi K2 Turbo (Preview)
76
  - DeepSeek V3
77
  - DeepSeek R1
78
  - ERNIE-4.5-VL (multimodal)
 
131
  - `HF_TOKEN`: Your Hugging Face API token (required)
132
  - `TAVILY_API_KEY`: Your Tavily API key (optional, for web search)
133
  - `GEMINI_API_KEY`: Your Google Gemini API key (required to use Gemini models)
134
+ - `MOONSHOT_API_KEY`: Your Moonshot AI API key (required to use Kimi models)
135
 
136
  ## Project Structure
137
 
app.py CHANGED
@@ -412,6 +412,11 @@ AVAILABLE_MODELS = [
412
  "id": "moonshotai/Kimi-K2-Instruct",
413
  "description": "Moonshot AI Kimi-K2-Instruct model for code generation and general tasks"
414
  },
 
 
 
 
 
415
  {
416
  "name": "DeepSeek V3",
417
  "id": "deepseek-ai/DeepSeek-V3-0324",
@@ -686,6 +691,12 @@ def get_inference_client(model_id, provider="auto"):
686
  api_key=os.getenv("GEMINI_API_KEY"),
687
  base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
688
  )
 
 
 
 
 
 
689
  elif model_id == "openai/gpt-oss-120b":
690
  provider = "cerebras"
691
  elif model_id == "openai/gpt-oss-20b":
 
412
  "id": "moonshotai/Kimi-K2-Instruct",
413
  "description": "Moonshot AI Kimi-K2-Instruct model for code generation and general tasks"
414
  },
415
+ {
416
+ "name": "Kimi K2 Turbo (Preview)",
417
+ "id": "kimi-k2-turbo-preview",
418
+ "description": "Moonshot AI Kimi K2 Turbo via OpenAI-compatible API"
419
+ },
420
  {
421
  "name": "DeepSeek V3",
422
  "id": "deepseek-ai/DeepSeek-V3-0324",
 
691
  api_key=os.getenv("GEMINI_API_KEY"),
692
  base_url="https://generativelanguage.googleapis.com/v1beta/openai/",
693
  )
694
+ elif model_id == "kimi-k2-turbo-preview":
695
+ # Use Moonshot AI (OpenAI-compatible) client for Kimi K2 Turbo (Preview)
696
+ return OpenAI(
697
+ api_key=os.getenv("MOONSHOT_API_KEY"),
698
+ base_url="https://api.moonshot.ai/v1",
699
+ )
700
  elif model_id == "openai/gpt-oss-120b":
701
  provider = "cerebras"
702
  elif model_id == "openai/gpt-oss-20b":