python client to interact with Aleph Alpha api endpoints
Project Links
Meta
Author: Aleph Alpha
Requires Python: <3.14,>=3.10
Classifiers
Aleph Alpha Client
Python client for the Aleph Alpha API.
Usage
Synchronous Client
import os
from aleph_alpha_client import Client, CompletionRequest, Prompt
client = Client(
token=os.environ["TEST_TOKEN"],
host=os.environ["TEST_API_URL"],
)
request = CompletionRequest(
prompt=Prompt.from_text("Provide a short description of AI:"),
maximum_tokens=64,
)
response = client.complete(request, model="pharia-1-llm-7b-control")
print(response.completions[0].completion)
Asynchronous Client
import os
from aleph_alpha_client import AsyncClient, CompletionRequest, Prompt
# Can enter context manager within an async function
async with AsyncClient(
token=os.environ["TEST_TOKEN"],
host=os.environ["TEST_API_URL"],
) as client:
request = CompletionRequest(
prompt=Prompt.from_text("Provide a short description of AI:"),
maximum_tokens=64,
)
response = client.complete_with_streaming(request, model="pharia-1-llm-7b-control")
async for stream_item in response:
print(stream_item)
Interactive Examples
This table contains interactive code examples, further exercises can be found in the examples repository.
| Template | Description | Internal Link | Colab Link |
|---|---|---|---|
| 1 | Calling the API | Template 1 | |
| 2 | Simple completion | Template 2 | |
| 3 | Simple search | Template 3 | |
| 4 | Symmetric and Asymmetric Search | Template 4 | |
| 5 | Hidden Embeddings | Template 5 | |
| 6 | Task-specific Endpoints | Template 6 |
Installation
The latest stable version is deployed to PyPi so you can install this package via pip/uv:
uv add aleph-alpha-client
Get started using the client by first creating an account. Afterwards head over to your profile to create an API token. Read more about how you can manage your API tokens here.
Development
For local development, install the dependencies:
uv sync
Now you should be able to ...
- run all the tests using
uv run pytestor,uv run pytest -k <test_name>to run a specific test - typecheck the code and tests using
uv run mypy aleph_alpha_clientresp.uv run mypy tests - format the code using
uv run ruff
Releasing a new version
- Bump the version in
pyproject.toml. - Edit
Changelog.md. - Push and merge.
- Go to https://github.com/Aleph-Alpha/aleph-alpha-client/releases/new
- use the version as tag and release title (e.g.
v10.1.0) - auto-generate the description based on commit history
- use the version as tag and release title (e.g.
Links
11.5.1
Jan 30, 2026
11.5.0
Dec 16, 2025
11.4.0
Sep 05, 2025
11.2.0
Aug 11, 2025
11.1.0
Aug 08, 2025
11.0.0
Aug 05, 2025
10.6.2
Jul 22, 2025
10.6.1
Jul 21, 2025
10.6.0
Jul 21, 2025
10.5.1
Jul 16, 2025
10.5.0
Jul 11, 2025
10.4.0
Jun 18, 2025
10.2.2
May 27, 2025
10.2.1
May 20, 2025
10.1.0
Apr 16, 2025
10.0.1
Mar 27, 2025
10.0.0
Feb 25, 2025
9.1.0
Jan 13, 2025
9.0.0
Jan 09, 2025
8.1.0
Dec 16, 2024
8.0.0
Dec 05, 2024
7.6.0
Nov 18, 2024
7.5.1
Nov 05, 2024
7.5.0
Nov 04, 2024
7.4.0
Oct 02, 2024
7.3.0
Aug 13, 2024
7.1.0
Apr 26, 2024
7.0.1
Feb 21, 2024
7.0.0
Jan 15, 2024
6.0.0
Jan 11, 2024
5.0.0
Dec 05, 2023
4.1.0
Nov 17, 2023
4.0.0
Oct 18, 2023
3.5.1
Sep 27, 2023
3.5.0
Sep 25, 2023
3.4.2a1
Sep 04, 2023
3.4.1
Sep 01, 2023
3.4.0
Aug 30, 2023
3.3.0
Aug 24, 2023
3.2.4
Aug 14, 2023
3.2.3
Aug 09, 2023
3.2.2
Aug 09, 2023
3.2.0
Aug 04, 2023
3.1.5
Jul 10, 2023
3.1.4
Jun 26, 2023
3.1.3
Jun 21, 2023
3.1.2
May 31, 2023
3.1.1
May 16, 2023
3.1.0
Apr 12, 2023
3.0.0
Apr 04, 2023
2.17.0
Mar 29, 2023
2.16.1
Mar 03, 2023
2.16.0
Feb 23, 2023
2.15.0
Feb 17, 2023
2.14.0
Feb 16, 2023
2.13.0
Feb 14, 2023
2.12.0
Feb 13, 2023
2.11.1
Feb 10, 2023
2.11.0
Feb 10, 2023
2.10.0
Feb 09, 2023
2.9.2
Feb 08, 2023
2.9.1
Feb 07, 2023
2.9.0
Feb 07, 2023
2.8.1
Jan 19, 2023
2.8.0
Jan 16, 2023
2.7.1
Dec 30, 2022
2.7.0
Dec 14, 2022
2.6.1
Nov 22, 2022
2.6.0
Nov 22, 2022
2.5.0
Nov 14, 2022
2.4.4
Oct 04, 2022
2.4.3
Sep 23, 2022
2.4.2
Sep 23, 2022
2.4.1
Sep 23, 2022
2.4.0
Sep 07, 2022
2.3.0
Aug 23, 2022
2.2.3
Aug 15, 2022
2.2.2
Aug 15, 2022
2.2.1
Aug 11, 2022
2.2.0
Aug 10, 2022
2.1.0
Aug 10, 2022
2.0.0
Aug 08, 2022
1.7.1
Aug 01, 2022
1.7.0
Jul 28, 2022
1.6.0
Jun 28, 2022
1.5.0
Jun 15, 2022
1.4.2
May 16, 2022
1.4.1
May 04, 2022
1.4.0
May 04, 2022
1.3.3
Apr 13, 2022
1.3.2
Apr 13, 2022
1.3.1
Apr 13, 2022
1.3.0
Mar 15, 2022
1.2.0
Feb 16, 2022
1.1.1
Jan 18, 2022
1.1.0
Nov 22, 2021
1.0.0
Sep 30, 2021