Skip to content

Conversation

@caozhiyuan
Copy link
Contributor

This pull request introduces a new configuration system, structured logging, and support for the /v1/responses endpoint, 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.

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 adapter claude code skill tool_result

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
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
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.

…uming premium requests

(caused by skill invocations, edit hooks or to do reminders)
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