SDKs & Libraries
Official and community SDKs for the AI Magicx API
SDKs & Libraries
Use our SDKs and compatible libraries to integrate AI Magicx into your applications.
Python
Official Python client for AI Magicx API
TypeScript
TypeScript/JavaScript client
OpenAI Compatibility
Use the OpenAI SDK with AI Magicx
Quick Comparison
| Feature | Direct API | OpenAI SDK |
|---|---|---|
| Chat completions | Full support | Full support |
| Streaming | Full support | Full support |
| Image generation | Full support | Partial |
| Video/Audio/Music | Full support | Not available |
| AI Agents | Full support | Not available |
For chat completions, we recommend using the OpenAI SDK for the best developer experience. For AI Agents, image editing, video, audio, and music generation, use our REST API directly.
Installation
Using pip (Python)
pip install openai requestsUsing npm (TypeScript/JavaScript)
npm install openai
# or
pnpm add openaiQuick Examples
Chat Completions
from openai import OpenAI
client = OpenAI(
api_key="sk_your_api_key",
base_url="https://www.aimagicx.com/api/v1"
)
response = client.chat.completions.create(
model="openai/gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}]
)AI Agents
import requests
import json
headers = {"Authorization": "Bearer sk_your_api_key"}
# Create an agent
agent = requests.post(
"https://www.aimagicx.com/api/v1/agents",
headers=headers,
json={
"name": "Research Assistant",
"system_prompt": "You help with research tasks.",
"tools": ["web_search", "web_fetch"]
}
).json()["agent"]
# Run with streaming
response = requests.post(
f"https://www.aimagicx.com/api/v1/agents/{agent['id']}/run",
headers=headers,
json={"input": "What's the latest in AI?"},
stream=True
)
for line in response.iter_lines():
if line and line.startswith(b'data: '):
event = json.loads(line[6:])
print(event)Community SDKs
We welcome community contributions! If you've built an SDK or wrapper for AI Magicx, let us know and we'll feature it here.