Skip to content

feat: add responses passthrough#1

Merged
Lumysia merged 1 commit into
masterfrom
feat/responses-passthrough
Apr 6, 2026
Merged

feat: add responses passthrough#1
Lumysia merged 1 commit into
masterfrom
feat/responses-passthrough

Conversation

@Lumysia
Copy link
Copy Markdown
Owner

@Lumysia Lumysia commented Apr 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 6, 2026 23:04
@Lumysia Lumysia merged commit 47d507d into master Apr 6, 2026
2 checks passed
@Lumysia Lumysia deleted the feat/responses-passthrough branch April 6, 2026 23:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an OpenAI-style responses passthrough to the Copilot proxy so clients can call /responses (and /v1/responses) and receive the upstream Copilot response (including streaming metadata) largely unchanged.

Changes:

  • Introduces a new Copilot service (createResponses) that POSTs to Copilot’s /responses endpoint and returns the upstream Response.
  • Adds Hono routing for /responses and registers it under both /responses and /v1/responses.
  • Adds tests covering basic POST behavior and preservation of streaming headers/body; updates README endpoint documentation.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/create-responses.test.ts Adds unit tests for the new responses passthrough behavior (JSON + streaming).
src/services/copilot/create-responses.ts Implements the Copilot /responses service call and error handling.
src/routes/responses/route.ts Adds a new route that forwards request JSON to Copilot and streams back status/headers/body.
src/server.ts Registers the new responses routes under both unversioned and /v1 paths.
README.md Documents the new endpoints and simplifies the README structure.
bun.lock Lockfile metadata update (configVersion).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +2
/// <reference lib="dom" />

Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

/// <reference lib="dom" /> is the only triple-slash lib reference in the repo. Since the project’s TypeScript configuration controls global libs, it’s better to avoid per-file lib references here (they can create inconsistent typing/duplicate lib definitions across files). Consider removing this and, if DOM types are actually needed project-wide, add them in tsconfig.json (or rely on @types/bun) instead.

Suggested change
/// <reference lib="dom" />

Copilot uses AI. Check for mistakes.
body: JSON.stringify(payload),
})

if (!response.ok) throw new HTTPError("Failed to create response", response)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The error message "Failed to create response" is a bit ambiguous/inconsistent with the endpoint name (/responses) and other service errors in this repo (e.g., "Failed to create embeddings", "Failed to create chat completions"). Consider renaming it to clearly identify the failing operation (e.g., "Failed to create responses") so logs and client errors are easier to interpret.

Suggested change
if (!response.ok) throw new HTTPError("Failed to create response", response)
if (!response.ok) throw new HTTPError("Failed to create responses", response)

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +51 to +60
| Endpoint | Method | Notes |
| --- | --- | --- |
| `/chat/completions` | `POST` | Chat completions passthrough |
| `/v1/chat/completions` | `POST` | Chat completions passthrough |
| `/embeddings` | `POST` | Embeddings passthrough |
| `/v1/embeddings` | `POST` | Embeddings passthrough |
| `/models` | `GET` | Model list |
| `/v1/models` | `GET` | Model list |
| `/responses` | `POST` | Responses passthrough |
| `/v1/responses` | `POST` | Responses passthrough |
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

The new Markdown tables in this section start with a double pipe (|| ...). In standard Markdown this creates an extra empty first column, which makes the table render with a blank leading column. Use a single leading pipe (| ...) for the header and separator rows to avoid the extra column.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +64 to +67
| Endpoint | Method | Notes |
| --- | --- | --- |
| `/v1/messages` | `POST` | Anthropic messages compatibility |
| `/v1/messages/count_tokens` | `POST` | Token counting |
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

This table also starts with ||, which renders an extra blank first column in Markdown. Use a single leading | on the header/separator rows instead.

Copilot uses AI. Check for mistakes.
Comment thread README.md
Comment on lines +71 to +74
| Endpoint | Method | Notes |
| --- | --- | --- |
| `/usage` | `GET` | Usage information |
| `/token` | `GET` | Current Copilot token |
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

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

Same Markdown table formatting issue here: the rows start with ||, which adds an unintended empty first column when rendered. Prefer a single leading | for these rows.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants