Official SDKs
Official SDKs are coming soon! In the meantime, use the REST API directly.
JavaScript/TypeScript (Coming Soon)
npm install @unleeshed/sdk
import { UnleeshedClient } from '@unleeshed/sdk';
const client = new UnleeshedClient({
apiKey: process.env.UNLEESHED_API_KEY
});
const personas = await client.personas.list();
const topic = await client.topics.create({
content: 'Should the Lakers trade AD?',
personaIds: personas.map(p => p.id)
});
const result = await client.topics.waitForCommentaries(topic.topicId);
Python (Coming Soon)
from unleeshed import UnleeshedClient
client = UnleeshedClient(api_key=os.environ["UNLEESHED_API_KEY"])
personas = client.personas.list()
topic = client.topics.create(
content="Should the Lakers trade AD?",
persona_ids=[p.id for p in personas]
)
result = client.topics.wait_for_commentaries(topic.topic_id)
REST API Client Example
Until official SDKs are available, here’s a simple client implementation:
class UnleeshedClient {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://api.unleeshed.ai/partner/v1';
}
async request(path, options = {}) {
const response = await fetch(`${this.baseUrl}${path}`, {
...options,
headers: {
'X-Api-Key': this.apiKey,
'Content-Type': 'application/json',
...options.headers
}
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.error?.message || 'Request failed');
}
return data;
}
async getPersonas() {
return this.request('/personas');
}
async createTopic(content, personaIds, outputTypes = ['text']) {
return this.request('/topics', {
method: 'POST',
body: JSON.stringify({
content,
persona_ids: personaIds,
output_types: outputTypes
})
});
}
async getTopic(topicId) {
return this.request(`/topics/${topicId}`);
}
async getCommentaries(topicId) {
return this.request(`/topics/${topicId}/commentaries`);
}
}
OpenAPI Specification
Generate your own client from our OpenAPI spec:
# Download the spec
curl https://api.unleeshed.ai/openapi.json -o openapi.json
# Generate TypeScript client
npx openapi-generator-cli generate \
-i openapi.json \
-g typescript-fetch \
-o ./unleeshed-client
# Generate Python client
openapi-generator-cli generate \
-i openapi.json \
-g python \
-o ./unleeshed-client
Have you built an SDK? Let us know and we’ll list it here!