Skip to main content

Skimly Python SDK

Project description

Skimly Python SDK

Official Python SDK for Skimly - the AI token optimization platform.

Installation

pip install skimly

Quick Start

from skimly import SkimlyClient

# Initialize client
client = SkimlyClient.from_env()

# Chat with OpenAI
response = client.chat({
    "provider": "openai",
    "model": "gpt-4o-mini",
    "messages": [{"role": "user", "content": "Hello!"}]
})

# Upload large content once
blob = client.create_blob("Large document content...")
print(blob["blob_id"])

# Avoid re-uploading identical content
blob = client.create_blob_if_new("Large document content...")

# Transform tool results with Smart Compression
compressed = client.transform(
    result="Large tool output...",
    tool_name="bash",
    command="npm run build"
)

# Fetch blob content with range support
content = client.fetch("b_abc123", start=0, end=1024)

API Reference

SkimlyClient(key, base?, timeout_ms?, retries?)

Creates a new Skimly client instance.

SkimlyClient.from_env()

Creates a client from environment variables:

client.chat(req)

Send a chat request. Request object should include:

  • provider - "openai" or "anthropic"
  • model - Model name
  • messages - Array of message objects

client.create_blob(content, mime_type?)

Upload large content once. Returns {blob_id}.

client.create_blob_if_new(content, mime_type?)

Upload content only if it hasn't been uploaded before. Returns {blob_id}.

client.transform(result, tool_name?, command?, model?)

Transform and compress tool results using Smart Compression Timing.

client.fetch(blob_id, start?, end?)

Fetch blob content with optional range support.

client.get_signed_url(blob_id, ttl?)

Get a signed URL for direct blob access.

client.list_keys()

List all API keys for the authenticated user.

client.create_key(name)

Create a new API key.

client.revoke_key(key_id)

Revoke an API key.

client.rotate_key(key_id)

Rotate an API key (revoke old, create new).

Project details


Download files

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

Source Distribution

skimly-0.1.4.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

skimly-0.1.4-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file skimly-0.1.4.tar.gz.

File metadata

  • Download URL: skimly-0.1.4.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for skimly-0.1.4.tar.gz
Algorithm Hash digest
SHA256 8cfe64c9cd99fc6fb441cc8f508d3307ec5c15fea4a3a417320038ede404a299
MD5 a7e195c45db144eecb2cba53209dc036
BLAKE2b-256 7a1ef1499b1aa106f2c39d432dea9f6acce3882a38338598a1b2047908241aed

See more details on using hashes here.

File details

Details for the file skimly-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: skimly-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for skimly-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ea9e1071a3912152bdc22162e48e1b9c5088b99227a9de49743b4af55c1153da
MD5 2bb3fce2c67e5ce328b9e97a7ededd37
BLAKE2b-256 c5d08a0a24a419f6dcc581d72219fe3640f07c02de5ee017d606a631bd6cbb45

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