Pi package: goritech media tools (image gen/edit, first+last frame video)

This commit is contained in:
zenord
2026-10-11 23:35:03 +08:00
commit ba6cedcb7b
4 changed files with 626 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
# Goritech Media — Pi Package
Three model-callable tools for [Pi](https://github.com/earendil-works/pi) backed by an OpenAI-compatible media gateway:
| Tool | Capability | Default model |
|---|---|---|
| `generate_image` | Text-to-image | `gpt-image-2.5-flare` |
| `edit_image` | Image-to-image / editing | `gpt-image-2.5-flare` |
| `generate_video` | Text-to-video, image-to-video, **first+last frame interpolation** | `grok-imagine-video-1.5` |
## Install
```bash
# from git
pi install git:github.com/<you>/pi-package-goritech-media
# or npm
pi install npm:pi-package-goritech-media
# or try once without installing
pi -e git:github.com/<you>/pi-package-goritech-media
```
## Configure
All settings are optional. Defaults work with the goriteches gateway.
| Env var | Default | Description |
|---|---|---|
| `GORITECHES_BASE_URL` | `https://api.goriteches.com/v1` | API base URL |
| `GORITECHES_API_KEY` | — | API key. Falls back to the `goriteches` provider key in `~/.pi/agent/models.json` |
| `GORITECHES_IMAGE_MODEL` | `gpt-image-2.5-flare` | Image generation/edit model |
| `GORITECHES_VIDEO_MODEL` | `grok-imagine-video-1.5` | Video generation model |
## Usage
Just ask Pi naturally:
- "生成一张猫咪在月球上的图"
- "把这张图改成水彩风格" (edit_image)
- "用 a.png 和 b.png 生成一个 5 秒过渡视频" (generate_video with first+last frame)
Output files land in `<cwd>/goritech-media/`.
### generate_video modes
| Mode | Parameters |
|---|---|
| Text-to-video | `prompt` only |
| Image-to-video | `first_frame` + optional `prompt` |
| First+last frame interpolation | `first_frame` + `last_frame` + optional `prompt` |
`first_frame` / `last_frame` accept a local image path, http(s) URL, or data URI.
## Commands
- `/gori-media` — show current config and API key source
- `/gori-fetch <request_id>` — re-download a completed video job (results expire after a while)
## Notes
- Video generation is async (usually 1–3 min) and costs roughly $0.08/second.
- Video polling/download runs through `curl` subprocesses: the gateway pins HTTP/2 connections to the upstream node that created the job, and in-process Node requests hit persistent 404s on `/content` after completion.
- The gateway's `status.video.url` already includes the `/v1` prefix; the extension strips it before joining with the base URL.
## License
MIT