feat(connectors): add Ollama and LM Studio as a local auth kind

Both servers expose OpenAI-compatible /v1/chat/completions and /v1/models,
so we route them through pi-ai's `openai-completions` API the same way
Fireworks does — but with a per-installation base URL the user enters
during onboarding instead of a hardcoded one. The shared schemas grow a
`local` credential payload carrying just the baseUrl; the credential
resolver surfaces it on `ResolvedCredential.baseUrl`, the runtime bridge
forwards it through `prepareRun`, and the worker plumbs it into
`resolveModel` so the streamed Model<openai-completions> targets the
user's server. The local-cost path short-circuits to zero in cost-writer
since users bill their own hardware, and the live model list is fetched
from the saved baseUrl by `fetchLocalConnectorModels` (Ollama and LM
Studio both speak the standard OpenAI catalog shape). Onboarding ships
a new LocalProviderCard and the Settings panel a LocalForm; both default
to the catalog's per-connector localhost URL and accept any custom URL.
This commit is contained in:
ZacharyZhang-NY committed 2026-05-14 14:55:38 -04:00
1 parent 07d9c00fab
commit a532120649
26 files changed
+504 -18

No files matched your search

+11 -3
View File
@@ -25,7 +25,7 @@
import type { KnownProvider } from "@mariozechner/pi-ai";
import type { ConnectorId } from "@shared/types";
import { OAUTH_CONNECTORS, API_KEY_CONNECTORS, CLOUD_CONNECTORS } from "./connector-definitions/index";
import { OAUTH_CONNECTORS, API_KEY_CONNECTORS, CLOUD_CONNECTORS, LOCAL_CONNECTORS } from "./connector-definitions/index";
/**
* OAuth provider id recognised by the AgentCompany credential layer. These
@@ -61,14 +61,21 @@ export interface ConnectorAuthGcpAdc {
type: "gcp_adc";
}
export interface ConnectorAuthLocal {
type: "local";
/** Pre-filled base URL the onboarding card shows on first save. */
defaultBaseUrl: string;
}
export type ConnectorAuth =
| ConnectorAuthOAuth
| ConnectorAuthApiKey
| ConnectorAuthAws
| ConnectorAuthAzure
| ConnectorAuthGcpAdc;
| ConnectorAuthGcpAdc
| ConnectorAuthLocal;
export type LocalModelResolverProvider = "fireworks" | "fireworks-firepass";
export type LocalModelResolverProvider = "fireworks" | "fireworks-firepass" | "ollama" | "lm-studio";
export type ConnectorProvider = KnownProvider | LocalModelResolverProvider;
export interface ConnectorDefinition {
@@ -94,4 +101,5 @@ export const CONNECTORS: ConnectorDefinition[] = [
...OAUTH_CONNECTORS,
...API_KEY_CONNECTORS,
...CLOUD_CONNECTORS,
...LOCAL_CONNECTORS,
];