llama-stack-mirror/llama_stack/providers
Ashwin Bharambe 4645182789 fix: enforce allowed_models during inference requests (#4197)
The `allowed_models` configuration was only being applied when listing
models via the `/v1/models` endpoint, but the actual inference requests
weren't checking this restriction. This meant users could directly
request any model the provider supports by specifying it in their
inference call, completely bypassing the intended cost controls.

The fix adds validation to all three inference methods (chat
completions, completions, and embeddings) that checks the requested
model against the allowed_models list before making the provider API
call.

### Test plan

Added unit tests

(cherry picked from commit d649c3663e)

# Conflicts:
#	llama_stack/providers/utils/inference/openai_mixin.py
#	tests/unit/providers/utils/inference/test_openai_mixin.py
2025-11-24 19:05:08 +00:00
..
inline revert: "chore(cleanup)!: remove tool_runtime.rag_tool" (#3877) 2025-10-21 11:22:06 -07:00
registry revert: "chore(cleanup)!: remove tool_runtime.rag_tool" (#3877) 2025-10-21 11:22:06 -07:00
remote chore(cleanup)!: kill vector_db references as far as possible (#3864) 2025-10-20 20:06:16 -07:00
utils fix: enforce allowed_models during inference requests (#4197) 2025-11-24 19:05:08 +00:00
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
datatypes.py chore(cleanup)!: kill vector_db references as far as possible (#3864) 2025-10-20 20:06:16 -07:00