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.

Claude Code MCP

This package also installs slice-mcp, a stdio MCP server. Add it to Claude Code with one command:

claude mcp add slice -s user -e SLICE_API_KEY=slk_live_... -- slice-mcp

It exposes six read and write tools over your slice account: check spend against budget, list recent requests, show the eval pass rate, and list, add, or delete model-routing rules. It talks to the hosted gateway by default; set SLICE_BASE_URL for a self-hosted one.

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.3

The package now installs slice-mcp, the slice MCP server, so pipx install slice-gateway gives you both the CLI and the Claude Code integration. See the Claude Code MCP section above.

What's new in 0.2.2

slice login now ends by printing your dashboard link and opening it in the browser. The how-to page at https://sliceapp.dev/how-to has screenshots of the install and login steps.

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.3

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.3
File Size Uploaded
slice_gateway-0.2.3.tar.gz 17.6 kB Details

Built distribution (wheel)

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

Total release size: 36.3 kB

Release files / slice_gateway-0.2.3.tar.gz

Download URL slice_gateway-0.2.3.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fed4906e7bf23f64907bf08f1806762d5979a02b9f8b52fc597557dbd8c950e3
BLAKE2b-256 checksum
How to use checksums
9b1c59f211336d51f9a6b1abc88ded7f8f10d34319931b8ed5bc3a061ec2a76a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

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

Download URL slice_gateway-0.2.3-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ff4d2a3074fd732368343bf968c899e77891432b578e7a13522acf28857ddf6
BLAKE2b-256 checksum
How to use checksums
f61796e7e1d5b7623cbea917dcfcfdfcf1f9c8bb452f8dac205da6c350063b8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

0.2.2

2 release files

0.2.1

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