Skip to content

Commit

Permalink
doc: add README
Browse files Browse the repository at this point in the history
Signed-off-by: Xin Liu <sam@secondstate.io>
  • Loading branch information
apepkuss committed Oct 23, 2024
1 parent 565bb68 commit 1278fa1
Showing 1 changed file with 81 additions and 0 deletions.
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Llama-Proxy-Server

Llama-proxy-server serves as a proxy server for LLM APIs.

## Usage

### Start llama-proxy-server

```bash
wasmedge llama-proxy-server.wasm --port 10086
```

> `llama-proxy-server` will use `8080` port by default. You can change the port by adding `--port <port>`.
### Register, unregister, list downstream servers

- Register a downstream server

```bash
curl -X POST http://localhost:8080/admin/register/{type} -d "http://localhost:8080"
```

The `{type}` can be `chat`, `whisper`, `image`.

For example, register a whisper server:

```bash
curl -X POST http://localhost:8080/admin/register/whisper -d "http://localhost:12306"
```

- Unregister a downstream server

```bash
curl -X POST http://localhost:8080/admin/unregister/{type} -d "http://localhost:8080"
```

The `{type}` can be `chat`, `whisper`, `image`.

For example, unregister a whisper server:

```bash
curl -X POST http://localhost:8080/admin/unregister/whisper -d "http://localhost:12306"
```

- List available downstream servers

To list all the registered downstream servers and their types, you can use the following command:

```bash
curl -X POST http://localhost:8080/admin/servers
```

If the downstream servers are registered, the response will be like:

```json
{
"chat": [],
"image": [],
"whisper": [
"http://0.0.0.0:12306/"
]
}
```

### Business endpoints

Currently, `llama-proxy-server` supports the following three types of business endpoints:

- `chat` endpoints (corresponds to [`llama-api-server`](https://github.com/LlamaEdge/LlamaEdge))
- `/v1/chat/completions`
- `/v1/completions`
- `/v1/models`
- `/v1/embeddings`
- `/v1/files`
- `/v1/chunks`
- `whisper` endpoints (corresponds to [`whisper-api-server`](https://github.com/LlamaEdge/whisper-api-server))
- `/v1/audio/transcriptions`
- `/v1/audio/translations`
- `image` endpoints (corresponds to [`sd-api-server`](https://github.com/LlamaEdge/sd-api-server))
- `/v1/images/generations`
- `/v1/images/edits`

0 comments on commit 1278fa1

Please # to comment.