Python client and CLI for the Inception AI API
Project description
Inception API Client Library
A Python client library and CLI for the Inception AI API, featuring Pydantic models for type safety and data validation. The library provides both a programmatic interface and a command-line tool for interacting with the Inception AI API.
Installation
# Install from source
pip install -e .
# Or install dependencies directly
pip install -r requirements.txt
Command Line Interface
The library includes a full-featured CLI for interacting with the Inception AI API.
Authentication
# Log in to Inception AI
inception-api auth login
# Optionally pass your email and password directly from the CLI
inception-api auth login --email "email@example.com" --password "super-secret-password"
# Check authentication status
inception-api auth status
# Log out
inception-api auth logout
Chat Management
# List all chats
inception-api chats list
# Create a new chat
inception-api chats new
# Delete a chat
inception-api chats delete <chat_id>
# Set default chat for input/chat commands
inception-api chats set-default <chat_id>
Chat Interaction
# Send a single message (uses default chat)
inception-api input "What is Python?"
# Start interactive chat session
inception-api chat
In interactive chat mode:
- Type your messages and press Enter
- Use
/quitto exit - Press Ctrl+C to exit
- Responses are streamed in real-time
Python Library Usage
Basic Usage
from inception_api import Inception, Message
# Initialize the client
client = Inception(api_key="your_api_key")
# Create a new chat
chat = client.create_chat("Hello, how can you help me today?")
# Send messages and get streaming responses
messages = [
Message(role="user", content="What is Python?"),
]
for chunk in client.chat_completion(messages):
if "content" in chunk.choices[0].delta:
print(chunk.choices[0].delta["content"], end="")
# List chats
chats = client.list_chats(page=1)
# Delete a chat
client.delete_chat(chat_id="chat_id_here")
Advanced Usage
# Custom model selection
chat = client.create_chat(
"Hello!",
model="lambda.mercury-coder-small"
)
# Chat completion with specific session and chat IDs
for chunk in client.chat_completion(
messages=[Message(role="user", content="Hello!")],
model="lambda.mercury-coder-small",
session_id="custom_session_id",
chat_id="custom_chat_id"
):
print(chunk.choices[0].delta.get("content", ""), end="")
Features
Client Library
- Full type safety with Pydantic models
- Streaming chat completions support
- Chat management (create, list, delete)
- API structure similar to OpenAI's Python client
- Comprehensive error handling
- Configurable API endpoints
CLI Tool
- Interactive chat mode with streaming responses
- Chat management commands
- Secure authentication handling
- Configuration stored in platform-specific user directories
- Rich terminal output with formatting
- Command history in interactive mode
Data Models
The library includes Pydantic models for all API objects:
Message: Chat message with role and contentChat: Chat session with history and metadataChatCompletionChunk: Streaming response chunkChatHistory: Message history managementContentFilterResults: Content moderation results
Development
Running Tests
# Install test dependencies
pip install pytest pytest-cov
# Run all tests
pytest
# Run without integration tests
pytest -m "not integration"
# Run with coverage report
pytest --cov=inception_api
Project Structure
inception-api/
├── inception_api/
│ ├── __init__.py
│ ├── client.py # Core API client
│ └── main.py # CLI implementation
├── tests/
│ ├── conftest.py
│ ├── test_client.py
│ └── test_cli.py
├── pyproject.toml
├── requirements.txt
└── README.md
Requirements
- Python ≥ 3.8
- httpx ≥ 0.24.0
- pydantic ≥ 2.0.0
- click ≥ 8.0.0
- platformdirs ≥ 3.0.0
- rich ≥ 13.0.0
- sseclient-py ≥ 1.8.0
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file inception-0.1.0.tar.gz.
File metadata
- Download URL: inception-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1537206b0ae22528c8e04635fcf94a23ee3ea7c908c4068ca7334e98bfdf7a7c
|
|
| MD5 |
81d80f9acf3c7cc1011d2000091d8101
|
|
| BLAKE2b-256 |
bc4afe367d5700d0b9374cdb35570ca97d712b6026ef6b041bd08cd5f7fc8fa2
|
Provenance
The following attestation bundles were made for inception-0.1.0.tar.gz:
Publisher:
python-publish.yml on JacobFV/inception
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
inception-0.1.0.tar.gz -
Subject digest:
1537206b0ae22528c8e04635fcf94a23ee3ea7c908c4068ca7334e98bfdf7a7c - Sigstore transparency entry: 183925455
- Sigstore integration time:
-
Permalink:
JacobFV/inception@75f1e1f3ab9d3560d42cba812e2a1d6c135af005 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/JacobFV
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@75f1e1f3ab9d3560d42cba812e2a1d6c135af005 -
Trigger Event:
release
-
Statement type:
File details
Details for the file inception-0.1.0-py3-none-any.whl.
File metadata
- Download URL: inception-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
623da8b6afc1f885e0330f95c5959d7424582ff3bd2a8ea56cd6b3f69e4fd0be
|
|
| MD5 |
c6c90265a61bb9d829a3e6e44b214450
|
|
| BLAKE2b-256 |
a61f67a0ae94238698579b803fa144a8abcc9d2b9e8f5255c0006a042ff7b167
|
Provenance
The following attestation bundles were made for inception-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on JacobFV/inception
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
inception-0.1.0-py3-none-any.whl -
Subject digest:
623da8b6afc1f885e0330f95c5959d7424582ff3bd2a8ea56cd6b3f69e4fd0be - Sigstore transparency entry: 183925462
- Sigstore integration time:
-
Permalink:
JacobFV/inception@75f1e1f3ab9d3560d42cba812e2a1d6c135af005 -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/JacobFV
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@75f1e1f3ab9d3560d42cba812e2a1d6c135af005 -
Trigger Event:
release
-
Statement type: