DevelopersAPI Docs

Quick Start

Welcome to the XiHe AI API! This guide will help you get started and begin using our AI creative capabilities in minutes.

1. Get API Key

First, create an API Key in the console:

2. Install SDK

Install the SDK using your preferred package manager:

npm install @xihe/sdk

3. Make Your First Request

Use the following code to generate your first AI image:

import { XiheClient } from '@xihe/sdk';

const client = new XiheClient({
  apiKey: process.env.XIHE_API_KEY
});

const image = await client.images.generate({
  prompt: 'A cute cat in watercolor style',
  model: 'xihe-xl',
  size: '1024x1024'
});

console.log(image.url);

Authentication

All API requests require Bearer Token authentication. Add your API Key to the request header:

Authorization: Bearer YOUR_API_KEY

API Endpoints

Here are the available API endpoints:

POST/v1/images/generate
Generate new images
POST/v1/images/edit
Edit existing images
POST/v1/stories/generate
Generate story content
POST/v1/agents/chat
Chat with Agent

Rate Limits

The API has the following rate limits:

PlanRequests per minuteRequests per day
Free201,000
Pro10010,000
EnterpriseUnlimitedUnlimited

Need Help?

Check out more code examples, or contact our developer support team