SDKs
Official client libraries for 7 languages. All SDKs provide a consistent interface for authentication, streaming, pagination, and error handling.
Supported Languages
Python
PyPI ↗pip install ensoulTypeScript
npm ↗npm install @ensoul-ai/sdkKotlin
GitHub ↗ai.ensoul:ensoul-sdkSwift
GitHub ↗Swift Package ManagerUnity / C#
GitHub ↗Unity Package Manager (Git URL)C++
GitHub ↗CMake FetchContentGodot / GDScript
GitHub ↗Plugin (addons/ensoul/)Installation
pip install ensoulPython requires 3.11 or newer
pip install ensoul fails with no compatible version. Check your version with python --version and upgrade if needed.Quick Example
All SDKs follow the same pattern: create a client, call resources.
Health Check
from ensoul import Ensoul
client = Ensoul() # reads ENSOUL_API_KEY from env
health = client.health.check()
print(f"API status: {health}")Hello World
Create a persona with no world, send it one message as one of your end users, and end the conversation.
# pip install ensoul
from ensoul import Ensoul
client = Ensoul(api_key="YOUR_API_KEY")
# A persona needs no world. This one stands alone.
persona = client.personas.create(name="Ada")
# user_id is your own id for the person talking.
# Each end user gets their own conversations with the persona.
reply = client.chat.send(
persona.id,
"Hi! Who are you?",
user_id="YOUR_END_USER_ID",
)
print(reply.response)
# End the conversation when the person is done.
client.chat.end_conversation(
persona.id,
reply.conversation_id,
user_id="YOUR_END_USER_ID",
)Features
End Users
Talk to a persona on behalf of your own end users. Each gets their own conversations. End a conversation when the person is done, and forget an end user with a team key.
Auto-Pagination
Iterate through large result sets automatically. All list endpoints return paginated results that the SDK handles for you.
Streaming Support
Real-time streaming for chat, asking a world, and simulations via Server-Sent Events.
Automatic Retries
Transient failures are retried with exponential backoff and jitter. Rate-limit headers are respected automatically.
Dual Authentication
Authenticate with API keys for server-to-server use, or OAuth tokens for user-facing applications.
Environment Variables
All SDKs read these environment variables as defaults when no explicit value is passed to the client constructor.
| Variable | Purpose | Default |
|---|---|---|
ENSOUL_API_KEY | API key for authentication | (none) |
ENSOUL_BASE_URL | API base URL | https://api.ensoul-ai.com |