feat: add GLM (ZhipuAI) support to playground#5608
Conversation
- Add ZhipuAI provider for direct GLM API access - Add glm-4.6:zai and glm-4.7:zai endpoints - Add provider model ID to canonical model ID mapping - Update playground to resolve provider-specific model IDs (e.g., "zai-glm-4.7") to canonical IDs (e.g., "glm-4.7") - Update model registry to include providerModelIdMap in response This allows users to open requests made with provider-specific model IDs (like Cerebras's "zai-glm-4.7") in the playground without falling back to gpt-4o-mini. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Claude finished @colegottdank's task —— View job PR Review: GLM (ZhipuAI) Playground SupportReview Checklist:
Score: 7/10 - Good implementation with some improvements suggestedThis PR adds GLM (ZhipuAI) support to the playground with comprehensive cost modeling and multiple provider endpoints. The implementation is solid but has several areas for improvement. Critical Issues Found:1. Context Length Inconsistency 🚨Location: There are inconsistent context lengths across providers for the same model:
Fix: Verify actual context lengths with provider documentation and standardize where the same model should have the same limits. 2. Missing Type DefinitionLocation: import { ZaiModelName } from "./models";This import suggests a Fix: Either include the missing models.ts file or remove this import if not needed. 3. Duplicate Model IDsLocation: Both Fix: Clarify if these should have different provider model IDs or if they truly map to the same underlying model. Code Quality Issues:4. Hardcoded Currency ConversionLocation: input: 0.00000714, // 0.05 CNY/1K tokens ≈ $0.00714/1KIssue: Exchange rates fluctuate, making hardcoded conversions unreliable. Suggestion: Either:
5. Provider Slug Mapping GapLocation: The private getProviderSlug(provider: string): string {
const slugMap: Record<string, string> = {
// ... other providers
// Missing: zai: "zhipuai" or similar
};
return slugMap[provider.toLowerCase()] || provider.toLowerCase();
}Fix: Add explicit mapping for ZAI provider. Performance & Best Practices:6. Model Registry Caching ✅The frontend properly implements caching with 7. Efficient Model Filtering ✅The model selection logic in 8. Type Safety ✅Good use of TypeScript with proper interfaces and type assertions where needed. Security Assessment:9. URL Validation ✅Base URLs and endpoints are properly validated and use HTTPS. 10. No Hardcoded Secrets ✅No API keys or sensitive information in the code. Suggestions Summary:High Priority:
Medium Priority:
Low Priority:
Breaking Changes Assessment:✅ No breaking changes detected - This is an additive feature that doesn't modify existing APIs. Additional Notes:
Recommended Actions:
The foundation is solid - these improvements will ensure reliability and consistency with the existing codebase. |
No description provided.