studio-stock-sdk
v1.0.0
Published
Official TypeScript SDK for Studio Stock API - AI-powered image search platform
Maintainers
Readme
Studio Stock SDK
Official TypeScript/JavaScript SDK for the Studio Stock API - AI-powered image search platform with Japanese content focus.
Installation
npm install studio-stock-sdk
# or
yarn add studio-stock-sdk
# or
bun add studio-stock-sdkQuick Start
import { StudioStockClient } from 'studio-stock-sdk';
// Initialize the client
const client = new StudioStockClient({
apiKey: 'your-api-key-here'
});
// Search for images
const results = await client.search('桜', {
per_page: 10,
sort: 'newest'
});
console.log(`Found ${results.total} images`);
results.images.forEach(image => {
console.log(`${image.title}: ${image.url}`);
});Authentication
Get your API key from the Studio Stock Dashboard.
const client = new StudioStockClient({
apiKey: 'sk_live_...', // Your API key
baseURL: 'https://api.stock.studio.design/v1', // Optional: custom base URL
timeout: 10000 // Optional: request timeout in ms
});Usage Examples
Text Search
Search with Japanese or English queries:
// Japanese search
const cherryBlossoms = await client.search('桜');
// English search
const mountains = await client.search('mountain landscape');
// With options
const results = await client.search('春の花', {
page: 1,
per_page: 20,
sort: 'newest'
});Color-based Search
Find images by dominant color:
// Search by hex color
const pinkImages = await client.searchByColor('FFB6C1');
// Search with pagination
const blueImages = await client.searchByColor('#87CEEB', {
page: 2,
per_page: 15
});Similar Image Search
Find images similar to a specific image:
const similar = await client.findSimilar('img_123456789', {
per_page: 10
});Get Image Details
Retrieve detailed information about a specific image:
const image = await client.getImage('img_123456789');
console.log({
title: image.title,
tags: image.tags,
colors: image.colors,
dimensions: `${image.width}x${image.height}`
});Random Images
Get DailyPicks images from the collection:
// Get 5 random images
const dailyPicks = await client.getDailyPicks(5);
// Get 10 random images (default)
const moreRandom = await client.getDailyPicks();Low-level API Usage
For more control, you can use the generated API functions directly:
import { setConfig, v1SearchGet } from 'studio-stock-sdk';
// Configure once
setConfig({ apiKey: 'your-api-key' });
// Use generated functions directly
const response = await v1SearchGet({
q: '猫',
page: 1,
per_page: 5
});Response Types
SearchResponse
interface SearchResponse {
images: Image[];
total: number;
page: number;
per_page: number;
total_pages: number;
}Image
interface Image {
id: string;
url?: string; // Original image URL
transparent_url?: string; // Background-removed version
title: string;
prompt: string; // AI generation prompt
tags: string[]; // Image tags
colors: string[]; // Dominant colors (hex)
width?: number; // Image width
height?: number; // Image height
created_at?: string; // ISO timestamp
}Support
License
MIT
