Skip to content

Commit 086c48b

Browse files
committed
feat: add Anthropic event logging endpoint
Add /api/event_logging/batch endpoint that returns 200 OK. This is a stub for Anthropic telemetry logging. PR: ericc-ch#165
1 parent 47fa289 commit 086c48b

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ These endpoints are designed to be compatible with the Anthropic Messages API.
201201
| -------------------------------- | ------ | ------------------------------------------------------------ |
202202
| `POST /v1/messages` | `POST` | Creates a model response for a given conversation. |
203203
| `POST /v1/messages/count_tokens` | `POST` | Calculates the number of tokens for a given set of messages. |
204+
| `POST /api/event_logging/batch` | `POST` | Anthropic telemetry log endpoint (stub returning 200). |
204205

205206
### Usage Monitoring Endpoints
206207

src/routes/event-logging/route.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Hono } from "hono"
2+
3+
export const eventLoggingRoutes = new Hono()
4+
5+
eventLoggingRoutes.post("/batch", (c) => {
6+
return c.text("OK", 200)
7+
})

src/server.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { logger } from "hono/logger"
44

55
import { completionRoutes } from "./routes/chat-completions/route"
66
import { embeddingRoutes } from "./routes/embeddings/route"
7+
import { eventLoggingRoutes } from "./routes/event-logging/route"
78
import { messageRoutes } from "./routes/messages/route"
89
import { modelRoutes } from "./routes/models/route"
910
import { tokenRoute } from "./routes/token/route"
@@ -29,3 +30,4 @@ server.route("/v1/embeddings", embeddingRoutes)
2930

3031
// Anthropic compatible endpoints
3132
server.route("/v1/messages", messageRoutes)
33+
server.route("/api/event_logging", eventLoggingRoutes)

0 commit comments

Comments
 (0)