Skip to content
Quickstart

Quickstart

picsart.com • November 26, 2026

Create a client once, then call any model. Media models return URLs; text models return strings.

Install the SDK TypeScript needs Node.js 20 or newer; Python needs 3.10 or newer. Create an API key (see Authentication ) and keep it in the PICSART_API_KEY environment variable. npm install @picsart/ai-sdk

TypeScript needs Node.js 20 or newer; Python needs 3.10 or newer. Create an API key (see Authentication ) and keep it in the PICSART_API_KEY environment variable.

Generate an image { createClient } '@picsart/ai-sdk' ; ai = createClient ( { apiKey : process . env . PICSART_API_KEY , apiUrl : ' , } ) ; result = ai . generate ( 'flux-2-pro' , { prompt : 'A serene mountain lake at golden hour, ultra detailed' , aspectRatio : '16:9' , } ) ; console . log ( result . url ) ; console . log ( result . items ) ;

Generate text LLM/text models use generateText() — generate_text() in Python — which returns the generated text plus the raw response. { text } = ai . generateText ( 'claude-opus-4-8' , { prompt : 'Summarize the theory of relativity in two sentences.' , } ) ; console . log ( text ) ;

LLM/text models use generateText() — generate_text() in Python — which returns the generated text plus the raw response.

Handle long-running jobs generate() waits for the result. For slower media (video), use submit() + result() so you control polling. generationId = ai . submit ( 'kling-v3' , { prompt : 'A drone shot flying over a canyon at sunrise' , duration : 5 , } ) ; result = ai . result ( 'kling-v3' , generationId ) ; console . log ( result . url ) ;

Handle long-running jobs

generate() waits for the result. For slower media (video), use submit() + result() so you control polling.

Extracted Entities

Platforms (1)

Tools (1)