SDKs & libraries
xAI APIs are plain JSON REST, so they work with any language via your existing HTTP client. Official SDKs are on the roadmap; below are lightweight clients to start right away.
SDK status
Official SDKs for JavaScript/TypeScript and Python are in development. Watch the changelog for updates.
JavaScript / TypeScript
Runs in the browser or Node/Workers. Use credentials: "include" to send the SSO cookie.
// xAI ecosystem — client gọn nhẹ bằng fetch (chưa cần SDK chính thức)
const XAI = {
base: {
identity: 'https://identity.xai.io.vn',
governance: 'https://governance.xai.io.vn',
blockchain: 'https://blockchain.xai.io.vn',
},
async session() {
const r = await fetch(this.base.identity + '/api/session', { credentials: 'include' });
return r.json();
},
async anchor(payload) {
const r = await fetch(this.base.blockchain + '/api/anchor', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
return r.json();
},
};
const session = await XAI.session(); Python
Use a requests.Session to persist the session cookie across calls.
import requests
BASE = {
"identity": "https://identity.xai.io.vn",
"governance": "https://governance.xai.io.vn",
"blockchain": "https://blockchain.xai.io.vn",
}
def anchor(payload: dict, session: requests.Session) -> dict:
r = session.post(f"{BASE['blockchain']}/api/anchor", json=payload)
r.raise_for_status()
return r.json()
s = requests.Session()
result = anchor({
"scenario": "e_invoice",
"payloadId": "INV-2026-001",
"dataFields": {"taxId": "0312345678", "amount": 500_000_000},
}, s) cURL
Every endpoint can be tried quickly with cURL — see examples on each API reference page.