@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.
54 lines (49 loc) • 1.62 kB
TypeScript
import { ProviderV2, ImageModelV2 } from '@ai-sdk/provider';
import { FetchFunction } 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 ProviderV2 {
/**
Creates a model for image generation.
*/
image(modelId: LumaImageModelId): ImageModelV2;
/**
Creates a model for image generation.
*/
imageModel(modelId: LumaImageModelId): ImageModelV2;
}
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>;
export { type LumaErrorData, type LumaProvider, type LumaProviderSettings, createLuma, luma };