Skip to main content

pysaif

A local-first library that handles AI provider logistics — API calls, config, memory, quota — so you don't have to think about them every time.

from pysaif import AI

ai = AI()
response = ai.send("Hello!")
print(response)

Install

pip install pysaif

Setup

On first run, pysaif creates a Config/ folder next to your project with config.toml (API keys, model, personality — the stuff you'll actually touch) and advanced_config.toml (timeouts, retries, per-model metadata — the stuff most people never open). Drop your API key into config.toml and you're done.

Each project gets its own config and its own key — pysaif never shares keys or settings across projects, and never reads them from your environment implicitly.

What's implemented right now

  • Config: self-healing setup, two-file split, schema versioning and migration hook
  • Providers: Google Gemini, OpenAI, Anthropic Claude, OpenRouter (sync and async)
  • Provider selection: manual, cheapest, fastest, and smart strategies
  • Quota-aware daily token limits and automatic provider failover with retries
  • Local memory under Memory/ (rolling window, important, interests) with inject/store toggles
  • Usage tracking under Usage/ (state + optional JSONL logs; message content off by default)
  • In-memory response cache (opt-in via cache.enabled)
  • Prompt assembly from optional context, background, personality, and instructions

Configuration highlights

Config/config.toml:

  • provider.strategymanual | cheapest | fastest | smart
  • provider.fallback_order — provider names to try on errors
  • memory.store / memory.inject — persist conversation vs. feed it into prompts
  • quota.daily_token_limit0 means unlimited

What's designed but not built yet

Interactive setup wizard, richer capability tools (search/look/make), and automated config migrations beyond schema backfill — see the module skeleton under pysaif/capabilities/ for planned expansion points.

License

See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysaif-0.1.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysaif-0.1.0-py3-none-any.whl (34.1 kB view details)

Uploaded Python 3

File details

Details for the file pysaif-0.1.0.tar.gz.

File metadata

  • Download URL: pysaif-0.1.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysaif-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c80560e829837c348f833cb2b32a1457ec6a517d137cf00cc0c92e7a9212e905
MD5 1a73f701e0311dc9f2eec46c1a9081e3
BLAKE2b-256 8cc5f4e39fbcae3e6dffb00bdf3eefdb715a0b197c9ebe366d7cbdfd58db07d6

See more details on using hashes here.

File details

Details for the file pysaif-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pysaif-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pysaif-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c131859c313e54d12c461f29c798f58983290e59f800d299cad9bf9dcd2e912
MD5 91065ef5a44363b334dd229ab87766c5
BLAKE2b-256 cb0731bdcf4de1fbbd2b1fb3f61bce34ea1d4a84cb2f76a4fed9973aee92da88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page