/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./errors/sdk-validation-error.js"; export type ProviderConfigSupportedModel = { /** * Model identifier */ id: string; displayName?: string | undefined; family?: string | undefined; roles?: Array | undefined; source?: string | undefined; }; /** * Provider config object (API key is masked) */ export type ProviderConfig = { /** * Provider config unique identifier */ id: string; /** * Display name */ name: string; /** * Provider type */ provider: string; /** * Masked API key (e.g., "sk-...abc123") */ apiKeyMasked: string; /** * Workspace this configuration belongs to */ workspaceId: string; /** * Custom base URL */ baseUrl: string | null; /** * Model name mappings */ modelOverrides: { [k: string]: string } | null; /** * Whether the config is active */ isActive: boolean; /** * Whether this is the default for its workspace */ isDefault: boolean; /** * Hosted model family for gateway entries: 'openai' | 'anthropic' | 'inference'; null for direct providers */ hostedFamily: string | null; /** * Declared models this provider serves */ supportedModels: Array | null; /** * API version string */ apiVersion: string | null; /** * Additional metadata */ metadata: { [k: string]: any } | null; /** * User ID of the creator */ createdBy: string | null; /** * Creation timestamp (ISO 8601) */ createdAt: Date; /** * Last update timestamp (ISO 8601) */ updatedAt: Date; }; /** @internal */ export const ProviderConfigSupportedModel$inboundSchema: z.ZodMiniType< ProviderConfigSupportedModel, unknown > = z.object({ id: types.string(), displayName: types.optional(types.string()), family: types.optional(types.string()), roles: types.optional(z.array(types.string())), source: types.optional(types.string()), }); export function providerConfigSupportedModelFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProviderConfigSupportedModel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderConfigSupportedModel' from JSON`, ); } /** @internal */ export const ProviderConfig$inboundSchema: z.ZodMiniType< ProviderConfig, unknown > = z.object({ id: types.string(), name: types.string(), provider: types.string(), apiKeyMasked: types.string(), workspaceId: types.string(), baseUrl: types.nullable(types.string()), modelOverrides: types.nullable(z.record(z.string(), types.string())), isActive: types.boolean(), isDefault: types.boolean(), hostedFamily: types.nullable(types.string()), supportedModels: types.nullable( z.array(z.lazy(() => ProviderConfigSupportedModel$inboundSchema)), ), apiVersion: types.nullable(types.string()), metadata: types.nullable(z.record(z.string(), z.any())), createdBy: types.nullable(types.string()), createdAt: types.date(), updatedAt: types.date(), }); export function providerConfigFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ProviderConfig$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProviderConfig' from JSON`, ); }