AnalogAI SDK (minimal)
Tiny Python client for the Deepthink OpenAI-compatible chat server
(analogai.deepthink.chat). It calls POST {CHAT_BASE_URL}/v1/chat/completions
— a stateful endpoint: memory tenancy is keyed by user_id + agent_id
(both created server-side on first use), Deepthink memory is retrieved per
turn, and messages are ingested in the background.
The return types follow the OpenAI Python SDK schema exactly, so migrating a script is a one-line client swap:
completion = client.generate_completion("hi")
print(completion.choices[0].message.content)
print(completion.usage.prompt_tokens, completion.usage.completion_tokens)
Install
pip install analogaisdk
Setup
Set environment variables in .env:
CHAT_BASE_URL(defaulthttps://cloud.analogai.net:8010; set tohttp://localhost:8010for a local server)ANALOGAI_API_KEY(optional, if your server requires auth)ANALOGAI_MODEL(optional; server default is used when omitted)
Non-streaming
Returns a ChatCompletion matching the OpenAI response shape.
from analogaisdk import AnalogAIClient
client = AnalogAIClient(agent_id="my-agent", user_id="my-user")
completion = client.generate_completion("are humans mortal?")
print(completion.choices[0].message.content)
print("prompt_tokens =", completion.usage.prompt_tokens)
print("completion_tokens=", completion.usage.completion_tokens)
print("total_tokens =", completion.usage.total_tokens)
Streaming
Yields ChatCompletionChunk objects. The final chunk carries usage
with token counts (the SDK sends stream_options={"include_usage": true}
automatically).
for chunk in client.generate_streaming_completion("are humans mortal?"):
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
if chunk.usage is not None:
print()
print(chunk.usage.prompt_tokens, chunk.usage.completion_tokens)
Working memory
Working memory (a string or list of strings) is appended to the LLM system prompt alongside the Deepthink memory:
client.generate_completion(
"is Socrates mortal?",
working_memory=["Socrates is a human"],
)
Explicit messages and model
client.generate_completion(
messages=[
{"role": "user", "content": "Say hello"},
],
model="azure:gpt-5.4-mini", # optional, provider-prefixed
temperature=0.2,
)
Response schema
ChatCompletion.id / object / created / modelChatCompletion.choices[i].index / .finish_reasonChatCompletion.choices[i].message.role / .content / .tool_callsChatCompletion.usage.prompt_tokens / .completion_tokens / .total_tokensChatCompletion.raw— the parsed JSON body from the server, unchanged
For streaming:
ChatCompletionChunk.choices[i].delta.role / .content / .tool_callsChatCompletionChunk.choices[i].finish_reasonChatCompletionChunk.usage—Noneon intermediate chunks, populated on the final chunk when the server honoursstream_options.include_usage.
Metadata
Release files for analogaisdk 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| analogaisdk-0.7.0.tar.gz | 6.0 kB | Without provenance | Details for analogaisdk-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| analogaisdk-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for analogaisdk-0.7.0-py3-none-any.whl |
Total release size: 13.5 kB
Release files / analogaisdk-0.7.0.tar.gz
| Download URL | analogaisdk-0.7.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
25d4337a45d7b935d35d24044fe311e99c6b2a88699ef613a955aafb70305e48
|
|
BLAKE2b-256 checksum How to use checksums |
19220fe93dd14a123da87adfca6faf711b9a7304bc2fecf3ed7510001784675b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.5 Darwin/23.3.0
|
Release files / analogaisdk-0.7.0-py3-none-any.whl
| Download URL | analogaisdk-0.7.0-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ddcbe029dd4b8562e31c43a6487951b37fb92c6032956ca79a37dd117d80eb85
|
|
BLAKE2b-256 checksum How to use checksums |
47d99f066bf7476c64949241ac153eaeefe18abe769b69582ef2c8baa3999fcc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.5 Darwin/23.3.0
|
Security for analogaisdk 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.