Skip to main content

basemode

Make any LLM do raw text continuation.

basemode coerces chat-tuned models into clean next-token continuation mode (instead of assistant-style replies), with strategy selection handled per model/provider.

Install

pip install basemode

Set provider keys via environment variables or .env (for example OPENAI_API_KEY, ANTHROPIC_API_KEY, OPENROUTER_API_KEY, GEMINI_API_KEY, GROQ_API_KEY, TOGETHER_API_KEY).

Quickstart

# Single continuation (default model if configured, else fallback)
basemode "The ship rounded the headland and"

# Parallel continuations
basemode "The ship rounded the headland and" -n 3

# Inspect selected strategy and pricing metadata
basemode info claude-sonnet-4-6

# Show only key-configured models
basemode models --available

CLI

basemode --help
basemode run --help
basemode models --help
basemode info --help
basemode strategies --help

Useful commands:

  • basemode run (default): stream continuation text
  • basemode models: list models (supports --verified and --json for picker UIs)
  • basemode providers: list provider IDs
  • basemode info: show normalized model + prompt strategy + pricing metadata
  • basemode default: get/set your default model
  • basemode keys: manage stored API keys

Python API

from basemode import continue_text, branch_text

async for token in continue_text(
    "The ship rounded the headland and",
    model="gpt-4o-mini",
    max_tokens=120,
):
    print(token, end="", flush=True)

async for idx, token in branch_text(
    "The ship rounded the headland and",
    model="gpt-4o-mini",
    n=3,
    max_tokens=80,
):
    print(idx, token, end="", flush=True)

Docs

Full docs are in docs/ and can be served with MkDocs:

make docs-serve

Then open http://localhost:8001.

Integration Health Checks

Run live provider checks (real APIs, key-aware skips):

uv run pytest -m integration tests/test_integration.py -q

This writes a machine-readable report to dist/integration/provider_health.json with per-model status, latency, token estimates, and estimated USD cost.

Verified Models

Single generated table, refreshed by CI.

Model Input cost (/1M) Output cost (/1M) Release date Prompt method Reliability
anthropic/claude-haiku-4-5-20251001 $1.00 $5.00 2025-10-01 prefill
anthropic/claude-opus-4-1-20250805 $15.00 $75.00 2025-08-05 prefill
anthropic/claude-opus-4-20250514 $15.00 $75.00 2025-05-22 prefill
anthropic/claude-opus-4-5-20251101 $5.00 $25.00 2025-11-24 prefill
anthropic/claude-opus-4-6 $5.00 $25.00 2026-02-05 system
anthropic/claude-opus-4-7 $5.00 $25.00 2026-04-16 system
anthropic/claude-sonnet-4-20250514 $3.00 $15.00 2025-05-22 prefill
anthropic/claude-sonnet-4-5-20250929 $3.00 $15.00 2025-09-29 prefill
anthropic/claude-sonnet-4-6 $3.00 $15.00 2026-02-17 system
gemini/gemini-2.5-flash $0.30 $2.50 2025-06-17 system
gemini/gemini-2.5-pro $1.25 $10.00 2025-06-17 system
gemini/gemma-4-26b-a4b-it $0.07 $0.34 2026-04-03 system
gemini/gemma-4-31b-it $0.10 $0.34 2026-04-02 system
moonshot/kimi-k2-0905-preview $0.60 $2.50 2025-07-11 system
moonshot/kimi-k2.5 $0.60 $3.00 2026-01-27 system
openai/gpt-4o-mini $0.15 $0.60 2024-07-18 system
openai/gpt-5.4-mini $0.75 $4.50 2026-03-17 system
openrouter/moonshotai/kimi-k2.6 $0.58 $2.44 2026-04-20 system
zai/glm-4.7 $0.60 $2.20 2025-12-22 system
zai/glm-5 $1.00 $3.20 2026-02-11 system

Legend: = LiteLLM pricing present and release date available; = missing/approximate field or known issue.

Download files

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

Source Distribution

basemode-0.1.5.tar.gz (210.1 kB view details)

Uploaded Source

Built Distribution

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

basemode-0.1.5-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file basemode-0.1.5.tar.gz.

File metadata

  • Download URL: basemode-0.1.5.tar.gz
  • Upload date:
  • Size: 210.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for basemode-0.1.5.tar.gz
Algorithm Hash digest
SHA256 60df6643b53fa895cadd43d3782ac4393d6f289e0fa56733968a62f00fa4122e
MD5 a497316d9562612e02053733b9e51b58
BLAKE2b-256 dcdc4932c79bc3da43fc7aa24c7d372b88b5a722249d03e6e175e90e4c6958ed

See more details on using hashes here.

File details

Details for the file basemode-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: basemode-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for basemode-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 49f1a9f2a6a83e25c826e32946f9a8217572589b7e5aa4761cc7ef64e7cdbf4e
MD5 3548680d35d1cabf6a4de58821ad3db9
BLAKE2b-256 8dd70ea757a51309aff0b5ed3ca4ffd7f1800dc1e614d04fd86e04d1d0bdbffc

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

This release

0.1.5 This release

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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