@ai-sdk/luma
Version:
The **Luma provider** for the [AI SDK](https://ai-sdk.dev/docs) contains support for Luma AI's state-of-the-art image generation models - Photon and Photon Flash.
77 lines (71 loc) • 2.52 kB
TypeScript
import { ProviderV3, ImageModelV3 } from '@ai-sdk/provider';
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
import { z } from 'zod/v4';
type LumaImageModelId = 'photon-1' | 'photon-flash-1' | (string & {});
interface LumaProviderSettings {
/**
Luma API key. Default value is taken from the `LUMA_API_KEY` environment
variable.
*/
apiKey?: string;
/**
Base URL for the API calls.
*/
baseURL?: string;
/**
Custom headers to include in the requests.
*/
headers?: Record<string, string>;
/**
Custom fetch implementation. You can use it as a middleware to intercept requests,
or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
}
interface LumaProvider extends ProviderV3 {
/**
Creates a model for image generation.
*/
image(modelId: LumaImageModelId): ImageModelV3;
/**
Creates a model for image generation.
*/
imageModel(modelId: LumaImageModelId): ImageModelV3;
/**
* @deprecated Use `embeddingModel` instead.
*/
textEmbeddingModel(modelId: string): never;
}
declare function createLuma(options?: LumaProviderSettings): LumaProvider;
declare const luma: LumaProvider;
declare const lumaErrorSchema: z.ZodObject<{
detail: z.ZodArray<z.ZodObject<{
type: z.ZodString;
loc: z.ZodArray<z.ZodString>;
msg: z.ZodString;
input: z.ZodString;
ctx: z.ZodOptional<z.ZodNullable<z.ZodObject<{
expected: z.ZodString;
}, z.core.$strip>>>;
}, z.core.$strip>>;
}, z.core.$strip>;
type LumaErrorData = z.infer<typeof lumaErrorSchema>;
/**
* Provider options schema for Luma image generation.
*
* @see https://docs.lumalabs.ai/docs/image-generation
*/
declare const lumaImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
[x: string]: unknown;
referenceType?: "image" | "style" | "character" | "modify_image" | null | undefined;
images?: {
weight?: number | null | undefined;
id?: string | null | undefined;
}[] | null | undefined;
pollIntervalMillis?: number | null | undefined;
maxPollAttempts?: number | null | undefined;
}>;
type LumaImageProviderOptions = InferSchema<typeof lumaImageProviderOptionsSchema>;
declare const VERSION: string;
export { type LumaErrorData, type LumaImageProviderOptions, type LumaProvider, type LumaProviderSettings, VERSION, createLuma, luma };