Skip to content

support responses api , support native message-api, fix inconsistent credit consumption in chat#170

Open
caozhiyuan wants to merge 63 commits intoericc-ch:masterfrom
caozhiyuan:feature/responses-api
Open

support responses api , support native message-api, fix inconsistent credit consumption in chat#170
caozhiyuan wants to merge 63 commits intoericc-ch:masterfrom
caozhiyuan:feature/responses-api

Conversation

@caozhiyuan
Copy link
Copy Markdown
Contributor

@caozhiyuan caozhiyuan commented Jan 12, 2026

This pull request introduces a new configuration system, structured logging, and support for the /v1/responses endpoint, and support for the claude native message api, along with improvements to model selection and request handling. The most important changes are grouped below:

Responses API Integration:

  • Added full support for the /v1/responses endpoint, including a new handler (src/routes/responses/handler.ts) that validates model support, streams or returns results, and logs all activity.
  • Enhanced src/routes/messages/handler.ts to route requests to the Responses API when supported by the selected model, including translation logic for payloads and results.
  • Updated the API documentation in README.md to include the new /v1/responses endpoint and clarify its purpose.

Claude Native Message API:

  • support Claude Native Message API

Configuration Management:

  • Added a new src/lib/config.ts module to provide persistent application configuration, including support for model-specific prompts, reasoning effort levels, and default model selection. Configuration is stored in a new config.json file in the app data directory, with automatic creation and safe permissions. [1] [2]

Logging Improvements:

  • Implemented a new buffered, file-based logging utility in src/lib/logger.ts for handler-level logging, with log rotation, retention, and structured output. Integrated this logger into key request handlers for better diagnostics. [1] [2] [3] [4] [5]

Token Counting Logic:

  • Refactored token counting in src/lib/tokenizer.ts to more accurately account for tool calls, array parameters, and model-specific behaviors (including GPT and Anthropic/Grok models). Added support for excluding certain schema keys and improved calculation for nested parameters. [1] [2] [3] [4] [5] [6] [7] [8]

Fix Credit Consumption Inconsistency:

  • fix inconsistent credit consumption in chat and Merge tool_result and text blocks into tool_result to avoid consuming premium requests

caozhiyuan and others added 27 commits September 27, 2025 13:43
…arsing and allign with vscode-copilot-chat extractThinkingData, otherwise it will cause miss cache occasionally
…ing small model if no tools are used

2.add bun idleTimeout = 0
3.feat: Compatible with Claude code JSONL file usage error scenarios, delay closeBlockIfOpen and map responses api to anthropic  support tool_use and fix spelling errors
4.feat: add configuration management with extra prompt handling and ensure config file creation
…just runServer to set verbose level correctly
…adjusting input token calculations and handling tool prompts
Some clients, like RooCode may send `service_tier` to `/responses` endpoint, but Copilot do not support this field and returns error
@caozhiyuan
Copy link
Copy Markdown
Contributor Author

@ericc-ch also fix inconsistent credit consumption in chat and adapter claude code skill tool_result. opencode had fixed it.

@caozhiyuan
Copy link
Copy Markdown
Contributor Author

Also supports the vscode extension, not sure if you need it: https://github.com/caozhiyuan/copilot-api/tree/feature/vscode-extension. Does not depend on bun.

@caozhiyuan caozhiyuan force-pushed the feature/responses-api branch from 2c2d0db to 0eb8e7f Compare February 15, 2026 07:42
@tzhouML
Copy link
Copy Markdown

tzhouML commented Feb 23, 2026

hi @caozhiyuan thanks so much for your efforts on this. Question, none of the models seem to be showing thinking/reasoning in openwebui, do you have any suggestions?

@caozhiyuan
Copy link
Copy Markdown
Contributor Author

hi @caozhiyuan thanks so much for your efforts on this. Question, none of the models seem to be showing thinking/reasoning in openwebui, do you have any suggestions?

@tzhouML in cherry studio , it's ok

@caozhiyuan caozhiyuan force-pushed the feature/responses-api branch 6 times, most recently from 83dcfa8 to 4f6ee78 Compare March 9, 2026 09:08
… 0.38.2 and update opencode plugin to set header x-session-id
@caozhiyuan caozhiyuan force-pushed the feature/responses-api branch from 4f6ee78 to e69e6a8 Compare March 9, 2026 10:13
@caozhiyuan caozhiyuan force-pushed the feature/responses-api branch from 5f5a134 to ca803ba Compare March 12, 2026 09:39
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.

8 participants