Learn how to integrate XTap AI API into your applications
Get started with XTap AI API in minutes. Our API is fully compatible with OpenAI's interface.
Sign in and generate your API key from the settings page.
Install the OpenAI SDK or use our compatible endpoints.
pip install openaiStart making requests with your preferred model.
All API requests require authentication using your API key.
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYKeep your API keys secure and never expose them in client-side code.
Generate conversational responses using various AI models.
POST https://api.xtap.com.au/v1/chat/completionsmodelID of the model to usemessagesArray of message objectstemperatureSampling temperature (0-2)max_tokensMaximum tokens to generatestreamEnable streaming responsesimport OpenAI from 'openai';
// OpenAI 风格 Base URL
const client = new OpenAI({
baseURL: 'https://api.xtap.com.au/v1',
apiKey: process.env.API_KEY,
});
// OpenRouter 风格也同样支持:
// baseURL: 'https://api.xtap.com.au/api/v1'
const response = await client.chat.completions.create({
model: 'gpt-4',
messages: [
{ role: 'user', content: 'Hello!' }
],
});
console.log(response.choices[0].message.content);from openai import OpenAI
# OpenAI 风格 Base URL
client = OpenAI(
base_url="https://api.xtap.com.au/v1",
api_key="YOUR_API_KEY"
)
# OpenRouter 风格也同样支持:
# base_url="https://api.xtap.com.au/api/v1"
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)Access hundreds of AI models through a single API.
GET https://api.xtap.com.au/v1/modelsLatest and most capable models from major providers
Optimized for code generation and technical tasks
Advanced reasoning and complex problem-solving
Support for images, audio, and video inputs
Stream responses in real-time for better user experience.
const stream = await client.chat.completions.create({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Tell me a story' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}Generate videos from text prompts or reference images. Video models support two calling styles: a synchronous convenience endpoint that blocks until the video is ready, and an asynchronous submit + poll flow.
The request blocks until generation finishes and returns the video URL directly. Generation usually takes 1–4 minutes — set your client timeout to at least 600 seconds.
POST https://api.xtap.com.au/v1/videos/generationscurl https://api.xtap.com.au/v1/videos/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "earth/seedance-2.0",
"prompt": "A calico cat stretching on a sunny windowsill, cinematic close-up",
"duration": 4,
"resolution": "720p"
}'
# → {"created": 1753776000, "data": [{"url": "https://...mp4"}]}Submit a job and get a job object back immediately, then poll the job until it reaches a terminal status. Recommended for production workloads — no long-lived connection required.
POST https://api.xtap.com.au/v1/videos
GET https://api.xtap.com.au/v1/videos/{id}curl https://api.xtap.com.au/v1/videos \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"model": "earth/seedance-2.0",
"prompt": "A calico cat stretching on a sunny windowsill, cinematic close-up",
"duration": 4,
"resolution": "720p"
}'
# → {"id": "<job_id>", "object": "video.generation",
# "model": "earth/seedance-2.0", "status": "queued", "created_at": 1753776000}Poll every 5–10 seconds until the status is completed or failed.
curl https://api.xtap.com.au/v1/videos/<job_id> \
-H "Authorization: Bearer YOUR_API_KEY"
# in_progress → {"status": "in_progress", ...}
# completed → {"status": "completed", "url": "https://...mp4", "seconds": 4}
# failed → {"status": "failed", "error": {"code": "...", "message": "..."}}import requests, time
API = "https://api.xtap.com.au"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
# 1. Submit / 提交任务
job = requests.post(f"{API}/v1/videos", headers=headers, json={
"model": "earth/seedance-2.0",
"prompt": "A calico cat stretching on a sunny windowsill, cinematic close-up",
"duration": 4,
"resolution": "720p",
}, timeout=30).json()
# 2. Poll until terminal status / 轮询直到终态
while job["status"] in ("queued", "in_progress"):
time.sleep(5)
job = requests.get(f"{API}/v1/videos/{job['id']}", headers=headers, timeout=30).json()
if job["status"] == "completed":
print(job["url"]) # MP4 URL, valid 24h / 有效期 24 小时
else:
print("failed:", job.get("error"))queuedThe job has been accepted and is waiting to start.in_progressThe video is being generated.completedDone — the response contains the video url (MP4) and seconds (duration).failedGeneration failed — the response contains an error object with code and message.XTap AI fully supports Anthropic's native /v1/messages API format. You can use the official Anthropic SDK directly, with support for streaming and Prompt Cache.
Set the Anthropic SDK's base_url to the following address, using your XTap AI API Key:
Base URL: https://api.xtap.com.auimport anthropic
client = anthropic.Anthropic(
base_url="https://api.xtap.com.au",
api_key="YOUR_API_KEY",
)
message = client.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
messages=[
{"role": "user", "content": "Hello, Claude!"}
]
)
print(message.content[0].text)import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
baseURL: 'https://api.xtap.com.au',
apiKey: 'YOUR_API_KEY',
});
const message = await client.messages.create({
model: 'claude-opus-4-6',
max_tokens: 1024,
messages: [
{ role: 'user', content: 'Hello, Claude!' }
],
});
console.log(message.content[0].text);Use the Anthropic SDK's stream method for streaming output:
with client.messages.stream(
model="claude-opus-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Tell me a story"}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)Enable prompt caching with the cache_control parameter to reduce repeated token costs:
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
system=[{
"type": "text",
"text": "You are a helpful assistant...(long system prompt)...",
"cache_control": {"type": "ephemeral"}
}],
messages=[
{"role": "user", "content": "Hello!"}
]
)
# Check cache usage
print(f"Cache read: {message.usage.cache_read_input_tokens}")
print(f"Cache creation: {message.usage.cache_creation_input_tokens}")Call the API directly using HTTP:
curl https://api.xtap.com.au/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-6",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'The following Claude models are currently available via the native API format:
claude-opus-4-6claude-sonnet-4-6claude-haiku-4-5Understand and handle API errors effectively.
401401 Unauthorized - Invalid API key429429 Too Many Requests - Rate limit exceeded500500 Internal Server Error - Service error503503 Service Unavailable - Temporary outageTransparent pricing based on actual usage.
| Model | Input Price | Output Price |
|---|---|---|
| GPT-4 | $5.00 | $15.00 |
| GPT-3.5 Turbo | $0.50 | $1.50 |
| Claude 3 Opus | $15.00 | $75.00 |
per 1M tokens
Pay-as-you-go pricing with no subscription required.
Track your usage and costs in real-time from the dashboard.
Official and community-maintained SDKs for popular languages.
Use the official OpenAI Python library
pip install openaiUse the official OpenAI Node.js library
npm install openaiAPI usage limits to ensure fair access and service stability.
| Tier | Requests | Tokens |
|---|---|---|
| Free | 100 req/day | 100K tokens/day |
| Pro | 10,000 req/day | 10M tokens/day |
Rate limit information is included in response headers:
X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9999
X-RateLimit-Reset: 1640995200Join our Discord community for help and discussions
Contact our team at info@tigerman.com.au
Check real-time API status and uptime
Stay updated with latest features and improvements