@asteby/metacore-org-ai
v2.0.4
Published
Metacore org AI settings - provider/model/API-key per organization and the Claude connect flow, with injected HTTP client, i18n and notifications.
Readme
@asteby/metacore-org-ai
Per-organization AI settings and the Claude connect flow. Provider, model and API key are chosen per org; HTTP client, i18n, toasts and the Claude flow are injected. No billing, credits or hub concepts live here.
Adoption
import {
OrgAISettings, createOrgAIApi, createClaudeConnectApi,
} from '@asteby/metacore-org-ai'
const api = createOrgAIApi(axiosInstance) // GET/PUT /organization/ai-config
const claude = createClaudeConnectApi(axiosInstance) // /organization/ai-config/claude/*
<OrgAISettings
api={api}
t={t} // optional, i18next-compatible; English built in
notify={{ success: toast.success, error: toast.error }} // optional
claudeConnect={{ api: claude }} // omit to hide the Claude flow
providers={myProviders} // optional, see ProviderPreset
/>OrgAIApiis an interface: pass your own object if the backend differs (createOrgAIApi(http, { basePath, userSourcePath: false })to tune routes).- Default providers: Anthropic, OpenAI, DeepSeek and an OpenAI-compatible custom
endpoint. A preset with
seatIdis disabled untilconfig.seats[seatId].ready. - The API key is write-only: the form never receives it, only
has_api_key. - The "use my local AI" toggle renders only when
api.updateUserSourceexists and the config carriesuser_ai_source. - Messages: keys
org_ai.*; defaults inORG_AI_MESSAGES_EN, plusORG_AI_MESSAGES_ESto merge into your catalog. ClaudeConnectDialogis exported on its own (api,open,onOpenChange,onConnected,openUrl). Backend error codes:binary_missing,invalid_code,timeout,expired,busy,invalid_token.- Accessibility: provider cards are a
radiogroup; loading isrole=status+aria-busy; load/save/connect errors arerole=alert; the load error offers retry; an empty provider list shows an empty state.
Peers: @asteby/metacore-ui, @tanstack/react-query, lucide-react, react.
