简体中文 | English || Python Version
This is an API proxy service for AkashGen's image generation capabilities. It allows you to easily integrate AkashGen's image generation into your applications through a simple API interface.
- Generate images using AkashGen AI
- REST API compatible with OpenAI-like interface
- Authentication via Bearer token
- Image retrieval through dedicated endpoints
- Deployable to Vercel, Cloudflare Workers, or Docker
Create a .env
file based on the .env.example
and set the following variables:
API_KEY
: Your secret API key for authenticationSESSION_TOKEN
: Your AkashGen session tokenAPI_PREFIX
: API route prefix (default:/
)PORT
: Server port (default: 3000)
- Clone this repository
- Set up the environment variables in Vercel
- Deploy to Vercel
- Set your account details in
wrangler.toml
- Run
wrangler publish
# Using docker-compose
docker-compose up -d
# Or build and run manually
docker build -t akashgen-proxy .
docker run -p 3000:3000 --env-file .env akashgen-proxy
All API requests must include an Authorization
header with a bearer token:
Authorization: Bearer your-api-key
POST /v1/chat/completions
Request body:
{
"messages": [
{
"role": "user",
"content": "Generate a beautiful landscape with mountains"
}
],
"model": "AkashGen"
}
Response:
{
"id": "job-id",
"model": "AkashGen",
"response": "<image_generation> jobId='job-id' prompt='...' negative='...'</image_generation>\n[job-id](https://your-domain.com/images?id=job-id)"
}
GET /images?id=job-id
Returns the generated image as a WebP image.
GET /
Returns "API service is running"
GET /ping
Returns "pong"