mirror of
https://github.com/hanzoai/extension.git
synced 2026-10-31 21:57:06 +00:00
Office, Outlook, PDF, Clio, Meetings, Google Workspace and Salesforce defaulted to zen-1, Teams offered zen-eco-3b, zen-mini-8b and zen-4b, and JetBrains defaulted to claude-3-5-sonnet-20241022 with a fallback list of retired upstream ids. None of those are in api.hanzo.ai/v1/models, so a first request on each of them named a model the gateway does not serve. zen5 is the id the catalog itself marks as the default: catalog.hanzo.ai /v1/pricing lists it as "Zen5 (Default)", "the everyday Zen5 chat model", and nineteen other surfaces here already defaulted to it. Teams now offers the catalog's Zen 5 family with zen5 first. JetBrains preselects zen5 when the live list carries it, and offers only zen5 when it cannot load the list, rather than a fabricated one. Claude-Session: https://claude.ai/code/session_01Dc8DXc3fEQCRHUa6XWK4Ku
31 lines
1.4 KiB
TypeScript
31 lines
1.4 KiB
TypeScript
// Office add-in config — ONLY what is office-specific. IAM endpoints, the OAuth
|
|
// client, PKCE, and scopes now live in @hanzo/auth (the one auth core); this
|
|
// module keeps the api.hanzo.ai model gateway + the roaming-settings keys.
|
|
|
|
export const API_BASE_URL = 'https://api.hanzo.ai';
|
|
|
|
// Default model. Overridable per-request; the gateway routes it.
|
|
export const DEFAULT_MODEL = 'zen5';
|
|
|
|
// Roaming-settings keys (Office.context.roamingSettings persists per-user across
|
|
// the user's devices). Two auth paths: the IAM OAuth token set (managed by
|
|
// @hanzo/auth) and a pasted Hanzo API key (`sk-…`) for zero-setup use — the key
|
|
// needs no registered OAuth client, which is why the Windows test kit uses it.
|
|
export const TOKEN_SETTING_KEY = 'hanzo.tokens';
|
|
export const APIKEY_SETTING_KEY = 'hanzo.apiKey';
|
|
|
|
// pickBearer chooses the credential to send: a pasted API key wins over the
|
|
// OAuth token (an explicit key is a deliberate override), else the OAuth token,
|
|
// else empty (anonymous). Pure — unit-tested.
|
|
export function pickBearer(apiKey: string, oauthToken: string): string {
|
|
return (apiKey && apiKey.trim()) || (oauthToken && oauthToken.trim()) || '';
|
|
}
|
|
|
|
// chatCompletionsURL / modelsURL — the model gateway endpoints the add-in calls.
|
|
export function chatCompletionsURL(): string {
|
|
return `${API_BASE_URL}/v1/chat/completions`;
|
|
}
|
|
export function modelsURL(): string {
|
|
return `${API_BASE_URL}/v1/models`;
|
|
}
|