Overview
The xPilot v1 API provides programmatic access to AI-powered video, image, and text generation. All endpoints require a valid API key and use credit-based billing.
https://xpilot.jytech.us/api/v1Authorization: Bearer xp_...Authentication
Create an API key from Settings > API Keys. Include it in the Authorization header of every request:
bashcurl -H "Authorization: Bearer xp_your_api_key_here" \
https://xpilot.jytech.us/api/v1/modelsList Models
/api/v1/modelsReturns all available models grouped by type (text, video, image) with pricing information.
bashcurl -H "Authorization: Bearer xp_..." \
https://xpilot.jytech.us/api/v1/modelsResponse:
json{
"models": {
"text": [
{ "id": "openai/gpt-4o", "label": "GPT-4o", "type": "text" }
],
"video": [
{
"id": "seedance-2.0/text-to-video",
"label": "Seedance 2.0",
"tier": "premium",
"supports_audio": true,
"supports_lock_camera": true,
"durations": [4, 8, 12],
"cost_cents_per_5s": 300,
"type": "video",
"mode": "text-to-video",
"provider": "seedance"
}
],
"image": [
{ "id": "bytedance/seedream-4.5", "label": "Seedream 4.5", "type": "image" }
]
}
}Generate Video
/api/v1/video/generateSubmit an async video generation task. Poll the returned poll_url for progress.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model ID (e.g. "seedance-2.0/text-to-video") |
prompt | string | Required | Description of the video to generate |
duration | number | Optional | Duration in seconds (default 5, Seedance supports 4/8/12) |
aspect_ratio | string | Optional | "16:9", "9:16", "1:1" etc. (default "16:9") |
image_url | string | Optional | Source image URL for image-to-video models |
generate_audio | boolean | Optional | Generate synchronized audio (Seedance 2.0, Wan 2.6) |
lock_camera | boolean | Optional | Lock camera position (Seedance 2.0 only) |
Example:
bashcurl -X POST https://xpilot.jytech.us/api/v1/video/generate \
-H "Authorization: Bearer xp_..." \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.0/text-to-video",
"prompt": "A cat walking on a beach at sunset",
"duration": 8,
"aspect_ratio": "16:9",
"generate_audio": true,
"lock_camera": false
}'Response:
json{
"task_id": "abc123",
"status": "processing",
"provider": "seedance",
"poll_url": "/api/v1/video/abc123?provider=seedance",
"cost_cents": 300,
"remaining_credits_cents": 4700
}Poll Video Status
/api/v1/video/:taskIdCheck the status of a video generation task. Use the poll_url returned from the generate endpoint. Poll every 3-5 seconds until status is "completed" or "failed".
| Parameter | Type | Required | Description |
|---|---|---|---|
provider | string | Optional | "wavespeed" or "seedance" (query param, default "wavespeed") |
pollUrl | string | Optional | Wavespeed poll URL (query param, auto-included in poll_url) |
bash# Use the poll_url from the generate response
curl -H "Authorization: Bearer xp_..." \
"https://xpilot.jytech.us/api/v1/video/abc123?provider=seedance"Response (processing):
json{
"task_id": "abc123",
"status": "processing",
"outputs": [],
"provider": "seedance"
}Response (completed):
json{
"task_id": "abc123",
"status": "completed",
"outputs": ["https://cdn.example.com/video.mp4"],
"provider": "seedance"
}Generate Image
/api/v1/image/generateGenerate an image. Some models return results synchronously; others return a poll_url.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Required | Model ID (e.g. "bytedance/seedream-4.5") |
prompt | string | Required | Image description |
aspect_ratio | string | Optional | "1:1", "16:9", "9:16" etc. |
mode | string | Optional | "t2i" (text-to-image), "i2i" (image-to-image), "i2i_text" (edit text in image) |
image_url | string | Optional | Source image for i2i/editing modes |
image_urls | string[] | Optional | Multiple source images (multi-reference models) |
bashcurl -X POST https://xpilot.jytech.us/api/v1/image/generate \
-H "Authorization: Bearer xp_..." \
-H "Content-Type: application/json" \
-d '{
"model": "bytedance/seedream-4.5",
"prompt": "A futuristic cityscape at dawn",
"aspect_ratio": "16:9"
}'Response (sync):
json{
"task_id": "img_456",
"status": "completed",
"outputs": ["https://cdn.example.com/image.png"],
"cost_cents": 5,
"remaining_credits_cents": 4695
}Generate Text
/api/v1/text/generateGenerate text using a large language model. Returns result synchronously.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Optional | Model ID (default "openai/gpt-4o") |
prompt | string | Required | The prompt / question |
system | string | Optional | System prompt to set behavior |
max_tokens | number | Optional | Max output tokens (default 1000) |
temperature | number | Optional | Sampling temperature 0-2 (default 0.7) |
bashcurl -X POST https://xpilot.jytech.us/api/v1/text/generate \
-H "Authorization: Bearer xp_..." \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-4o",
"prompt": "Write a tweet about AI video generation",
"max_tokens": 280
}'Response:
json{
"content": "AI video generation just hit a new level...",
"model": "openai/gpt-4o",
"usage": {
"prompt_tokens": 15,
"completion_tokens": 42,
"total_tokens": 57
},
"cost_cents": 1,
"remaining_credits_cents": 4694
}Error Handling
All errors return a JSON object with an error field:
json{
"error": {
"message": "Invalid or missing API key",
"code": "UNAUTHORIZED"
}
}| HTTP | Code | Description |
|---|---|---|
| 400 | INVALID_PARAMS | Missing or invalid request parameters |
| 400 | INVALID_MODEL | Model ID not found |
| 401 | UNAUTHORIZED | Missing, invalid, or revoked API key |
| 402 | INSUFFICIENT_CREDITS | Not enough credits for this operation |
| 429 | RATE_LIMITED | Rate limit exceeded (30 req/min). Check Retry-After header. |
| 500 | GENERATION_FAILED | Generation failed upstream |
Full Example: Generate & Download Video
bash#!/bin/bash
API_KEY="xp_your_key_here"
HOST="https://xpilot.jytech.us"
# 1. Submit video generation
RESULT=$(curl -s -X POST "$HOST/api/v1/video/generate" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.0/text-to-video",
"prompt": "A golden retriever running through a meadow",
"duration": 8,
"generate_audio": true
}')
POLL_PATH=$(echo $RESULT | jq -r '.poll_url')
echo "Task submitted. Poll path: $POLL_PATH"
# 2. Poll until complete
while true; do
STATUS=$(curl -s -H "Authorization: Bearer $API_KEY" "$HOST$POLL_PATH")
STATE=$(echo $STATUS | jq -r '.status')
echo "Status: $STATE"
if [ "$STATE" = "completed" ]; then
VIDEO_URL=$(echo $STATUS | jq -r '.outputs[0]')
echo "Video ready: $VIDEO_URL"
curl -o output.mp4 "$VIDEO_URL"
break
elif [ "$STATE" = "failed" ]; then
echo "Error: $(echo $STATUS | jq -r '.error')"
break
fi
sleep 5
donePython Example
pythonimport requests, time
API_KEY = "xp_your_key_here"
HOST = "https://xpilot.jytech.us"
HEADERS = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
# Submit
resp = requests.post(f"{HOST}/api/v1/video/generate", headers=HEADERS, json={
"model": "seedance-2.0/text-to-video",
"prompt": "A cat walking on a beach at sunset",
"duration": 8,
"generate_audio": True,
})
data = resp.json()
poll_path = data["poll_url"]
print(f"Cost: {data['cost_cents']} cents | Credits left: {data['remaining_credits_cents']}")
# Poll
while True:
status = requests.get(f"{HOST}{poll_path}", headers=HEADERS).json()
print(f"Status: {status['status']}")
if status["status"] == "completed":
print(f"Video URL: {status['outputs'][0]}")
break
elif status["status"] == "failed":
print(f"Error: {status.get('error')}")
break
time.sleep(5)