mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-03 05:45:04 +03:00
CrofAI (https://crof.ai) ships an OpenAI-compatible /v1 endpoint with Bearer auth and a /v1/models discovery route. It hosts a curated set of hosted open models (DeepSeek V3.2/V4 Pro, Kimi K2.5/K2.6, GLM 4.7/5.x, Gemma 4, MiniMax M2.5, Qwen3.5/3.6) that today users can only attach through the generic "Add OpenAI Compatible" flow — losing branding, defaults, prefix routing, and showing up under "API Key Compatible Providers" instead of the curated "API Key Providers" section. This change wires CrofAI as a first-class built-in, mirroring how Kimi is registered (OpenAI format + bearer auth + seed model list). Files touched (kept tight): - src/shared/constants/providers.ts Add `crof` to APIKEY_PROVIDERS with id/alias/name/icon/color/textIcon/website. - src/shared/constants/config.ts Register PROVIDER_ENDPOINTS.crof = "https://crof.ai/v1/chat/completions". - open-sse/config/providerRegistry.ts Add a `crof` REGISTRY entry: format "openai", executor "default", authType "apikey", authHeader "bearer", and a seed model list pulled from a live GET https://crof.ai/v1/models on 2026-04-25 (DeepSeek, Kimi, GLM, Gemma, MiniMax, Qwen variants). Runtime /models discovery keeps the live catalog up to date. - src/shared/components/ProviderIcon.tsx Map `crof -> "crof"` in PROVIDER_ICON_MAP. Not added to PNG_PROVIDERS so the UI falls back to the textIcon ("CR") until a logo asset ships at public/providers/crof.png. - tests/unit/crof-provider.test.ts (new) Pins the registration shape (provider identity, base URL, registry entry, seed model families). Required by the repo's PR Test Policy. Verified end-to-end against a locally rebuilt image: - CrofAI appears under "API Key Providers" alongside GLM Coding/Minimax. - The connection-add dialog opens with title "Add CrofAI API Key". - POST /api/providers/validate returns "Valid" against /v1/models. - POST /api/providers persists a connection (testStatus=active). - POST /v1/chat/completions { model: "crof/kimi-k2.5", ... } returns 200 with a real Kimi K2.5 response — full proxy path resolves through the new registry entry. - npm run test:unit passes locally including tests/unit/crof-provider.test.ts. Notes for the maintainer: - No logo file is included; happy to follow up with a PNG for public/providers/crof.png. Until then the UI uses the "CR" textIcon. - Pricing (src/shared/constants/pricing.ts) is intentionally not hardcoded — CrofAI exposes per-model pricing via /v1/models response, and runtime sync is preferable to stale baked-in numbers. Happy to add a stub block if requested. - Anthropic-compatible endpoint (https://anthropic.nahcrof.com/v1/messages) is not wired in this PR. Users can still add it via "Add Anthropic Compatible" if needed.
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
export { APP_CONFIG, THEME_CONFIG } from "./appConfig";
|
|
|
|
// Subscription
|
|
export const SUBSCRIPTION_CONFIG = {
|
|
price: 1.0,
|
|
currency: "USD",
|
|
interval: "month",
|
|
planName: "Pro Plan",
|
|
};
|
|
|
|
// API endpoints
|
|
export const API_ENDPOINTS = {
|
|
users: "/api/users",
|
|
providers: "/api/providers",
|
|
payments: "/api/payments",
|
|
auth: "/api/auth",
|
|
};
|
|
|
|
// Provider API endpoints (for display only)
|
|
export const PROVIDER_ENDPOINTS = {
|
|
openrouter: "https://openrouter.ai/api/v1/chat/completions",
|
|
glm: "https://api.z.ai/api/anthropic/v1/messages",
|
|
glmt: "https://api.z.ai/api/anthropic/v1/messages",
|
|
"bailian-coding-plan": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1/messages",
|
|
kimi: "https://api.moonshot.ai/v1/chat/completions",
|
|
"kimi-coding": "https://api.kimi.com/coding/v1/messages",
|
|
"kimi-coding-apikey": "https://api.kimi.com/coding/v1/messages",
|
|
minimax: "https://api.minimax.io/anthropic/v1/messages",
|
|
"minimax-cn": "https://api.minimaxi.com/anthropic/v1/messages",
|
|
crof: "https://crof.ai/v1/chat/completions",
|
|
openai: "https://api.openai.com/v1/chat/completions",
|
|
anthropic: "https://api.anthropic.com/v1/messages",
|
|
gemini: "https://generativelanguage.googleapis.com/v1beta/models",
|
|
};
|
|
|
|
// Re-export from providers.js for backward compatibility
|
|
export {
|
|
FREE_PROVIDERS,
|
|
OAUTH_PROVIDERS,
|
|
APIKEY_PROVIDERS,
|
|
WEB_COOKIE_PROVIDERS,
|
|
SEARCH_PROVIDERS,
|
|
AUDIO_ONLY_PROVIDERS,
|
|
AI_PROVIDERS,
|
|
AUTH_METHODS,
|
|
} from "./providers";
|
|
|
|
// Re-export from models.js for backward compatibility
|
|
export { PROVIDER_MODELS, AI_MODELS } from "./models";
|