JetBrains AI API client
Installation
pip install jbai-client
Usage examples
Create the client:
import os
from jbai_client import JbaiPlatformClient, JbaiAuthType, JbaiEndpoint
client = JbaiPlatformClient(
endpoint=JbaiEndpoint.STAGING,
auth_type=JbaiAuthType.USER,
api_key=os.getenv("JBAI_TOKEN"),
)
LLM API
Get the list of LLM profiles:
response = client.get_llm_profiles_v9()
for profile in response.profiles:
print(profile)
Use LLM chat:
# noinspection PyTypeChecker
from jbai_client.models import ChatModelsStreamV9Request, LLMChatUserMessage, V5LLMChat
for response in client.post_llm_chat_stream_v9(
request=ChatModelsStreamV9Request(
prompt="test",
profile="openai-gpt-4",
chat=V5LLMChat(
messages=[
LLMChatUserMessage(content="Tell me a joke about programmers"),
]
),
)
):
print(response)
Use AsyncJbaiPlatformClient for asynchronous execution:
import asyncio
import os
from jbai_client import AsyncJbaiPlatformClient, JbaiAuthType, JbaiEndpoint
from jbai_client.models import ChatModelsStreamV9Request, LLMChatUserMessage, V5LLMChat
client = AsyncJbaiPlatformClient(
endpoint=JbaiEndpoint.STAGING,
auth_type=JbaiAuthType.USER,
api_key=os.getenv("JBAI_TOKEN"),
)
async def main():
# noinspection PyTypeChecker
async for response in client.post_llm_chat_stream_v9(
request=ChatModelsStreamV9Request(
prompt="test",
profile="openai-gpt-4",
chat=V5LLMChat(
messages=[
LLMChatUserMessage(content="Tell me a joke about programmers"),
]
),
)
):
print(response)
asyncio.run(main())
Tasks API
Get tasks roster:
response = client.get_task_roster()
for task in response.ids:
print(task)
Call a task (optionally specify a task tag via custom header (valid only for STAGING)):
from jbai_client import JbaiHeader
from jbai_client.models import TaskAPIStreamV5TextImproveShortenRequest
# noinspection PyTypeChecker
for response in client.text_improve_shorten_v5(
TaskAPIStreamV5TextImproveShortenRequest(
parameters={
"text": "This is a simple example sentence that could be made shorter and clearer.",
"lang": "en",
}
),
headers={
JbaiHeader.GRAZIE_TASK_TAG: "openai-chat-gpt"
},
):
print(response)
P.S. Most modern IDEs support auto-import functionality, which can simplify the discovery and import of data model classes.
Data models documentation
See MODELS.md
Metadata
Release files for jbai-client 2026.2.32
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jbai_client-2026.2.32.tar.gz | 68.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jbai_client-2026.2.32-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 515.6 kB
Release files / jbai_client-2026.2.32.tar.gz
| Download URL | jbai_client-2026.2.32.tar.gz |
|---|---|
| Size | 68.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b09f0432e8e9c78bcb8d787499231f9919ed0a80d7b1e31299ccd79a4ac5402
|
|
BLAKE2b-256 checksum How to use checksums |
67f48093dc4f36e8d2c0e07a28b70cbccf65a7124f4644fad3912e14c3d33286
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.18 Linux/5.15.0-1084-aws
|
Release files / jbai_client-2026.2.32-py3-none-any.whl
| Download URL | jbai_client-2026.2.32-py3-none-any.whl |
|---|---|
| Size | 447.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a74a195563e37c48faaf23bb13885658d0c0c5c7fcb2ff377bc019fded8202fe
|
|
BLAKE2b-256 checksum How to use checksums |
7790b2482b36b46d91602dfba2a9adfd00922f15c133132f89ec3769aeba910c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.10.18 Linux/5.15.0-1084-aws
|