You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
require the existing bearer token for POST /predict, which invokes the model directly
apply an independent rate limit to prediction requests
reject NaN and infinite model features before tensor construction
bound POST /infer prompts to 1–4,000 characters
document the shared authentication requirement in the README and example environment
add regression coverage for authorization and request validation
Validation
Repository CI will run the Python test suite, containerized ingestion smoke test, security audit, SAST, data validation, AWS telemetry checks, and benchmark workflow as configured.
Compatibility
/predict now intentionally fails closed with HTTP 503 until API_BEARER_TOKEN is configured, matching the established /infer contract.
Summary by CodeRabbit
Security
/predict now requires bearer authentication and returns 503 when the shared token is not configured.
/predict is limited to 30 requests per minute.
Validation
Prompts must contain 1–4,000 characters.
Non-finite numeric values are rejected in prediction requests.
The API now validates prompt lengths and finite feature values. The /predict endpoint requires bearer authentication and applies a limit of 30 requests per minute. Tests and configuration documentation cover these changes.
/predict now requires bearer authentication and applies a limit of 30 requests per minute. Tests cover token configuration, missing or invalid tokens, and prediction responses. Both configuration references document the token requirement for /infer and /predict.
sequenceDiagram
participant Client
participant predict
participant _require_bearer
participant Inference
Client->>predict: POST /predict with request body
predict->>_require_bearer: Check bearer token
_require_bearer-->>predict: Authorize request
predict->>Inference: Pass body.features
Loading
Suggested reviewers:copilot
Merge Risk: Low · up to b331d
Sending an extremely large numeric feature value to /predict may produce a server error instead of a clean 422 validation response. This is a narrow edge case with no data or security impact, so the change is mergeable, and a small follow-up fix is advisable.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /predict, which invokes the model directlyPOST /inferprompts to 1–4,000 charactersValidation
Repository CI will run the Python test suite, containerized ingestion smoke test, security audit, SAST, data validation, AWS telemetry checks, and benchmark workflow as configured.
Compatibility
/predictnow intentionally fails closed with HTTP 503 untilAPI_BEARER_TOKENis configured, matching the established/infercontract.Summary by CodeRabbit
/predictnow requires bearer authentication and returns 503 when the shared token is not configured./predictis limited to 30 requests per minute.