Skip to content

Conversation

@sergei-bronnikov
Copy link

@sergei-bronnikov sergei-bronnikov commented Jan 16, 2026

https://bugtracker.codiodev.com/issue/codio-17375/eCornell-still-having-issues-they-think-tools-are-being-blocked

Summary by CodeRabbit

  • New Features
    • Code interpreter tool is now available as a fully supported feature
    • Containers support configurable memory limits (1GB, 4GB, 16GB, 64GB) with separate per-tier pricing models
    • Container creation costs are automatically estimated and included in overall API usage charges
    • Built-in validation ensures only supported memory configurations are accepted

✏️ Tip: You can customize this high-level summary in your review settings.

@AndreyNikitin
Copy link

@coderabbitai full review, summary

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

@AndreyNikitin: I'll perform a full review of the PR and regenerate the summary.

✅ Actions performed

Summary regeneration triggered.

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Walkthrough

Introduces container-specific cost modeling for OpenAI code interpreter tools through a memory-limit-based cost map, API methods to estimate container creation costs, updated request types with memory limit support, and middleware validation for container configurations.

Changes

Cohort / File(s) Summary
Cost model
internal/provider/openai/cost.go
Adds OpenAiCodeInterpreterContainerCost map for memory-limit-to-cost pricing and new EstimateResponseApiToolCreateContainerCost() method on CostEstimator to compute container creation costs per tool container memory limit.
Request type structure
internal/provider/openai/types.go
Introduces ResponseRequestToolContainer with MemoryLimit field and GetMemoryLimit() method; refactors ResponseRequestToolUnion with Container field and adds GetContainerAsResponseRequestToolContainer() method for runtime type conversion.
Middleware integration
internal/server/web/proxy/middleware.go
Adds EstimateResponseApiToolCreateContainerCost() to estimator interface; implements container memory limit validation against allowed costs with 403 abort on invalid limits.
Response cost calculation
internal/server/web/proxy/responses.go
Integrates container cost calculation into response paths; adds ginCtxSetResponsesRequest() and ginCtxGetResponsesRequest() helper functions for context-based request storage and retrieval.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Middleware as Middleware
    participant Estimator as Cost Estimator
    participant Response as Response Handler
    
    Client->>Middleware: POST /responses with tool containers
    Middleware->>Middleware: Extract tool container memory limits
    Middleware->>Estimator: Validate memory limits against<br/>OpenAiCodeInterpreterContainerCost
    alt Memory limit not allowed
        Estimator-->>Middleware: Error
        Middleware-->>Client: 403 Forbidden
    else Memory limit valid
        Middleware->>Middleware: Store response request in context
        Middleware->>Response: Process response
        Response->>Estimator: EstimateResponseApiToolCreateContainerCost()
        Estimator-->>Response: Container cost (float64)
        Response->>Response: Add container cost to total cost
        Response-->>Client: Response with final cost
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #9 — Extends existing OpenAI responses and tool cost handling by adding container-specific cost modeling and request type updates to the same files and estimator interface introduced in that PR.
✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e1ea19b and 786c321.

📒 Files selected for processing (4)
  • internal/provider/openai/cost.go
  • internal/provider/openai/types.go
  • internal/server/web/proxy/middleware.go
  • internal/server/web/proxy/responses.go

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@sergei-bronnikov sergei-bronnikov merged commit 7a29d49 into main Jan 16, 2026
2 of 3 checks passed
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.

3 participants