Skip to content

feat(model): support o3 and format code#24

Open
nlimpid wants to merge 1 commit intofuergaosi233:mainfrom
nlimpid:feat-gpt-o3
Open

feat(model): support o3 and format code#24
nlimpid wants to merge 1 commit intofuergaosi233:mainfrom
nlimpid:feat-gpt-o3

Conversation

@nlimpid
Copy link

@nlimpid nlimpid commented Jul 15, 2025

Summary

  • Added support for OpenAI o3 models with their special parameter
    requirements
  • Implemented comprehensive code formatting improvements using ruff
  • Enhanced code consistency across the entire codebase

Changes

Feature: OpenAI o3 Model Support

  • Added is_o3_model() method in ModelManager to detect o3 models
  • Modified request converter to use max_completion_tokens instead of
    max_tokens for o3 models
  • Set temperature to 1 for o3 models as required by OpenAI API
  • Updated endpoints to handle o3 model requirements in test connections

Code Formatting Improvements

  1. Quote Consistency: Standardized all strings to use double quotes
    throughout the codebase
  2. F-string Optimization: Removed unnecessary f-strings where no
    placeholders are present
  3. Import Organization: Reorganized imports following Python best practices
  4. Line Formatting: Applied consistent line breaks and spacing

openai_request["max_completion_tokens"] = 200
openai_request["temperature"] = 1
else:
openai_request["max_tokens"] = 5
Copy link
Owner

Choose a reason for hiding this comment

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

Why max_tokens is 5?

aaaronmiller pushed a commit to aaaronmiller/claude-code-proxy that referenced this pull request Nov 19, 2025
…ion, passthrough mode, Docker improvements

This commit implements changes from PRs fuergaosi233#35, fuergaosi233#24, fuergaosi233#39, fuergaosi233#37, and fuergaosi233#32:

## PR fuergaosi233#35 + fuergaosi233#24: OpenAI Newer Models Support (o1, o3, o4, gpt-5)
- Add `is_newer_openai_model()` method to ModelManager to detect o1, o3, o4, gpt-5
- Add `is_o3_model()` method for specific o3 model detection
- Use `max_completion_tokens` instead of `max_tokens` for newer models
- Enforce `temperature=1` for newer OpenAI reasoning models
- Update test-connection endpoint to handle newer models correctly
- Fix compatibility with OpenAI's newer model API requirements

## PR fuergaosi233#39: Enhanced Conversion & Error Handling
- Add comprehensive input validation to request converter
- Validate Claude request structure before processing
- Add enhanced error handling in response converter
- Validate OpenAI response structure with detailed error messages
- Add prompt cache support for non-streaming responses
- Extract and include `cache_read_input_tokens` from prompt_tokens_details
- Improve error messages for debugging

## PR fuergaosi233#37: Multi-Tenant Passthrough Mode
- Add passthrough mode support for multi-tenant deployments
- Make OPENAI_API_KEY optional - enable passthrough mode when not set
- Add per-request API key support via `openai-api-key` header
- Update OpenAIClient to accept per-request API keys
- Add API key format validation (sk- prefix, minimum length)
- Update endpoints to extract and validate OpenAI API keys from headers
- Support both proxy mode (server key) and passthrough mode (user keys)
- Enable separate billing per tenant in passthrough mode

## PR fuergaosi233#32: Docker Improvements
- Add comprehensive .dockerignore file
- Exclude development files, tests, and sensitive data from Docker builds
- Reduce Docker image size by excluding unnecessary files
- Improve build performance with proper ignore patterns

## Additional Improvements
- Better error messages and logging throughout
- Enhanced API key validation
- Improved request/response handling

All changes maintain backward compatibility with existing deployments.
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