Metadata-Version: 2.5
Name: apishare-tunnel
Version: 1.1.1
Summary: ApiShare Tunnel - Expose local API services through the ApiShare platform
Author-email: ApiShare <admin@apishare.cc>
License-Expression: MIT
Keywords: api,apishare,nat-traversal,reverse-proxy,tunnel
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet :: Proxy Servers
Requires-Python: >=3.7
Requires-Dist: aiohttp>=3.9
Requires-Dist: websockets>=12.0
Provides-Extra: server
Requires-Dist: aiohttp>=3.9; extra == 'server'
Description-Content-Type: text/markdown

# ApiShare Tunnel

Expose your local API service to the public internet through the ApiShare platform.

## Installation

```bash
pip install apishare
```

## Client Usage

Expose a local API service running on port 8000:

```bash
apishare -k YOUR_TOKEN -p 8000
```

Your service is now accessible through the platform.

## Server Usage (Platform Admin)

Run the tunnel server:

```bash
apishare serve --port 3397
```

## Options

```
-k, --key    Platform auth token (required for client mode)
-p, --port   Local service port (required for client mode)
--host       Local service address (default: localhost)
-s, --server Tunnel server address (default: apishare.cc)
```

`--server` accepts a plain host (`apishare.cc`, default wss://), `host:port`,
or a full `ws://` / `wss://` URL for self-hosted servers.

## v1.1.0 — reliability upgrade (engineered after samaidev/aitun)

- **Large responses no longer stall**: bodies over 64KB are streamed as
  128KB chunks instead of one giant WebSocket frame.
- **Idle SSE keepalive**: LLM generations with long silent gaps stay alive
  (empty keepalive chunks every 30s of upstream silence).
- **Smarter reconnects**: exponential backoff capped at 30s + jitter; a
  `4009` close code ("replaced by a newer client with the same token")
  stops reconnecting instead of fighting the other instance.
- **Safe concurrent sends**: parallel requests share one serialized send
  path, so heartbeats and response chunks can no longer interleave.
- **Port pre-flight**: warns immediately when nothing listens on `-p PORT`.

The client remains fully protocol-compatible with older servers.