Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .containerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.git
.github
.agents
.codex
.claude
.gemini
.idea
.vscode
.worktrees

.env
config.yaml
auths
logs
conv
pgstore
gitstore
objectstore
plugins
static
temp
refs

bin
examples/plugin/bin
*.exe
cli-proxy-api
test-output

Dockerfile
docker-compose.yml
docker-compose.cluster.yml
.dockerignore
.containerignore
.gitignore
.goreleaser.yml

docs
README.md
README_CN.md
README_JA.md
AGENTS.md
CLAUDE.md
GEMINI.md
9 changes: 7 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Example environment configuration for CLIProxyAPI.
# Copy this file to `.env` and uncomment the variables you need.
#
# NOTE: Environment variables are only required when using remote storage options.
# For local file-based storage (default), no environment variables need to be set.
# NOTE: Environment variables are required only for the features that use them.

# ------------------------------------------------------------------------------
# Kiro provider plugin (optional)
# ------------------------------------------------------------------------------
# KIRO_API_KEY_1=REPLACE_WITH_KIRO_ACCOUNT_1_API_KEY
# KIRO_API_KEY_2=REPLACE_WITH_KIRO_ACCOUNT_2_API_KEY

# ------------------------------------------------------------------------------
# Management Web UI
Expand Down
51 changes: 51 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM golang:1.26-bookworm AS builder

WORKDIR /src

RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git \
&& rm -rf /var/lib/apt/lists/*

COPY go.mod go.sum ./
RUN go mod download

COPY . .

ARG VERSION=dev
ARG COMMIT=none
ARG BUILD_DATE=unknown

RUN CGO_ENABLED=1 GOOS=linux go build \
-buildvcs=false \
-ldflags="-s -w -X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}' -X 'main.BuildDate=${BUILD_DATE}'" \
-o /out/CLIProxyAPI \
./cmd/server/

RUN plugin_arch="$(go env GOARCH)" \
&& plugin_dir="/out/plugins/linux/${plugin_arch}" \
&& mkdir -p "${plugin_dir}" \
&& cd examples/plugin/kiro/go \
&& CGO_ENABLED=1 GOOS=linux go build \
-buildmode=c-shared \
-o "${plugin_dir}/kiro-go.so" \
. \
&& rm -f "${plugin_dir}/kiro-go.h"

FROM debian:bookworm-slim

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates tzdata \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /CLIProxyAPI

COPY --from=builder /out/CLIProxyAPI /CLIProxyAPI/CLIProxyAPI
COPY --from=builder /out/plugins /CLIProxyAPI/plugins
COPY config.example.yaml /CLIProxyAPI/config.example.yaml

WORKDIR /CLIProxyAPI

EXPOSE 8317

ENV TZ=UTC

CMD ["./CLIProxyAPI"]
5 changes: 5 additions & 0 deletions config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ plugins:
config2: "string"
config3: 3
mode: "safe" # enum example: safe, fast
# kiro-go:
# enabled: true
# priority: 1
# models:
# - "*" # expose every model discovered for each Kiro account

# When true, disable high-overhead request logging and HTTP middleware features to reduce per-request memory usage under high concurrency.
commercial-mode: false
Expand Down
55 changes: 55 additions & 0 deletions deploy/gcp/config.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
host: ""
port: 8317

tls:
enable: false
cert: ""
key: ""

remote-management:
allow-remote: false
secret-key: ""
disable-control-panel: true
disable-auto-update-panel: true

auth-dir: "/root/.cli-proxy-api"

api-keys:
- "__CLIPROXY_API_KEY__"

debug: false

pprof:
enable: false
addr: "127.0.0.1:8316"

commercial-mode: false
logging-to-file: false
request-log: false
usage-statistics-enabled: false
passthrough-headers: false

request-retry: 3
max-retry-credentials: 0
max-retry-interval: 30
disable-cooling: false
save-cooldown-status: false

streaming:
keepalive-seconds: 15
bootstrap-retries: 1

routing:
strategy: "round-robin"
session-affinity: true
session-affinity-ttl: "1h"

plugins:
enabled: true
dir: "plugins"
configs:
kiro-go:
enabled: true
priority: 1
models:
- "*"
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ services:
# - .env
environment:
DEPLOY: ${DEPLOY:-}
KIRO_API_KEY: ${KIRO_API_KEY:-}
KIRO_API_KEY_1: ${KIRO_API_KEY_1:-}
KIRO_API_KEY_2: ${KIRO_API_KEY_2:-}
ports:
- "8317:8317"
- "8085:8085"
Expand Down
15 changes: 12 additions & 3 deletions examples/plugin/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
EXAMPLES := simple model auth frontend-auth executor protocol-format request-translator request-normalizer response-translator response-normalizer thinking usage cli management-api host-callback host-callback-auth-files host-model-callback claude-web-search-router
GO_ONLY_EXAMPLES := kiro

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rebuild Kiro when any Go source changes

Adding Kiro to this Makefile target exposes it to the existing Go pattern rule, whose prerequisites include only kiro/go/main.go and kiro/go/go.mod. Because this plugin's implementation is split across many additional .go files, editing files such as translate.go, auth.go, or executor.go after the first build leaves bin/kiro-go.so considered up to date, so make build-kiro silently serves a stale plugin. Include all package Go sources in the target dependencies.

Useful? React with 👍 / 👎.

LANGUAGES := go c rust
BIN_DIR := $(CURDIR)/bin
BUILD_DIR := $(BIN_DIR)/build
Expand All @@ -19,12 +20,14 @@ RUST_DYLIB_PREFIX := lib
RUST_DYLIB_EXT := so
endif

.PHONY: build list clean
.PHONY: build build-kiro list clean

build: $(foreach example,$(EXAMPLES),$(foreach lang,$(LANGUAGES),$(BIN_DIR)/$(example)-$(lang).$(PLUGIN_EXT)))
build: $(foreach example,$(EXAMPLES),$(foreach lang,$(LANGUAGES),$(BIN_DIR)/$(example)-$(lang).$(PLUGIN_EXT))) $(foreach example,$(GO_ONLY_EXAMPLES),$(BIN_DIR)/$(example)-go.$(PLUGIN_EXT))

build-kiro: $(BIN_DIR)/kiro-go.$(PLUGIN_EXT)

list:
@$(foreach example,$(EXAMPLES),$(foreach lang,$(LANGUAGES),echo $(example)/$(lang);))
@$(foreach example,$(EXAMPLES),$(foreach lang,$(LANGUAGES),echo $(example)/$(lang);)) $(foreach example,$(GO_ONLY_EXAMPLES),echo $(example)/go;)

clean:
rm -rf $(BIN_DIR)
Expand All @@ -35,6 +38,12 @@ $(BIN_DIR):
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

KIRO_GO_SOURCES := $(wildcard kiro/go/*.go)

$(BIN_DIR)/kiro-go.$(PLUGIN_EXT): $(KIRO_GO_SOURCES) kiro/go/go.mod kiro/go/go.sum | $(BIN_DIR)
cd kiro/go && go build -buildmode=c-shared -o $(abspath $@) .
rm -f $(BIN_DIR)/kiro-go.h

$(BIN_DIR)/%-go.$(PLUGIN_EXT): %/go/main.go %/go/go.mod | $(BIN_DIR)
cd $*/go && go build -buildmode=c-shared -o $(abspath $@) .
rm -f $(BIN_DIR)/$*-go.h
Expand Down
1 change: 1 addition & 0 deletions examples/plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This directory contains standard dynamic library plugin examples for the CLIProx
- `request-lifecycle/`: Go-only request admission example with concurrency control, active HTTP termination, and terminal callbacks.
- `scheduler/`: Go-only scheduler that can select a configured auth ID, delegate to a built-in scheduler, or deny picks.
- `claude-web-search-router/`: ModelRouter + executor for Claude Code built-in `web_search` (antigravity / codex / xai / Tavily). See `claude-web-search-router/README.md`.
- `kiro/`: API-key-only Kiro provider with Claude-native request/response handling. See `kiro/README.md`.
- `response-translator/`: response translation capability only.
- `response-normalizer/`: response normalization capability only.
- `thinking/`: thinking applier capability only.
Expand Down
Loading
Loading