Skip to main content

slice-gateway

Command-line client for slice, a self-hosted LLM gateway that routes, caches, and caps your AI spend.

This package installs the slice command. It logs you in through GitHub, then prints the environment lines that point your existing tools at a slice gateway. It has no server dependencies. It needs only typer and httpx, plus the standard library.

Quickstart

  1. Install the CLI:

    pip install slice-gateway
    
  2. Log in through GitHub:

    slice login
    
  3. Point a tool at slice. For Claude Code, set three variables:

    export ANTHROPIC_BASE_URL=https://api.sliceapp.dev
    export ANTHROPIC_API_KEY=sk-ant-api...     # your own Anthropic key
    export ANTHROPIC_AUTH_TOKEN=slk_live_...   # your slice key, from slice login
    

ANTHROPIC_AUTH_TOKEN goes out as Authorization: Bearer, which is where slice reads its key. ANTHROPIC_API_KEY stays your own Anthropic key in x-api-key, and slice forwards it upstream.

Run slice use anthropic, slice use openai, slice use curl, or slice use claude-code to print the exact lines for your tool.

The gateway

This is only the client. The slice gateway itself, the server that does the routing, caching, budgets, and dashboards, lives on GitHub at https://github.com/jjk30/slice.

Homepage: https://sliceapp.dev

What's new in 0.2.1

slice login talks to the hosted gateway at https://api.sliceapp.dev by default. No flag needed. Self-hosted users pass --base-url http://localhost:8080 once, or set SLICE_BASE_URL. A saved login keeps its address. slice --version prints the installed version.

What's new in 0.2.0

slice login now names the key after your machine and revokes the previous key from the same machine. Each device has one live key.

Release files for slice-gateway 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for slice-gateway 0.2.1
File Size Uploaded
slice_gateway-0.2.1.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for slice-gateway 0.2.1
File Interpreter ABI Platform
slice_gateway-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / slice_gateway-0.2.1.tar.gz

Download URL slice_gateway-0.2.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
bd54d73bc179535edfef43aace321004efee46778f969245a88868ee101b31aa
BLAKE2b-256 checksum
How to use checksums
58e6ad28276e43dbd2ef75f19a9ebc600fe5c82ad628563b61d54185acd793b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / slice_gateway-0.2.1-py3-none-any.whl

Download URL slice_gateway-0.2.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2584d5d39dcaad637581b62ee84ad55dcac796fb1b71cc8614b02071ad3b4df
BLAKE2b-256 checksum
How to use checksums
eb27ffccf56ee3acb374f137001e41aa7c76446b27a273f9be6cae7ac1b7bbce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release history Release notifications | RSS feed

0.2.3

2 release files

0.2.2

2 release files

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page