Skip to content

[serve][llm] Add Native Anthropic Messages API (/v1/messages) Support - #65486

Closed
wanadzhar913 wants to merge 4 commits into
ray-project:masterfrom
wanadzhar913:ray-serve-llm/anthropic-messages-api
Closed

wanadzhar913 wants to merge 4 commits into
ray-project:masterfrom
wanadzhar913:ray-serve-llm/anthropic-messages-api

Conversation

@wanadzhar913

Copy link
Copy Markdown
Contributor

Description

Adds first-class Anthropic Messages API support to Ray Serve LLM for vLLM-based deployments. This allows Anthropic-compatible clients, including Claude Code, to communicate directly with Ray Serve LLM without an additional translation proxy such as LiteLLM or Claude Code Router. The initial implementation supports:

  • POST /v1/messages
  • POST /v1/messages/count_tokens
  • Streaming and non-streaming message responses.
  • Standard ingress and direct-streaming deployments.
  • Vanilla vLLM deployments. SGlang fallbacks on import failure, P/D disaggregation and data parallel deployments are outside this PR's scope.

Related issues

Implementation

  • Added Ray wrappers and alpha public APIs for vLLM's Anthropic request, response, token-counting, and error models.
  • Extended LLMEngine, LLMServerProtocol, and LLMServer with messages and count_tokens operations.
  • Initialized and delegated requests to vLLM's AnthropicServingMessages.
  • Added AnthropicIngress (which inherits from OpenaiIngress), reusing the existing ingress model resolution, LoRA routing, handle caching, session affinity, and deployment configuration.
  • Translateed internal vLLM errors into Anthropic-compatible error payloads at the HTTP boundary.
  • Preserved vLLM-generated Anthropic SSE events for streaming responses.
  • Added build_anthropic_app with support for both standard ingress and direct streaming.
  • Extended the mock vLLM engine with Anthropic routes and responses.
  • Added tests covering model imports, route registration, builder behavior, error responses, token counting, and streaming/non-streaming requests.

Testing

pytest

PYTHONPATH=python python -m pytest -v \
  python/ray/llm/tests/serve/cpu/configs/test_anthropic_api_models_backends.py \
  python/ray/llm/tests/serve/cpu/deployments/routers/test_anthropic_ingress.py \
  python/ray/llm/tests/serve/cpu/deployments/routers/test_anthropic_http.py \
  python/ray/llm/tests/serve/cpu/deployments/routers/test_builder_ingress.py -k Anthropic

API

I tested this using the anthropic==0.106.0 & vllm==0.26.0 python library, and have not used Claude Code (yet). Testing infra had the following specs:

  • GPU: NVIDIA GeForce RTX 4090 (24 GB VRAM)
  • Driver Version: 580.126.20
  • CUDA Version: 13.0
Ray LLMServer Setup Script
from ray import serve
from ray.serve.llm import LLMConfig, build_anthropic_app

llm_config = LLMConfig(
    model_loading_config={
        "model_id": "qwen-0.5b",
        "model_source": "Qwen/Qwen2.5-0.5B-Instruct",
    },
    deployment_config={
        "autoscaling_config": {
            "min_replicas": 1,
            "max_replicas": 2,
        }
    },
    # Pass the desired accelerator type (e.g. A10G, L4, etc.)
    # accelerator_type="A10G",
    # You can customize the engine arguments (e.g. vLLM engine kwargs)
    engine_kwargs={
        "tensor_parallel_size": 1,
    },
)

app = build_anthropic_app({"llm_configs": [llm_config]})
serve.run(app, blocking=True)
Ray LLMServer Setup Logs
(.venv) root@e698b1650b1b:/workspace# bash setup_ray_anthropic_api_pr.sh 
>>> Checking out Ray branch: ray-serve-llm/anthropic-messages-api
branch 'ray-serve-llm/anthropic-messages-api' set up to track 'origin/ray-serve-llm/anthropic-messages-api'.
Switched to a new branch 'ray-serve-llm/anthropic-messages-api'
>>> Starting the Anthropic-compatible Ray Serve API...
>>> Run scripts/test_ray_anthropic_api.sh from another terminal to test it.
/workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
  import pynvml  # type: ignore[import]
Usage stats collection is enabled by default for nightly wheels. To disable this, run the following command: `ray disable-usage-stats` before starting Ray. See https://docs.ray.io/en/master/cluster/usage-stats.html for more details.
2026-08-14 11:53:47,802 ERROR services.py:1431 -- Failed to start the dashboard 
2026-08-14 11:53:47,802 ERROR services.py:1456 -- Error should be written to 'dashboard.log' or 'dashboard.err'. We are printing the last 20 lines for you. See 'https://docs.ray.io/en/master/ray-observability/user-guides/configure-logging.html#logging-directory-structure' to find where the log file is.
2026-08-14 11:53:47,802 ERROR services.py:1500 -- 
The last 20 lines of /tmp/ray/session_2026-08-14_11-52-47_396084_60616/logs/dashboard.log (it contains the error message from the dashboard): 
    loop.run_until_complete(dashboard.run())
  File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/dashboard.py", line 107, in run
    await self.dashboard_head.run()
  File "/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/head.py", line 513, in run
    await self._configure_http_server(
  File "/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/head.py", line 153, in _configure_http_server
    self.http_server = HttpServerDashboardHead(
                       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/http_server_head.py", line 122, in __init__
    raise ex
  File "/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/http_server_head.py", line 113, in __init__
    build_dir = setup_static_dir()
                ^^^^^^^^^^^^^^^^^^
  File "/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/http_server_head.py", line 71, in setup_static_dir
    raise dashboard_utils.FrontendNotFoundError(
ray.dashboard.utils.FrontendNotFoundError: [Errno 2] Dashboard build directory not found. If installing from source, please follow the additional steps required to build the dashboard(cd python/ray/dashboard/client && npm ci && npm run build): '/workspace/ray/.venv/lib/python3.12/site-packages/ray/dashboard/client/build'
2026-08-14 11:53:47,803 WARNING utils.py:473 -- Detecting docker specified CPUs. In previous versions of Ray, CPU detection in containers was incorrect. Please ensure that Ray has enough CPUs allocated. As a temporary workaround to revert to the prior behavior, set `RAY_USE_MULTIPROCESSING_CPU_COUNT=1` as an env var before starting Ray. Set the env var: `RAY_DISABLE_DOCKER_CPU_WARNING=1` to mute this warning.
2026-08-14 11:53:47,803 WARNING utils.py:485 -- Ray currently does not support initializing Ray with fractional cpus. Your num_cpus will be truncated from 10.2 to 10.
2026-08-14 11:53:53,032 INFO worker.py:2024 -- Started a local Ray instance.
INFO 2026-08-14 11:53:57,015 serve 60616 -- ============== Deployment Options ==============
INFO 2026-08-14 11:53:57,015 serve 60616 -- {'autoscaling_config': {'max_replicas': 2,
                        'min_replicas': 1,
                        'target_ongoing_requests': 1000000000},
 'health_check_period_s': 10,
 'health_check_timeout_s': 10,
 'max_ongoing_requests': 1000000000,
 'name': 'LLMServer:qwen-0_5b',
 'placement_group_bundles': [{'CPU': 1, 'GPU': 1}],
 'placement_group_strategy': 'PACK',
 'ray_actor_options': {'runtime_env': {'worker_process_setup_hook': 'ray.llm._internal.serve._worker_process_setup_hook'}}}
INFO 2026-08-14 11:53:57,141 serve 60616 -- ============== Ingress Options ==============
INFO 2026-08-14 11:53:57,141 serve 60616 -- {'autoscaling_config': {'target_ongoing_requests': 1000000000},
 'max_ongoing_requests': 1000000000}
(ProxyActor pid=61920) INFO 2026-08-14 11:54:03,929 proxy 172.20.0.2 -- Proxy starting on node 378dbf39e6a51915676f01de61f3bcca7b66933744f44a833683bca7 (HTTP port: 8000).
INFO 2026-08-14 11:54:04,135 serve 60616 -- Started Serve in namespace "serve".
(ProxyActor pid=61920) INFO 2026-08-14 11:54:04,131 proxy 172.20.0.2 -- Got updated endpoints: {}.
(ServeController pid=61919) INFO 2026-08-14 11:54:04,222 controller 61919 -- Registering autoscaling state for deployment Deployment(name='LLMServer:qwen-0_5b', app='default')
(ServeController pid=61919) INFO 2026-08-14 11:54:04,223 controller 61919 -- Deploying new version of Deployment(name='LLMServer:qwen-0_5b', app='default') (initial target replicas: 1).
(ServeController pid=61919) INFO 2026-08-14 11:54:04,224 controller 61919 -- Registering autoscaling state for deployment Deployment(name='AnthropicIngress', app='default')
(ServeController pid=61919) INFO 2026-08-14 11:54:04,225 controller 61919 -- Deploying new version of Deployment(name='AnthropicIngress', app='default') (initial target replicas: 1).
(ProxyActor pid=61920) INFO 2026-08-14 11:54:04,231 proxy 172.20.0.2 -- Got updated endpoints: {Deployment(name='AnthropicIngress', app='default'): EndpointInfo(route='/', app_is_cross_language=False, route_patterns=None)}.
(ProxyActor pid=61920) INFO 2026-08-14 11:54:04,239 proxy 172.20.0.2 -- Started <ray.serve._private.router.SharedRouterLongPollClient object at 0x76763de9e720>.
(ServeController pid=61919) INFO 2026-08-14 11:54:04,332 controller 61919 -- Adding 1 replica to Deployment(name='LLMServer:qwen-0_5b', app='default').
(ServeController pid=61919) INFO 2026-08-14 11:54:04,335 controller 61919 -- Adding 1 replica to Deployment(name='AnthropicIngress', app='default').
(ServeReplica:default:AnthropicIngress pid=61926) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:default:AnthropicIngress pid=61926)   import pynvml  # type: ignore[import]
(ServeController pid=61919) WARNING 2026-08-14 11:54:34,365 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to be scheduled. This may be due to waiting for the cluster to auto-scale or for a runtime environment to be installed. Resources required for each replica: [{"GPU": 1.0, "CPU": 1.0}], total resources available: {}. Use `ray status` for more details.
(ServeController pid=61919) WARNING 2026-08-14 11:54:34,366 controller 61919 -- Deployment 'AnthropicIngress' in application 'default' has 1 replicas that have taken more than 30s to be scheduled. This may be due to waiting for the cluster to auto-scale or for a runtime environment to be installed. Resources required for each replica: {"CPU": 1}, total resources available: {"CPU": 8.0}. Use `ray status` for more details.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683)   import pynvml  # type: ignore[import]
(ProxyActor pid=61920) INFO 2026-08-14 11:54:48,194 proxy 172.20.0.2 -- Got updated endpoints: {Deployment(name='AnthropicIngress', app='default'): EndpointInfo(route='/', app_is_cross_language=False, route_patterns=[RoutePattern(methods=['GET', 'HEAD'], path='/docs'), RoutePattern(methods=['GET', 'HEAD'], path='/docs/oauth2-redirect'), RoutePattern(methods=['GET', 'HEAD'], path='/openapi.json'), RoutePattern(methods=['GET', 'HEAD'], path='/redoc'), RoutePattern(methods=['POST'], path='/v1/messages'), RoutePattern(methods=['POST'], path='/v1/messages/count_tokens')])}.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 11:54:53,441 default_LLMServer:qwen-0_5b kqnimn62 -- Running tasks to download model files on worker nodes
(pid=63324) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(pid=63324)   import pynvml  # type: ignore[import]
(ServeController pid=61919) WARNING 2026-08-14 11:55:04,382 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(initialize_remote_node pid=63324) No cloud storage mirror configured
(_get_vllm_engine_config pid=63324) Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
(_get_vllm_engine_config pid=63324) {"asctime": "2026-08-14 11:55:32,220", "levelname": "WARNING", "message": "Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.", "filename": "_http.py", "lineno": 904, "process": 63324, "job_id": "01000000", "worker_id": "4695f65c75a37c9cac9b14261922d4d488aba1b0eb9b71dc216a6ee3", "node_id": "378dbf39e6a51915676f01de61f3bcca7b66933744f44a833683bca7", "task_id": "aaf9253a9eca5fc2ffffffffffffffffffffffff01000000", "task_name": "_get_vllm_engine_config", "task_func_name": "ray.llm._internal.serve.engines.vllm.vllm_engine._get_vllm_engine_config", "timestamp_ns": 1786708532220740688}
(ServeController pid=61919) WARNING 2026-08-14 11:55:34,433 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(ServeController pid=61919) WARNING 2026-08-14 11:56:04,447 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(_get_vllm_engine_config pid=63324) INFO 08-14 11:56:25 [model.py:623] Resolved architecture: Qwen2ForCausalLM
(_get_vllm_engine_config pid=63324) INFO 08-14 11:56:25 [model.py:1788] Using max model len 32768
(_get_vllm_engine_config pid=63324) INFO 08-14 11:56:25 [arg_utils.py:1951] Using ray runtime env (env vars redacted): {'worker_process_setup_hook': 'ray.llm._internal.serve._worker_process_setup_hook'}
(_get_vllm_engine_config pid=63324) INFO 08-14 11:56:25 [scheduler.py:252] Chunked prefill is enabled with max_num_batched_tokens=2048.
(_get_vllm_engine_config pid=63324) INFO 08-14 11:56:25 [vllm.py:1109] Asynchronous scheduling is enabled.
(_get_vllm_engine_config pid=63324) INFO 08-14 11:56:25 [kernel.py:295] Final IR op priority after setting platform defaults: IrOpPriorityConfig(rms_norm=['native'], fused_add_rms_norm=['native'])
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 11:56:26,134 default_LLMServer:qwen-0_5b kqnimn62 -- Clearing the current platform cache ...
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 11:56:26,159 default_LLMServer:qwen-0_5b kqnimn62 -- Using executor class: <class 'vllm.v1.executor.ray_executor_v2.RayExecutorV2'>
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) WARNING 08-14 11:56:31 [system_utils.py:157] We must use the `spawn` multiprocessing start method. Overriding VLLM_WORKER_MULTIPROC_METHOD to 'spawn'. See https://docs.vllm.ai/en/latest/usage/troubleshooting.html#python-multiprocessing for more information. Reasons: In a Ray actor and can only be spawned
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683)   import pynvml  # type: ignore[import]
(ServeController pid=61919) WARNING 2026-08-14 11:56:34,478 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(ServeController pid=61919) WARNING 2026-08-14 11:57:04,556 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:57:16 [core.py:116] Initializing a V1 LLM engine (v0.26.0) with config: model='Qwen/Qwen2.5-0.5B-Instruct', speculative_config=None, tokenizer='Qwen/Qwen2.5-0.5B-Instruct', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, tokenizer_revision=None, trust_remote_code=False, dtype=torch.bfloat16, max_seq_len=32768, download_dir=None, load_format=auto, tensor_parallel_size=1, pipeline_parallel_size=1, data_parallel_size=1, decode_context_parallel_size=1, dcp_comm_backend=ag_rs, disable_custom_all_reduce=False, quantization=None, quantization_config=None, enforce_eager=False, enable_return_routed_experts=False, kv_cache_dtype=auto, device_config=cuda, structured_outputs_config=StructuredOutputsConfig(backend='auto', disable_any_whitespace=False, disable_additional_properties=False, reasoning_parser='', reasoning_parser_plugin='', enable_in_reasoning=False), observability_config=ObservabilityConfig(show_hidden_metrics_for_version=None, otlp_traces_endpoint=None, collect_detailed_traces=None, kv_cache_metrics=False, kv_cache_metrics_sample=0.01, cudagraph_metrics=False, enable_layerwise_nvtx_tracing=False, enable_mfu_metrics=False, enable_mm_processor_stats=False, enable_logging_iteration_details=False, jit_monitor_mode='warn', jit_monitor_verbose=False), seed=0, served_model_name=qwen-0.5b, enable_prefix_caching=True, enable_chunked_prefill=True, pooler_config=None, compilation_config={'mode': <CompilationMode.VLLM_COMPILE: 3>, 'debug_dump_path': None, 'cache_dir': '', 'compile_cache_save_format': 'binary', 'backend': 'inductor', 'custom_ops': ['none'], 'ir_enable_torch_wrap': True, 'splitting_ops': ['vllm::unified_attention_with_output', 'vllm::unified_mla_attention_with_output', 'vllm::mamba_mixer2', 'vllm::mamba_mixer', 'vllm::short_conv', 'vllm::linear_attention', 'vllm::plamo2_mamba_mixer', 'vllm::qwen_gdn_attention_core', 'vllm::gdn_attention_core_xpu', 'vllm::olmo_hybrid_gdn_full_forward', 'vllm::kda_attention', 'vllm::sparse_attn_indexer', 'vllm::rocm_aiter_sparse_attn_indexer', 'vllm::deepseek_v4_attention', 'vllm::hpc_rope_norm_forward', 'vllm::unified_kv_cache_update', 'vllm::unified_mla_kv_cache_update'], 'compile_mm_encoder': False, 'cudagraph_mm_encoder': False, 'encoder_cudagraph_token_budgets': [], 'encoder_cudagraph_max_vision_items_per_batch': 0, 'encoder_cudagraph_max_frames_per_batch': None, 'compile_sizes': [], 'compile_ranges_endpoints': [2048], 'inductor_compile_config': {'enable_auto_functionalized_v2': False, 'size_asserts': False, 'alignment_asserts': False, 'scalar_asserts': False, 'combo_kernels': True, 'benchmark_combo_kernel': True}, 'inductor_passes': {}, 'cudagraph_mode': <CUDAGraphMode.FULL_AND_PIECEWISE: (2, 1)>, 'cudagraph_num_of_warmups': 1, 'cudagraph_capture_sizes': [1, 2, 4, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400, 416, 432, 448, 464, 480, 496, 512], 'cudagraph_copy_inputs': False, 'cudagraph_specialize_lora': True, 'use_inductor_graph_partition': False, 'pass_config': {'fuse_norm_quant': False, 'fuse_act_quant': False, 'fuse_attn_quant': False, 'enable_sp': False, 'fuse_gemm_comms': False, 'fuse_allreduce_rms': False, 'enable_qk_norm_rope_fusion': False, 'fuse_rope_kvcache_cat_mla': False, 'fuse_act_padding': False, 'fuse_qk_norm_rope_kvcache': False}, 'max_cudagraph_capture_size': 512, 'dynamic_shapes_config': {'type': <DynamicShapesType.BACKED: 'backed'>, 'evaluate_guards': False, 'assume_32_bit_indexing': False}, 'local_cache_dir': None, 'fast_moe_cold_start': False, 'static_all_moe_layers': []}, kernel_config=KernelConfig(ir_op_priority=IrOpPriorityConfig(rms_norm=['native'], fused_add_rms_norm=['native']), enable_flashinfer_autotune=True, enable_cutedsl_warmup=True, enable_bf16x3_router_gemm=False, moe_backend='auto', linear_backend='auto')
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) 2026-08-14 11:57:16,125     INFO worker.py:1683 -- Using address 172.20.0.2:44883 set in the environment variable RAY_ADDRESS
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:57:16 [ray_utils.py:602] Using the existing placement group
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) 2026-08-14 11:57:16,138     INFO worker.py:1833 -- Connecting to existing Ray cluster at address: 172.20.0.2:44883...
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) 2026-08-14 11:57:16,157     INFO worker.py:2024 -- Connected to Ray cluster.
(ServeReplica:default:AnthropicIngress pid=61926) INFO 2026-08-14 11:57:22,980 default_AnthropicIngress i763jp1f 178d4f4d-8ab3-4635-9760-364998a841e3 -- Started <ray.serve._private.router.SharedRouterLongPollClient object at 0x7aa6c8b8cda0>.
(pid=65043) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(pid=65043)   import pynvml  # type: ignore[import]
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (pid=65043) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (pid=65043)   import pynvml  # type: ignore[import]
(ServeController pid=61919) WARNING 2026-08-14 11:57:34,580 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(RayWorkerProc pid=65043) WARNING 08-14 11:58:02 [worker_base.py:306] Missing `shared_worker_lock` argument from executor. This argument is needed for mm_processor_cache_type='shm'.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) WARNING 08-14 11:58:02 [worker_base.py:306] Missing `shared_worker_lock` argument from executor. This argument is needed for mm_processor_cache_type='shm'.
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:02 [parallel_state.py:1615] world_size=1 rank=0 local_rank=0 distributed_init_method=tcp://172.20.0.2:100 backend=nccl
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:02 [parallel_state.py:1946] rank 0 in world size 1 is assigned as DP rank 0, PP rank 0, PCP rank 0, TP rank 0, EP rank N/A, EPLB rank N/A
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:02 [gpu_worker.py:378] Using V2 Model Runner
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:02 [parallel_state.py:1615] world_size=1 rank=0 local_rank=0 distributed_init_method=tcp://172.20.0.2:100 backend=nccl
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:02 [parallel_state.py:1946] rank 0 in world size 1 is assigned as DP rank 0, PP rank 0, PCP rank 0, TP rank 0, EP rank N/A, EPLB rank N/A
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:02 [gpu_worker.py:378] Using V2 Model Runner
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:03 [model_runner.py:284] Loading model from scratch...
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:03 [model_runner.py:284] Loading model from scratch...
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:04 [cuda.py:482] Using FLASH_ATTN attention backend out of potential backends: ['FLASH_ATTN', 'FLASHINFER', 'TRITON_ATTN', 'FLEX_ATTENTION'].
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:04 [flash_attn.py:776] Using FlashAttention version 2
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:04 [cuda.py:482] Using FLASH_ATTN attention backend out of potential backends: ['FLASH_ATTN', 'FLASHINFER', 'TRITON_ATTN', 'FLEX_ATTENTION'].
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:04 [flash_attn.py:776] Using FlashAttention version 2
(ServeController pid=61919) WARNING 2026-08-14 11:58:04,666 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(ServeController pid=61919) WARNING 2026-08-14 11:58:34,694 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:530] Time spent downloading weights for Qwen/Qwen2.5-0.5B-Instruct: 35.615082 seconds
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:530] Time spent downloading weights for Qwen/Qwen2.5-0.5B-Instruct: 35.615082 seconds
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:574] No model.safetensors.index.json found in remote.
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:869] Filesystem type for checkpoints: NFS4. Checkpoint size: 0.92 GiB. Available RAM: 152.67 GiB.
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:831] Prefetching checkpoint files into page cache started (in background, num_threads=8, block_size=16777216 bytes)
Loading safetensors checkpoint shards:   0% Completed | 0/1 [00:00<?, ?it/s]
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:574] No model.safetensors.index.json found in remote.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:869] Filesystem type for checkpoints: NFS4. Checkpoint size: 0.92 GiB. Available RAM: 152.67 GiB.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:40 [weight_utils.py:831] Prefetching checkpoint files into page cache started (in background, num_threads=8, block_size=16777216 bytes)
Loading safetensors checkpoint shards:   0% Completed | 0/1 [00:00<?, ?it/s](RayWorkerProc pid=65043) (Worker pid=65043) 
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [weight_utils.py:803] Prefetching checkpoint files: 10% (1/1)
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [weight_utils.py:826] Prefetching checkpoint files into page cache finished in 1.29s
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [default_loader.py:430] Loading weights took 1.35 seconds
Loading safetensors checkpoint shards: 100% Completed | 1/1 [00:01<00:00,  1.29s/it]
Loading safetensors checkpoint shards: 100% Completed | 1/1 [00:01<00:00,  1.29s/it]
(RayWorkerProc pid=65043) (Worker pid=65043) 
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [weight_utils.py:803] Prefetching checkpoint files: 10% (1/1)
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [weight_utils.py:826] Prefetching checkpoint files into page cache finished in 1.29s
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [default_loader.py:430] Loading weights took 1.35 seconds
Loading safetensors checkpoint shards: 100% Completed | 1/1 [00:01<00:00,  1.29s/it]erProc pid=65043) (Worker pid=65043) 
Loading safetensors checkpoint shards: 100% Completed | 1/1 [00:01<00:00,  1.29s/it]erProc pid=65043) (Worker pid=65043) 
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) 
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [model_runner.py:305] Model loading took 0.93 GiB and 39.315232 seconds
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [topk_topp_sampler.py:55] Using FlashInfer for top-p & top-k sampling.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [model_runner.py:305] Model loading took 0.93 GiB and 39.315232 seconds
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:42 [topk_topp_sampler.py:55] Using FlashInfer for top-p & top-k sampling.
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:52 [backends.py:1094] Using cache directory: /root/.cache/vllm/torch_compile_cache/8ffdbad051/rank_0_0/backbone for vLLM's torch.compile
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:52 [backends.py:1155] Dynamo bytecode transform time: 9.53 s
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:52 [backends.py:1094] Using cache directory: /root/.cache/vllm/torch_compile_cache/8ffdbad051/rank_0_0/backbone for vLLM's torch.compile
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:52 [backends.py:1155] Dynamo bytecode transform time: 9.53 s
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:56 [backends.py:378] Cache the graph of compile range (1, 2048) for later use
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:56 [backends.py:378] Cache the graph of compile range (1, 2048) for later use
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:58 [backends.py:393] Compiling a graph for compile range (1, 2048) takes 5.77 s
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:58:58 [backends.py:393] Compiling a graph for compile range (1, 2048) takes 5.77 s
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:00 [decorators.py:708] saved AOT compiled function to /root/.cache/vllm/torch_compile_cache/torch_aot_compile/b68dab0d49da0c8f877964e68ddced248a227ec851f8e93b13e0819b0be6c086/rank_0_0/model
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:00 [monitor.py:53] torch.compile took 16.88 s in total
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:00 [decorators.py:708] saved AOT compiled function to /root/.cache/vllm/torch_compile_cache/torch_aot_compile/b68dab0d49da0c8f877964e68ddced248a227ec851f8e93b13e0819b0be6c086/rank_0_0/model
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:00 [monitor.py:53] torch.compile took 16.88 s in total
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:00 [monitor.py:81] Initial profiling/warmup run took 0.30 s
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:00 [monitor.py:81] Initial profiling/warmup run took 0.30 s
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:59:01 [kv_cache_utils.py:2177] GPU KV cache size: 1,778,288 tokens
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:59:01 [kv_cache_utils.py:2178] Maximum concurrency for 32,768 tokens per request: 54.27x
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:01 [gpu_worker.py:560] Available KV cache memory: 20.35 GiB
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:01 [gpu_worker.py:560] Available KV cache memory: 20.35 GiB
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:02 [cutedsl_warmup.py:101] Skipping CuTeDSL warmup because no compile units were requested.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:02 [cutedsl_warmup.py:101] Skipping CuTeDSL warmup because no compile units were requested.
Capturing CUDA graphs (PIECEWISE):   0%|          | 0/51 [00:00<?, ?it/s]
Capturing CUDA graphs (PIECEWISE):   0%|          | 0/51 [00:00<?, ?it/s]6) (RayWorkerProc pid=65043) (Worker pid=65043) 
Capturing CUDA graphs (PIECEWISE):  10%|▉         | 5/51 [00:00<00:01, 28.97it/s]
Capturing CUDA graphs (PIECEWISE):  10%|▉         | 5/51 [00:00<00:01, 28.97it/s]orkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE):  20%|█▉        | 10/51 [00:00<00:01, 37.50it/s]
Capturing CUDA graphs (PIECEWISE):  20%|█▉        | 10/51 [00:00<00:01, 37.50it/s]rkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE):  33%|███▎      | 17/51 [00:00<00:00, 47.91it/s]
Capturing CUDA graphs (PIECEWISE):  33%|███▎      | 17/51 [00:00<00:00, 47.91it/s]rkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE):  45%|████▌     | 23/51 [00:00<00:00, 51.07it/s]
Capturing CUDA graphs (PIECEWISE):  45%|████▌     | 23/51 [00:00<00:00, 51.07it/s]rkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE):  59%|█████▉    | 30/51 [00:00<00:00, 54.98it/s]
Capturing CUDA graphs (PIECEWISE):  59%|█████▉    | 30/51 [00:00<00:00, 54.98it/s]rkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE):  73%|███████▎  | 37/51 [00:00<00:00, 57.12it/s]
Capturing CUDA graphs (PIECEWISE):  73%|███████▎  | 37/51 [00:00<00:00, 57.12it/s]rkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE):  86%|████████▋ | 44/51 [00:00<00:00, 58.95it/s]
Capturing CUDA graphs (PIECEWISE):  86%|████████▋ | 44/51 [00:00<00:00, 58.95it/s]rkerProc pid=65043) 
Capturing CUDA graphs (PIECEWISE): 100%|██████████| 51/51 [00:00<00:00, 51.64it/s]
Capturing CUDA graphs (FULL):   0%|          | 0/35 [00:00<?, ?it/s]
Capturing CUDA graphs (PIECEWISE): 100%|██████████| 51/51 [00:00<00:00, 51.64it/s]rkerProc pid=65043) 
Capturing CUDA graphs (FULL):   0%|          | 0/35 [00:00<?, ?it/s]=64296) (RayWorkerProc pid=65043) (Worker pid=65043) 
Capturing CUDA graphs (FULL):   6%|▌         | 2/35 [00:00<00:01, 18.83it/s]
Capturing CUDA graphs (FULL):   6%|▌         | 2/35 [00:00<00:01, 18.83it/s](RayWorkerProc pid=65043) 
Capturing CUDA graphs (FULL):  26%|██▌       | 9/35 [00:00<00:00, 44.40it/s]
Capturing CUDA graphs (FULL):  26%|██▌       | 9/35 [00:00<00:00, 44.40it/s](RayWorkerProc pid=65043) 
Capturing CUDA graphs (FULL):  46%|████▌     | 16/35 [00:00<00:00, 52.91it/s]
Capturing CUDA graphs (FULL):  46%|████▌     | 16/35 [00:00<00:00, 52.91it/s]RayWorkerProc pid=65043) 
Capturing CUDA graphs (FULL):  63%|██████▎   | 22/35 [00:00<00:00, 44.01it/s]
Capturing CUDA graphs (FULL):  63%|██████▎   | 22/35 [00:00<00:00, 44.01it/s]RayWorkerProc pid=65043) 
Capturing CUDA graphs (FULL):  83%|████████▎ | 29/35 [00:00<00:00, 50.64it/s]
Capturing CUDA graphs (FULL):  83%|████████▎ | 29/35 [00:00<00:00, 50.64it/s]RayWorkerProc pid=65043) 
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:04 [model_runner.py:747] Graph capturing finished in 2 secs, took 0.41 GiB
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:04 [gpu_worker.py:857] Free memory on device (23.13/23.52 GiB) on startup. Desired GPU memory utilization is (0.92, 21.64 GiB). Actual usage is 0.93 GiB for weight, 0.26 GiB for peak activation, 0.1 GiB for non-torch memory, and 0.41 GiB for CUDAGraph memory. Replace gpu_memory_utilization config with `--kv-cache-memory=21249853666` (19.79 GiB) to fit into requested memory, or `--kv-cache-memory=22856568320` (21.29 GiB) to fully utilize gpu memory. Current kv cache memory in use is 20.35 GiB.
Capturing CUDA graphs (FULL): 100%|██████████| 35/35 [00:00<00:00, 49.24it/s]
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:04 [model_runner.py:747] Graph capturing finished in 2 secs, took 0.41 GiB
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:04 [gpu_worker.py:857] Free memory on device (23.13/23.52 GiB) on startup. Desired GPU memory utilization is (0.92, 21.64 GiB). Actual usage is 0.93 GiB for weight, 0.26 GiB for peak activation, 0.1 GiB for non-torch memory, and 0.41 GiB for CUDAGraph memory. Replace gpu_memory_utilization config with `--kv-cache-memory=21249853666` (19.79 GiB) to fit into requested memory, or `--kv-cache-memory=22856568320` (21.29 GiB) to fully utilize gpu memory. Current kv cache memory in use is 20.35 GiB.
Capturing CUDA graphs (FULL): 100%|██████████| 35/35 [00:00<00:00, 49.24it/s]RayWorkerProc pid=65043) 
(ServeController pid=61919) WARNING 2026-08-14 11:59:04,783 controller 61919 -- Deployment 'LLMServer:qwen-0_5b' in application 'default' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=61919) This may be caused by a slow __init__ or reconfigure method.
(RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:11 [jit_monitor.py:79] Kernel JIT monitor activated; monitored JIT compilations during inference will use mode=warn.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) (RayWorkerProc pid=65043) (Worker pid=65043) INFO 08-14 11:59:11 [jit_monitor.py:79] Kernel JIT monitor activated; monitored JIT compilations during inference will use mode=warn.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:59:11 [core.py:340] init engine (profile, create kv cache, warmup model) took 28.77 s (compilation: 16.88 s)
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) Warning: You are sending unauthenticated requests to the HF Hub. Please set a HF_TOKEN to enable higher rate limits and faster downloads.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:59:20 [vllm.py:1109] Asynchronous scheduling is enabled.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) (EngineCore pid=64296) INFO 08-14 11:59:20 [kernel.py:295] Final IR op priority after setting platform defaults: IrOpPriorityConfig(rms_norm=['native'], fused_add_rms_norm=['native'])
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) WARNING 08-14 11:59:20 [model.py:1546] Default vLLM sampling parameters have been overridden by the model's `generation_config.json`: `{'repetition_penalty': 1.1, 'temperature': 0.7, 'top_k': 20, 'top_p': 0.8}`. If this is not intended, please relaunch vLLM instance with `--generation-config vllm`.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 08-14 11:59:22 [hf.py:540] Detected the chat template content format to be 'string'. You can set `--chat-template-content-format` to override this.
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 11:59:22,925 default_LLMServer:qwen-0_5b kqnimn62 -- Started vLLM engine.
(pid=67341) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(pid=67341)   import pynvml  # type: ignore[import]
(ServeReplica:default:AnthropicIngress pid=61926) INFO 2026-08-14 11:59:32,848 default_AnthropicIngress i763jp1f 178d4f4d-8ab3-4635-9760-364998a841e3 -- POST /v1/messages 200 129876.8ms
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 11:59:32,846 default_LLMServer:qwen-0_5b kqnimn62 178d4f4d-8ab3-4635-9760-364998a841e3 -- CALL messages OK 242.2ms
INFO 2026-08-14 11:59:33,048 serve 60616 -- Application 'default' is ready at http://127.0.0.1:8000/.
(ServeReplica:default:AnthropicIngress pid=61926) INFO 2026-08-14 12:00:28,505 default_AnthropicIngress i763jp1f f9e40442-a2d8-460e-b9a5-7957b9625fc5 -- GET / 404 2.2ms
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 12:00:28,684 default_LLMServer:qwen-0_5b kqnimn62 9a041229-1885-40aa-b6cc-62c7919c18ad -- CALL messages OK 90.6ms
(ServeReplica:default:AnthropicIngress pid=61926) INFO 2026-08-14 12:00:28,687 default_AnthropicIngress i763jp1f 9a041229-1885-40aa-b6cc-62c7919c18ad -- POST /v1/messages 200 101.5ms
(ServeReplica:default:AnthropicIngress pid=61926) INFO 2026-08-14 12:00:28,738 default_AnthropicIngress i763jp1f eabae3ac-dd5c-4ae1-99e8-c39cb41ff53f -- GET / 404 1.8ms
(ServeReplica:default:AnthropicIngress pid=61926) INFO 2026-08-14 12:01:46,286 default_AnthropicIngress i763jp1f 4c4f943d-3dea-4d47-9262-cf1279ca224e -- POST /v1/messages 200 283.0ms
(ServeReplica:default:LLMServer:qwen-0_5b pid=62683) INFO 2026-08-14 12:01:46,284 default_LLMServer:qwen-0_5b kqnimn62 4c4f943d-3dea-4d47-9262-cf1279ca224e -- CALL messages OK 273.6ms

This sets up the ANTHROPIC_BASE_URL at: http://localhost:8000/v1/messages.

Anthropic API Tests Script
import os

from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["ANTHROPIC_API_KEY"],
    base_url=os.environ["ANTHROPIC_BASE_URL"],
)

prompts = [
    "Who is Anwar Ibrahim? Answer in one sentence.",
    "What is Ray Serve? Answer in one sentence.",
    "What is Ray Serve? Answer in one sentence.",
]

for prompt in prompts:
    print(f"\nPrompt: {prompt}")
    response = client.messages.create(
        model=os.environ["MODEL_ID"],
        max_tokens=128,
        messages=[{"role": "user", "content": prompt}],
    )

    for block in response.content:
        if block.type == "text":
            print(f"Response: {block.text}")
Anthropic API Tests Logs
root@e698b1650b1b:/# bash test_ray_anthropic_api.sh 
>>> Installing the Anthropic Python SDK...
Requirement already satisfied: anthropic in ./ray/.venv/lib/python3.12/site-packages (0.122.0)
Requirement already satisfied: anyio<5,>=3.5.0 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (4.14.2)
Requirement already satisfied: distro<2,>=1.7.0 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (1.9.0)
Requirement already satisfied: docstring-parser<1,>=0.15 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (0.18.0)
Requirement already satisfied: httpx<1,>=0.25.0 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (0.28.1)
Requirement already satisfied: jiter<1,>=0.4.0 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (0.16.0)
Requirement already satisfied: pydantic<3,>=1.9.0 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (2.13.4)
Requirement already satisfied: sniffio<2,>=1 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (1.3.1)
Requirement already satisfied: typing-extensions<5,>=4.14 in ./ray/.venv/lib/python3.12/site-packages (from anthropic) (4.16.0)
Requirement already satisfied: idna>=2.8 in ./ray/.venv/lib/python3.12/site-packages (from anyio<5,>=3.5.0->anthropic) (3.18)
Requirement already satisfied: certifi in ./ray/.venv/lib/python3.12/site-packages (from httpx<1,>=0.25.0->anthropic) (2026.7.22)
Requirement already satisfied: httpcore==1.* in ./ray/.venv/lib/python3.12/site-packages (from httpx<1,>=0.25.0->anthropic) (1.0.9)
Requirement already satisfied: h11>=0.16 in ./ray/.venv/lib/python3.12/site-packages (from httpcore==1.*->httpx<1,>=0.25.0->anthropic) (0.16.0)
Requirement already satisfied: annotated-types>=0.6.0 in ./ray/.venv/lib/python3.12/site-packages (from pydantic<3,>=1.9.0->anthropic) (0.8.0)
Requirement already satisfied: pydantic-core==2.46.4 in ./ray/.venv/lib/python3.12/site-packages (from pydantic<3,>=1.9.0->anthropic) (2.46.4)
Requirement already satisfied: typing-inspection>=0.4.2 in ./ray/.venv/lib/python3.12/site-packages (from pydantic<3,>=1.9.0->anthropic) (0.4.4)
>>> Querying http://127.0.0.1:8000/v1/messages with model qwen-0.5b...

Prompt: Who is Anwar Ibrahim? Answer in one sentence.
Response: Anwar Ibrahim is a prominent Malaysian politician and businessman who has served as the Prime Minister of Malaysiasince 2018. He was previously the Deputy Prime Minister from 2013 to 2018 and also holds other positions such as Minister for Finance and Minister for Health. Ibrahim is known for his economic reforms, including his efforts to liberalize the economyand increase investment in infrastructure and education.

Prompt: What is Ray Serve? Answer in one sentence.
Response: Ray Serve is an open-source framework designed to simplify the deployment and management of machine learning models using Ray's GPU-based parallel computing capabilities. It provides tools for deploying models across multiple nodes on GPUs, enabling efficient training and inference processes.

Prompt: What is Ray Serve? Answer in one sentence.
Response: Ray Serve is a distributed computing framework designed to efficiently process and deploy machine learning models across multiple servers or instances, enabling rapid experimentation with new algorithms and data sets while maintaining highperformance for real-time applications.

AI assistance

AI assistance was used during implementation. I reviewed the changed code and am responsible for understanding, testing, and maintaining it. Used Cursor: GPT-5.6 Sol, Cursor Grok 4.6

@wanadzhar913
wanadzhar913 requested review from a team as code owners August 14, 2026 14:20

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for the Anthropic Messages API and token counting endpoints, integrating them with the Ray Serve LLM engine and vLLM. It adds new ingress routing, Pydantic models, and helper utilities, alongside comprehensive tests. The review feedback highlights several critical robustness improvements, including handling potential null values and non-integer status codes in error translation, catching stream-time exceptions during message generation, gracefully handling empty generators or StopAsyncIteration in the ingress endpoints, and supporting string-based class names in configuration comparisons.

Comment on lines +15 to +25
def translate_error_response(response: ErrorResponse) -> JSONResponse:
anthropic_error = AnthropicErrorResponse(
error=AnthropicError(
type=response.error.type,
message=response.error.message,
)
)
return JSONResponse(
status_code=response.error.code,
content=anthropic_error.model_dump(exclude_none=True),
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Accessing properties on response.error without a None check violates defensive programming guidelines. Additionally, response.error.code can be a string or None in OpenAI/vLLM error responses, which will cause a runtime error in Starlette's JSONResponse since status_code must be an integer. We should safely convert the code to an integer and handle potential None values.

def translate_error_response(response: ErrorResponse) -> JSONResponse: 
    error_info = response.error
    if error_info is None:
        return JSONResponse(
            status_code=500,
            content={"error": {"type": "internal_error", "message": "An unknown error occurred."}},
        )

    try:
        status_code = int(error_info.code) if error_info.code is not None else 500
    except (ValueError, TypeError):
        status_code = 500

    anthropic_error = AnthropicErrorResponse(
        error=AnthropicError(
            type=error_info.type or "internal_error",
            message=error_info.message or "An unknown error occurred.",
        )
    )
    return JSONResponse(
        status_code=status_code,
        content=anthropic_error.model_dump(exclude_none=True),
    )

Comment on lines +733 to +740
if isinstance(messages_response, AsyncGenerator):
async for response in messages_response:
if not isinstance(response, str):
raise ValueError(
"Expected create_messages to return a stream of strings, "
f"got an item with type {type(response)}"
)
yield response

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Any exception raised during the iteration of the messages_response async generator (e.g., token generation errors, connection drops, or engine failures) will propagate uncaught because the async for loop is outside the try...except block. We should wrap the iteration in a try...except block to ensure all stream-time exceptions are properly caught and translated into error responses.

        if isinstance(messages_response, AsyncGenerator):
            try:
                async for response in messages_response:
                    if not isinstance(response, str):
                        raise ValueError(
                            "Expected create_messages to return a stream of strings, "
                            f"got an item with type {type(response)}"
                        )
                    yield response
            except Exception as e:
                yield self._make_error_response(self._anthropic_serving_messages, e)

Comment on lines +746 to +760
initial_response, gen = await _peek_at_generator(gen)

if isinstance(initial_response, ErrorResponse):
return translate_error_response(initial_response)

if isinstance(initial_response, str):

async def stream():
yield initial_response
async for item in gen:
yield item

return anthropic_messages_http_response(stream())

return anthropic_messages_http_response(initial_response)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

If the generator gen is empty, initial_response will be None. Passing None to anthropic_messages_http_response will result in an invalid StreamingResponse with None content, leading to a broken or hanging connection. We should explicitly handle the None case by raising an HTTPException.

            initial_response, gen = await _peek_at_generator(gen)

            if initial_response is None:
                raise HTTPException(
                    status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
                    detail="Engine returned an empty response.",
                )

            if isinstance(initial_response, ErrorResponse):
                return translate_error_response(initial_response)

            if isinstance(initial_response, str):

                async def stream():
                    yield initial_response
                    async for item in gen:
                        yield item

                return anthropic_messages_http_response(stream())

            return anthropic_messages_http_response(initial_response)

Comment on lines +774 to +775
results = model_handle.count_tokens.remote(body, raw_request_info)
result = await results.__anext__()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

await results.__anext__() can raise StopAsyncIteration if the generator is empty. This uncaught exception will bubble up and cause a 500 Internal Server Error. We should wrap it in a try...except StopAsyncIteration block to handle it gracefully.

Suggested change
results = model_handle.count_tokens.remote(body, raw_request_info)
result = await results.__anext__()
raw_request_info = RawRequestInfo.from_starlette_request(request)
results = model_handle.count_tokens.remote(body, raw_request_info)
try:
result = await results.__anext__()
except StopAsyncIteration:
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Engine did not return any response for token counting.",
)

Comment on lines +346 to +351
ingress_cls_config = builder_config.ingress_cls_config
if ingress_cls_config.ingress_cls == OpenAiIngress:
ingress_cls_config = IngressClsConfig(
ingress_cls=AnthropicIngress,
ingress_extra_kwargs=ingress_cls_config.ingress_extra_kwargs,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Direct comparison ingress_cls_config.ingress_cls == OpenAiIngress will fail if ingress_cls is configured as a string (e.g., "OpenAiIngress" or "ray.serve.llm.OpenAiIngress" in a YAML configuration file). This will prevent the application from automatically switching to AnthropicIngress, leading to 404 errors on the Anthropic endpoints. We should handle both class and string comparisons.

Suggested change
ingress_cls_config = builder_config.ingress_cls_config
if ingress_cls_config.ingress_cls == OpenAiIngress:
ingress_cls_config = IngressClsConfig(
ingress_cls=AnthropicIngress,
ingress_extra_kwargs=ingress_cls_config.ingress_extra_kwargs,
)
ingress_cls = ingress_cls_config.ingress_cls
if ingress_cls == OpenAiIngress or (isinstance(ingress_cls, str) and ingress_cls.endswith("OpenAiIngress")):
ingress_cls_config = IngressClsConfig(
ingress_cls=AnthropicIngress,
ingress_extra_kwargs=ingress_cls_config.ingress_extra_kwargs,
)

Comment on lines +376 to +381
ingress_cls_config = builder_config.ingress_cls_config
if ingress_cls_config.ingress_cls == OpenAiIngress:
ingress_cls_config = IngressClsConfig(
ingress_cls=AnthropicIngress,
ingress_extra_kwargs=ingress_cls_config.ingress_extra_kwargs,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Direct comparison ingress_cls_config.ingress_cls == OpenAiIngress will fail if ingress_cls is configured as a string (e.g., "OpenAiIngress" or "ray.serve.llm.OpenAiIngress" in a YAML configuration file). This will prevent the application from automatically switching to AnthropicIngress, leading to 404 errors on the Anthropic endpoints. We should handle both class and string comparisons.

Suggested change
ingress_cls_config = builder_config.ingress_cls_config
if ingress_cls_config.ingress_cls == OpenAiIngress:
ingress_cls_config = IngressClsConfig(
ingress_cls=AnthropicIngress,
ingress_extra_kwargs=ingress_cls_config.ingress_extra_kwargs,
)
ingress_cls_config = builder_config.ingress_cls_config
ingress_cls = ingress_cls_config.ingress_cls
if ingress_cls == OpenAiIngress or (isinstance(ingress_cls, str) and ingress_cls.endswith("OpenAiIngress")):
ingress_cls_config = IngressClsConfig(
ingress_cls=AnthropicIngress,
ingress_extra_kwargs=ingress_cls_config.ingress_extra_kwargs,
)

@ray-gardener ray-gardener Bot added serve Ray Serve Related Issue llm community-contribution Contributed by the community labels Aug 14, 2026

@eicherseiji eicherseiji left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @wanadzhar913, this is an exciting contribution! Please reach out on Ray Slack so we can land this


if isinstance(initial_response, str):

async def stream():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we stream gen directly here? _peek_at_generator() returns a replacement generator that already replays initial_response, so yielding it again duplicates the first SSE event—usually message_start—and produces an invalid event sequence for strict Anthropic clients.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Whoops, addressed!

DEFAULT_MAX_ONGOING_REQUESTS,
DEFAULT_MAX_TARGET_ONGOING_REQUESTS,
)
from ray.llm._internal.serve.core.configs.anthropic_api_models import (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we keep these vLLM-only imports off the SGLang import path, for example by loading them lazily on the Anthropic path? The supported SGLang image uninstalls vLLM, but ray.serve.llm imports the builder and then this module, so this raises before the existing OpenAI/SGLang code can load. This breaks TestSGLangProtocolDecoupling.test_modules_importable_without_vllm.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was wondering if we should just support SGLang off the bat in this PR (to be consistent with the vLLM path? If not, will refactor and keep vLLM-only imports off the SGLang import path.

default_ingress_options, builder_config.ingress_deployment_config
)

ingress_cls = make_fastapi_ingress(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we install Anthropic-specific validation and HTTPException handlers on this app? make_fastapi_ingress() currently uses the shared init() app, whose validation handler emits an OpenAI error envelope and whose default HTTP error response uses {"detail": ...}. As a result, malformed bodies and unknown-model errors on both Anthropic endpoints return incompatible response shapes instead of Anthropic error envelopes.

@wanadzhar913
wanadzhar913 force-pushed the ray-serve-llm/anthropic-messages-api branch from ea9fe11 to c808b56 Compare August 17, 2026 15:02
…tall Anthropic-specific validation and HTTPException handlers (init_anthropic_app)

Signed-off-by: wanadzhar913 <[email protected]>
@wanadzhar913
wanadzhar913 force-pushed the ray-serve-llm/anthropic-messages-api branch from c808b56 to 620f340 Compare August 17, 2026 16:51

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 620f340. Configure here.

AnthropicCountTokensRequest,
AnthropicCountTokensResponse,
AnthropicMessagesRequest,
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Eager Anthropic import breaks SGLang

High Severity

ingress.py eagerly imports anthropic_api_models, which hard-fails without vLLM, and builder.py pulls that ingress module into the shared ray.serve.llm import path. SGLang-only installs that previously loaded OpenAI Serve LLM now fail before any Anthropic endpoint is used.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 620f340. Configure here.

@eicherseiji

eicherseiji commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

For visibility, mirroring the discussion from Ray Slack: /v1/messages and /v1/messages/count_tokens are already served when RAY_SERVE_LLM_ENABLE_DIRECT_STREAMING=1. In that mode LLMServer serves vLLM's native ASGI app, and vLLM attaches its Anthropic router, including Anthropic-formatted error responses, to that app.

@wanadzhar913 would you be able to validate that mode against a real Claude Code client and report whether it is sufficient? Two considerations worth noting in advance: tool calling requires enable_auto_tool_choice and a matching tool_call_parser in engine_kwargs, and direct streaming currently supports a single model per application. HAProxy is not required; the environment variable alone is sufficient.

If that path works end to end, the remaining gap is test coverage and documentation rather than ingress plumbing, and we should scope this PR accordingly.

@wanadzhar913

wanadzhar913 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Findings

Hi @eicherseiji, yeahp you're right. It works out of the box with RAY_SERVE_LLM_ENABLE_DIRECT_STREAMING=1 (though based on my testing, you'd still need to run it with RAY_SERVE_ENABLE_HA_PROXY=1 as I got an error when I left it out.

Some gaps I found:

  • on HAProxy: The direct streaming branch unconditionally attaches an ingress request router (builder.py, _with_ingress_request_router), and build_app.py raises INGRESS_REQUEST_ROUTER_REQUIRES_HAPROXY_ERROR unless RAY_SERVE_ENABLE_HA_PROXY=1.

    HAProxy error log
    (.venv) root@bea9100ba116:/workspace# serve run config.yaml 
    2026-08-19 17:09:33,769 INFO scripts.py:480 -- Running config file: 'config.yaml'.
    2026-08-19 17:09:33,794 INFO worker.py:1833 -- Connecting to existing Ray cluster at address: 172.24.0.2:6379...
    2026-08-19 17:09:33,803 INFO worker.py:2024 -- Connected to Ray cluster.
    (ProxyActor pid=10637) INFO 2026-08-19 17:09:44,920 proxy 172.24.0.2 -- Proxy starting on node d593ec535d940b6014d7356a9be717c29c5ede2ee672b92c74b7b970 (HTTP port: 8000).
    INFO 2026-08-19 17:09:45,159 serve 10489 -- Started Serve in namespace "serve".
    2026-08-19 17:09:45,166 SUCC scripts.py:537 -- Submitted deploy config successfully.
    (ServeController pid=10625) INFO 2026-08-19 17:09:45,161 controller 10625 -- Deploying new app 'anthropic-direct'.
    (ServeController pid=10625) INFO 2026-08-19 17:09:45,161 controller 10625 -- Importing and building app 'anthropic-direct'.
    (ProxyActor pid=10637) INFO 2026-08-19 17:09:45,156 proxy 172.24.0.2 -- Got updated endpoints: {}.
    (build_serve_application pid=10634) INFO 2026-08-19 17:09:48,537 controller build_anthropic-direct_10634 -- Importing application 'anthropic-direct' with arguments {'llm_configs': [{'model_loading_config': {'model_id': 'claude-sonnet-4-5-20250929', 'model_source': 'Qwen/Qwen3-8B'}, 'deployment_config': {'autoscaling_config': {'min_replicas': 1, 'max_replicas': 1}}, 'engine_kwargs': {'enable_auto_tool_choice': True, 'tool_call_parser': 'hermes', 'reasoning_parser': 'qwen3', 'max_model_len': 32768, 'gpu_memory_utilization': 0.9, 'tensor_parallel_size': 1, 'enable_prefix_caching': True}, 'runtime_env': {'env_vars': {'HF_TOKEN': '', 'VLLM_DISABLE_COMPILE_CACHE': '1'}}}]}.
    (build_serve_application pid=10634) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
    (build_serve_application pid=10634)   import pynvml  # type: ignore[import]
    (build_serve_application pid=10634) INFO 2026-08-19 17:10:44,492 controller build_anthropic-direct_10634 -- ============== Deployment Options ==============
    (build_serve_application pid=10634) INFO 2026-08-19 17:10:44,493 controller build_anthropic-direct_10634 -- {'autoscaling_config': {'max_replicas': 1,
    (build_serve_application pid=10634)                         'min_replicas': 1,
    (build_serve_application pid=10634)                         'target_ongoing_requests': 1000000000},
    (build_serve_application pid=10634)  'health_check_period_s': 10,
    (build_serve_application pid=10634)  'health_check_timeout_s': 10,
    (build_serve_application pid=10634)  'max_ongoing_requests': 1000000000,
    (build_serve_application pid=10634)  'name': 'LLMServer:claude-sonnet-4-5-20250929',
    (build_serve_application pid=10634)  'placement_group_bundles': [{'CPU': 1, 'GPU': 1}],
    (build_serve_application pid=10634)  'placement_group_strategy': 'PACK',
    (build_serve_application pid=10634)  'ray_actor_options': {'runtime_env': {'env_vars': {'HF_TOKEN': '',
    (build_serve_application pid=10634)                                                     'VLLM_DISABLE_COMPILE_CACHE': '1'},
    (build_serve_application pid=10634)                                        'worker_process_setup_hook': 'ray.llm._internal.serve._worker_process_setup_hook'}},
    (build_serve_application pid=10634)  'request_router_config': RequestRouterConfig(request_router_class='ray.serve.experimental.round_robin_router.RoundRobinRouter', request_router_kwargs={}, request_routing_stats_period_s=10, request_routing_stats_timeout_s=30, initial_backoff_s=0.025, backoff_multiplier=2, max_backoff_s=0.5)}
    (build_serve_application pid=10634) INFO 2026-08-19 17:10:44,504 controller build_anthropic-direct_10634 -- Direct streaming enabled: LLMServer=ingress, LLMRouter=ingress_request_router
    (ServeController pid=10625) ERROR 2026-08-19 17:10:44,597 controller 10625 -- Deploying app 'anthropic-direct' failed with exception:
    (ServeController pid=10625) `ingress_request_router` requires HAProxy. Set `RAY_SERVE_ENABLE_HA_PROXY=1` in the Ray controller's environment.
  • vLLM does attach Anthropic-shaped errors, but not faithfully. Exceeding the context window returns HTTP 500 with "type": "internal_error" where the real API returns 400 invalid_request_error. Because it's a 5xx, Claude Code treats it as transient and burns ten retries on a request that can never succeed. thinking block signatures are also uuid.uuid4().hex rather than real signatures. Both look like upstream vLLM issues.

    internal_error raised instead of invalid_request_error

    I encountered this error when I misconfigured the model's max_model_len parameter.

     500 {"type":"error","error":{"type":"internal_error","message":"This model's maximum context length 
         is 32768 tokens. However, you requested 32000 output tokens and your prompt contains at least 769   
         input tokens, for a total of at least 32769 tokens. Please reduce the length of the input prompt or 
         the number of requested output tokens. (parameter=input_tokens, value=769)"}}                       
         Retrying in 7 seconds… (attempt 6/10) 
  • Oh also, multi-model apps, LoRA multiplexing, and ingress_deployment_config all remain unavailable for Anthropic if we use this route, since direct streaming supports none of them. Will this be worked on in another PR? Would love to work on this (if on the roadmap).

Proposed Scope

That said, as you said, happy to proceed with your proposed scope to drop the ingress plumbing, and land docs plus regression tests instead. Docs would cover:

  • pointing Anthropic clients at a direct-streaming deployment, the two required env vars, the enable_auto_tool_choice / tool_call_parser requirement, and the one-model-per-app limit.
  • Tests would assert that the ASGI app from VLLMEngine.build_asgi_app exposes POST /v1/messages and /v1/messages/count_tokens; nothing in Ray currently pins that, so a vLLM upgrade could silently drop it.

Let me know how to proceed.

Test Setup & Configs

Environment

  • Driver Version: 580.126.09
  • CUDA Version: 13.0
  • GPU: NVIDIA H100 80GB HBM3
  • Ray branch/commit: master/49cc4c54dc954c2ef9dea8bfdbebe87a008b40cd
  • ray-haproxy==2.8.25 & vllm==0.26.0
  • Model used: Qwen/Qwen3-8B

Claude Setup

export ANTHROPIC_BASE_URL=$BASE_URL
export ANTHROPIC_AUTH_TOKEN=dummy
export ANTHROPIC_MODEL=claude-sonnet-4-5-20250929
claude

Ray Serve LLM commands

export RAY_SERVE_LLM_ENABLE_DIRECT_STREAMING=1
export RAY_SERVE_ENABLE_HA_PROXY=1
ray start --head --disable-usage-stats
serve run config.yaml
config.yaml
applications:
- name: anthropic-direct
  route_prefix: /
  import_path: ray.serve.llm:build_openai_app
  args:
    llm_configs:
    - model_loading_config:
        model_id: claude-sonnet-4-5-20250929
        model_source: Qwen/Qwen3-8B

      deployment_config:
        autoscaling_config:
          min_replicas: 1
          max_replicas: 1

      engine_kwargs:
        enable_auto_tool_choice: true
        tool_call_parser: hermes
        reasoning_parser: qwen3
        hf_overrides:
            rope_scaling:
              rope_type: yarn
              factor: 4.0
              original_max_position_embeddings: 32768
        max_model_len: 131072
        gpu_memory_utilization: 0.90
        tensor_parallel_size: 1
        enable_prefix_caching: true

      runtime_env:
        env_vars:
          HF_TOKEN: ""
          VLLM_DISABLE_COMPILE_CACHE: "1"

Results & Output

Claude Code Output

I ran simple tasks for Claude to:

  • write "hello world" in python
  • write an LRU cache in go
faiq0913@MSI:~/TEMP/test_claude_code$ claude                                                             
╭─── Claude Code v2.1.235 ──────────────────────────────────────────────────────────────────────────────╮
│                                    │ Tips for getting started                                         │
│            Welcome back!           │ Ask Claude to create a new app or clone a repository             │
│                                    │ ──────────────────────────────────────────────────────────────── │
│               ▐▛███▜▌              │ What's new                                                       │
│              ▝▜█████▛▘             │ Added an optional `spellcheck` setting that underlines misspell… │
│                ▘▘ ▝▝               │ Fixed whole-prompt-cache invalidation when a language server di… │
│                                    │ Fixed nested markdown list items misaligning at depth 3+ and ad… │
│   Sonnet 4.5 · API Usage Billing   │ /release-notes for more                                          │
│      ~/TEMP/test_claude_code       │                                                                  │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯


❯ hi!                                                                                                    

  Thought for 3s (ctrl+o to expand)

● Hello! How can I assist you today?
   
✻ Worked for 3s
     
❯ Can you create a python script that says hello world for me?                                           

  Thought for 5s (ctrl+o to expand)

● Write(hello_world.py)
  ⎿  Wrote 1 line to hello_world.py
      1 print("Hello, world!")

● <think>
  </think>

  The "hello_world.py" file has been created with the content:

  print("Hello, world!")

  Would you like me to run this script and show you the output?

✻ Cogitated for 8s

❯ Sure!                                                                                                  

  Thought for 4s (ctrl+o to expand)

● Bash(python /home/faiq0913/TEMP/test_claude_code/hello_world.py)
  ⎿  Error: Exit code 127
     /bin/bash: line 1: python: command not found

● <think>
  Okay, the user wanted me to run the hello_world.py script, but the Bash command returned an exit code
  127, which means the 'python' command wasn't found. Hmm, that's a problem. Let me think about why that
  happened.

  First, I should check if Python is installed on the system. Since the user is on Linux, maybe they
  don't have Python 3 installed or it's not in their PATH. Alternatively, the command might be 'python3'
  instead of 'python'.

  I need to inform the user about the error and suggest possible solutions. Maybe they need to install
  Python or use the correct command. Let me verify the system's Python version. If Python is installed,
  the error might be due to the command being 'python3'.

  I should also check the file path to ensure the script is correctly located. The script was written to
  /home/faiq0913/TEMP/test_claude_code/hello_world.py, so the path is correct.

  Wait, the user might not have Python installed. Let me check the system's package manager. If they're
  using a package like apt, they can install Python with 'sudo apt install python3'. Alternatively, if
  they need to use Python 3, the command should be 'python3' instead of 'python'.

  I should respond by explaining the error and providing the correct command. Also, mention the
  installation if needed. Let me structure the response to be helpful and guide them to the solution.
  </think>

  The script was created, but the system doesn't have Python installed. Let me know if you'd like me to:
  1. Suggest installing Python (e.g., sudo apt install python3 for Debian-based systems)
  2. Modify the script to use a different language (like shell script)
  3. Help you set up a Python environment

  What would you prefer?

✻ Sautéed for 10s

❯ Can you try and use python3                                                                            

  Thought for 4s (ctrl+o to expand)

● Bash(python3 /home/faiq0913/TEMP/test_claude_code/hello_world.py)
  ⎿  Hello, world!
   
● <think>
  Okay, the user asked to run the Python script using python3. I changed the command from python to
  python3, and it worked. The output was "Hello, world!".

  Now, the user might be satisfied with the result. But I should check if they need anything else. Since
  they just wanted the script to run, and it did, maybe they're done. Alternatively, they might want to
  modify the script or run it again. But the response was positive, so I'll confirm the success and offer
  further help.

  I need to keep the response concise. Let me just say the script ran successfully and ask if they need
  more assistance.
  </think>

  The script ran successfully using Python 3! The output is:

  Hello, world!

  Would you like to make any changes to the script or need help with anything else?

✻ Crunched for 7s

❯ Can you write me a go script that implements LRU cache? and test scripts.                              

  Thought for 12s (ctrl+o to expand)

● Write(lru_cache.go)
  ⎿  Wrote 116 lines to lru_cache.go
       1 package main
       2 
       3 import (
       4   "container/list"
       5   "fmt"
       6   "sync"
       7 )
       8
       9 // LRUCache implements a thread-safe LRU cache
      10 type LRUCache struct {
     … +106 lines (ctrl+o to expand)

● <think>
  Okay, the user asked for a Go script that implements an LRU cache and test scripts. I created the
  lru_cache.go file with the implementation and a TestLRUCache function. Now, I need to write the test
  script. Wait, the user might want separate test files, but the current code has the test in the same
  file. Let me check the code again.

  In the previous response, I wrote the test functions within the lru_cache.go file. That's not standard
  practice. Typically, tests are in a separate file with _test.go suffix. So I should correct that. Let
  me move the test code to a new file called lru_cache_test.go. Also, the test function should be inside
  a function named TestLRUCache, which is the standard naming convention in Go.

  Wait, the user might not have the test file yet. So I need to create lru_cache_test.go. Let me adjust
  the code to separate the implementation and tests. The main package should have the LRU cache struct,
  and the test file will have the test functions. Also, the test functions need to be in the testing
  package, so I'll need to import "testing" and use the testing framework.

  Let me rewrite the test code in a separate file. The test functions will use t.Run for subtests. Also,
  the test should check for the expected behavior, like evictions and correct values. I'll need to make
  Wait, the user might not have the test file yet. So I need to create lru_cache_test.go. Let me adjust
  the code to separate the implementation and tests. The main package should have the LRU cache struct,
  and the test file will have the test functions. Also, the test functions need to be in the testing
  package, so I'll need to import "testing" and use the testing framework.

  Let me rewrite the test code in a separate file. The test functions will use t.Run for subtests. Also,
  the test should check for the expected behavior, like evictions and correct values. I'll need to make
  sure the test file is properly structured. Then, I can suggest running the tests using "go test" in the
  terminal.
  package, so I'll need to import "testing" and use the testing framework.

  Let me rewrite the test code in a separate file. The test functions will use t.Run for subtests. Also,
  the test should check for the expected behavior, like evictions and correct values. I'll need to make
  sure the test file is properly structured. Then, I can suggest running the tests using "go test" in the
  terminal.

  Let me rewrite the test code in a separate file. The test functions will use t.Run for subtests. Also,
  the test should check for the expected behavior, like evictions and correct values. I'll need to make
  sure the test file is properly structured. Then, I can suggest running the tests using "go test" in the
  terminal.
  Let me rewrite the test code in a separate file. The test functions will use t.Run for subtests. Also,
  the test should check for the expected behavior, like evictions and correct values. I'll need to make
  sure the test file is properly structured. Then, I can suggest running the tests using "go test" in the
  terminal.
  sure the test file is properly structured. Then, I can suggest running the tests using "go test" in the
  terminal.
  terminal.
  a function named TestLRUCache, which is the standard naming convention in Go.


  Wait, the user might not have the test file yet. So I need to create lru_cache_test.go. Let me adjust
  the code to separate the implementation and tests. The main package should have the LRU cache struct,
  Wait, the user might not have the test file yet. So I need to create lru_cache_test.go. Let me adjust
  the code to separate the implementation and tests. The main package should have the LRU cache struct,
  the code to separate the implementation and tests. The main package should have the LRU cache struct,
  and the test file will have the test functions. Also, the test functions need to be in the testing
  and the test file will have the test functions. Also, the test functions need to be in the testing

  Let me rewrite the test code in a separate file. The test functions will use t.Run for subtests. Also,
  sure the test file is properly structured. Then, I can suggest running the tests using "go test" in the
  terminal.

  Wait, the user might not have the necessary setup. But since they asked for a script, I'll assume they
  have Go installed. Let me create the test file with the correct structure. Then, I'll use the Bash tool
  to run the tests. If there's an error, I'll let them know. Also, I should mention that they need to
  have the test file in the correct directory and that they can run the tests with "go test".
  </think>
  ⎿  Error writing file
  ⎿  Found 1 new diagnostic issue in 1 file (ctrl+o to expand)

● <think>
  Okay, let me figure out what went wrong here. The user asked for a Go script implementing an LRU cache
  and test scripts. I tried to create the test file but got a JSON parsing error. Then, there's a syntax
  error in lru_cache.go on line 67, column 29, where a semicolon was expected but a string was found.

  Looking at the code I wrote for lru_cache.go, the issue might be in the String() method. The original
  code had a line where it was trying to print the cache, but the syntax was incorrect. Specifically, the
  line "result += fmt.Sprintf("%v: %v\n", elem.Value, c.cache[elem.Value])" might have a mistake. Wait,
  in Go, when you use fmt.Sprintf, the format string needs to have the correct placeholders. The user's
  code might have a typo or incorrect formatting.

  Wait, the error message says "expected ';', found string (syntax)" at line 67. Let me check the code
  again. Oh, I see! The original code had a line where the string was not properly formatted. The line
  "result += fmt.Sprintf("%v: %v\n", elem.Value, c.cache[elem.Value])" might have a missing closing quote
  or a syntax error. Wait, no, the quotes are there. Maybe the issue is with the way the code was
  generated. Let me check the code again.

  Wait, the user's code in lru_cache.go has a String() method that's supposed to return a string
  representation of the cache. The line "result += fmt.Sprintf("%v: %v\n", elem.Value,
  c.cache[elem.Value])" might have a mistake. Oh, right! The key in the cache is stored as a string, but
  the value is an interface{}. So when accessing c.cache[elem.Value], if elem.Value is not a string, this
  would cause a type mismatch. Wait, no, the key is stored as a string, so maybe that's not the issue.

  Wait, the error is a syntax error, not a runtime error. Let me check the code for any missing
  semicolons. In Go, each statement must end with a semicolon. The line "result += fmt.Sprintf("%v:
  %v\n", elem.Value, c.cache[elem.Value])" might be missing a semicolon. Wait, no, in Go, the += operator
  doesn't require a semicolon. But maybe there's a missing closing parenthesis or a misplaced comma. Let
  me check the code again.

  Wait, the original code I wrote for lru_cache.go had the String() method with a loop. The line "result
  += fmt.Sprintf("%v: %v\n", elem.Value, c.cache[elem.Value])" might have a typo. Oh, I see! The format
  string is using %v for both the key and value, but the second %v is trying to access
  c.cache[elem.Value], which is a map from interface{} to *list.Element. So when we do
  c.cache[elem.Value], we're getting a *list.Element, not the value. That's a mistake. The String()
  method should be printing the key-value pairs, but it's currently printing the key and the element, not
  the value.

  So the error is in the String() method. The code is trying to access the value from the cache, but the
  cache's values are *list.Element, not the actual stored values. Therefore, the line
  "c.cache[elem.Value]" is incorrect. Instead, the value should be stored in the element's Value field.
  Wait, in the LRU cache implementation, when we put a key-value pair, we set elem.Value = value. So in
  the String() method, when iterating through the list, each elem.Value is the stored value. But in the
  code, the line "c.cache[elem.Value]" is trying to get the value from the cache using the key, which is
  elem.Value. That's not correct because elem.Value is the value, not the key. The key is stored in the
  cache, and the value is in the element's Value field. So the correct way is to get the value from
  elem.Value, not from the cache.

  Therefore, the String() method should be using elem.Value directly. Let me correct that. The line
  should be "result += fmt.Sprintf("%v: %v\n", elem.Value, elem.Value)"? Wait, no. Wait, the key is
  stored in the cache, and the value is in the element's Value. So when iterating through the list, each
  element's Value is the value stored for that key. So the String() method should print the key and the
  value. But the key is stored in the cache, and the element's Value is the value. Wait, no. The cache is
  a map from keys to elements. So when we have an element, the key is the key in the map, and the value
  is stored in the element's Value. So to get the key, we need to use the key from the map, not the
  element's Value. Wait, this is confusing. Let me think again.

  In the LRUCache struct, the cache is a map from interface{} (keys) to *list.Element. The list elements
  contain the values. So when we iterate through the list, each element's Value is the value stored for
  that key. But to get the key, we need to look up in the cache. Wait, no. The list elements are ordered,
  and each element's Value is the value. The keys are stored in the map, and the elements are linked to
  those keys. So when we iterate through the list, the key is the key in the map, and the value is the
  element's Value. Wait, no. The list elements are pointers to the values, but the keys are stored in the
  map. So to print the key and value, we need to get the key from the map and the value from the
  element. But that's not possible because the element's Value is the value, and the key is stored in the
  map. Wait, maybe the code is incorrect in how it's storing the values. Let me check the Put method.

  In the Put method, when a new key is added, it does c.list.PushFront(key) and c.cache[key] =
  c.list.Front(). Wait, that's a mistake. The key is being stored in the cache, but the value should be
  stored in the element's Value. So when adding a new key, the element's Value should be the value, not
  the key. The current code is setting the element's Value to the key, which is wrong. That's the root
  cause. The String() method is trying to get the value from the element's Value, but the code is storing
  the key there. So the String() method is using elem.Value, which is the key, and then trying to get
  the value from c.cache[elem.Value], which is a *list.Element, not the value. That's why the syntax
  error is happening.

  So the fix is to correct the Put method to store the value in the element's Value. Let me adjust that.
  Also, the String() method should iterate through the list and collect the key-value pairs correctly.
  Let me rewrite the Put method to set the element's Value to the actual value, not the key. Then, in the
  String() method, for each element, the key is the key in the cache, and the value is elem.Value. Wait,
  but the cache's keys are the keys, and the elements are linked to those keys. So when iterating
  through the list, the key is the key in the cache, and the value is the element's Value. But how to get
  the key from the element? The element's Value is the value, not the key. So the code is incorrect
  here. The keys are stored in the cache, and the elements are linked to the keys. So the String() method
  should iterate through the list, and for each element, get the key from the cache and the value from
  the element's Value. But that's not possible because the element's Value is the value, and the key is
  stored in the cache. So the code needs to be adjusted to store the value in the element's Value, and
  the key in the cache. Then, in the String() method, for each element, the key is the key in the cache,
  and the value is the element's Value. But how to get the key from the element? The element's Value is
  the value, so the key is stored in the cache, and the elements are linked to the keys. Therefore, the
  String() method should loop through the list, and for each element, get the key from the cache using
  the element's Value as the key? No, that's not right. Wait, maybe the code is structured incorrectly.
  The cache is a map from keys to elements, and each element's Value is the value. So when you have an
  element, the key is the key in the map, and the value is elem.Value. But how to get the key from the
  element? The element's Value is the value, not the key. So the String() method is trying to print the
  key and value, but the key is stored in the cache, and the value is in the element. Therefore, the code
  is incorrect. The String() method should iterate through the list, and for each element, get the key
  from the cache and the value from the element. But that's not possible because the element's Value is
  the value, and the key is stored in the cache. So the code is wrong in how it's storing the values. The
  Put method should set the element's Value to the actual value, not the key. Then, in the String()
  method, we can loop through the list and collect the key and value pairs. Wait, but the key is stored
  in the cache, so when iterating through the list, the key is the key in the cache, and the value is the
  element's Value. So the String() method should be using the key from the cache and the value from the
  element. But how to get the key from the element? The element's Value is the value, so the key is
  stored in the cache. Therefore, the code is incorrect. The String() method is trying to access
  c.cache[elem.Value], which is a *list.Element, but it's using that as the value. That's the mistake.
  The correct approach is to store the value in the element's Value, and the key in the cache. Then, in
  the String() method, for each element, the key is the key in the cache, and the value is elem.Value.
  But how to get the key from the element? The element's Value is the value, so the key is stored in the
  cache. Therefore, the String() method should be using the key from the cache and the value from the
  element. Wait, this is getting complicated. Maybe the initial implementation has a flaw. Let me correct
  the Put method to store the value in the element's Value. Then, in the String() method, I can loop
  through the list and for each element, get the key from the cache and the value from the element. But
  that would require knowing the key for each element, which is stored in the cache. So the code should
  be adjusted to store the value in the element's Value, and the key in the cache. Then, in the String()
  method, for each element, the key is the key in the cache, and the value is elem.Value. But how to get
  the key from the element? The element's Value is the value, so the key is stored in the cache.
  Therefore, the String() method should be using the key from the cache and the value from the element.
  Wait, this is not possible because the element's Value is the value, and the key is stored in the
  cache. So the String() method can't directly get the key from the element. That's a problem. Maybe the
  code should store the key in the element's Value, but that's not standard. Alternatively, the String()
  method can loop through the list and for each element, get the key from the cache using the element's
  Value as the key? No, that's not right. The element's Value is the value, so the key is stored in the
  cache. Therefore, the String() method can't directly get the key from the element. This suggests that
  the initial implementation is incorrect. The correct approach is to store the value in the element's
  Value, and the key in the cache. Then, when iterating through the list, the key is the key in the
  cache, and the value is the element's Value. But how to get the key from the element? It's not possible
  unless the element's Value contains the key-value pair. So maybe the code should be adjusted to store
  the key-value pairs in the element's Value. Let me restructure the code. The Put method should create a
  new element with the key and value, and store the element in the cache. Then, in the String() method,
  for each element, we can get the key and value from the element's Value. Wait, but in Go, the
  list.Element's Value is a single value. So perhaps the code should store the value in the element's
  Value, and the key is stored in the cache. Then, in the String() method, for each element, the key is
  the key in the cache, and the value is elem.Value. But that requires knowing the key for each element,
  which is stored in the cache. So the String() method would need to loop through the list and for each
  element, get the key from the cache using the element's Value as the key? No, that's not correct. The
  element's Value is the value, not the key. So the String() method is incorrect. It should be using the
  key from the cache and the value from the element. But since the element's Value is the value, the key
  is stored in the cache. Therefore, the String() method can't directly get the key from the element.
  This is a design flaw in the initial code. To fix this, the element's Value should be a struct
  containing both the key and value. Alternatively, the cache should store the key-value pairs in the
  elements. Let me adjust the code to store the key and value in the element's Value. That way, the
  String() method can iterate through the list and print each key-value pair. So in the Put method, when
  adding a new element, we create a struct with the key and value, and set that as the element's Value.
  Then, in the String() method, we can loop through the list and for each element, extract the key and
  value from the struct. This would fix the syntax error and the incorrect data retrieval. Let me rewrite
  the code accordingly.
  </think>

● Update(lru_cache.go)
  ⎿  Added 1 line, removed 1 line
      70  
      71    result := ""
      72    for elem := c.list.Front(); elem != nil; elem = elem.Next() {
      73 -    result += fmt.Sprintf("%v: %v\n", elem.Value, c.cache[elem.Value])                  
      73 +    result += fmt.Sprintf("%v: %v\n", key, elem.Value)                                  
      74    }
      75    return result
      76  }

● <think>
  Okay, let me see. The user asked for an LRU cache implementation in Go along with test scripts. I tried
  to create the test file but got a JSON parsing error. Then, there was a syntax error in the
  lru_cache.go file. The error was in the String() method where it was trying to access
  c.cache[elem.Value], which is incorrect because elem.Value is the value, not the key. So I fixed that
  by changing the line to use the key from the cache and the value from the element.

  Wait, but the user's code had a line where they were using elem.Value as the key. That's not right. The
  key should be stored in the cache, and the element's Value is the actual value. So in the String()
  method, I need to get the key from the cache and the value from the element. But how? Because the
  element's Value is the value, and the key is stored in the cache. So maybe the code should iterate
  through the list and for each element, get the key from the cache using the element's Value as the key?
  No, that's not correct. The element's Value is the value, so the key is stored in the cache.
  Therefore, the String() method needs to loop through the list and for each element, get the key from
  the cache and the value from the element. But the code as written doesn't do that. The original code
  had a mistake where it was trying to get the value from the cache using the element's Value as the key,
  which was incorrect.

  So the fix was to replace that line with something that correctly retrieves the key and value. But how
  to get the key from the element? The element's Value is the value, so the key must be stored elsewhere.
  Wait, maybe the initial implementation was flawed. Let me think again. In the LRUCache struct, the
  cache is a map from keys to elements. So when you have an element, the key is the key in the map, and
  the element's Value is the value. Therefore, to get the key, you need to look it up in the cache. But
  that's not possible unless you have the key. So the String() method can't directly get the key from the
  element. This suggests that the initial code was incorrect. The correct approach is to store the
  key-value pairs in the element's Value, perhaps as a struct. Then, in the String() method, you can
  iterate through the list and for each element, extract the key and value from the struct.

  Wait, but the user's code didn't do that. They had the Put method setting the element's Value to the
  key, which was wrong. So the String() method was trying to print the key and the element's Value, which
  was the key again. That's why the syntax error occurred. The fix was to correct the Put method to
  store the value in the element's Value, and then adjust the String() method to use the key from the
  cache. But how to get the key from the cache when iterating through the list? The key is stored in the
  cache, so for each element in the list, the key is the key in the cache. Therefore, the String() method
  should loop through the list and for each element, get the key from the cache using the element's
  Value as the key? No, that's not right. The element's Value is the value, not the key. So the key is
  stored in the cache, and the element's Value is the value. Therefore, the String() method can't get the
  key from the element. This indicates that the initial code was incorrect, and the fix requires
  restructuring the code to store both key and value in the element.

  Wait, maybe the user's code had a mistake in the Put method. Let me check. In the Put method, when a
  new key is added, it does c.list.PushFront(key) and c.cache[key] = c.list.Front(). That's incorrect
  because the element's Value should be the value, not the key. So the key is stored in the cache, and
  the element's Value is the value. Therefore, the String() method needs to loop through the list and for
  each element, get the key from the cache and the value from the element. But how? The element's Value
  is the value, so the key is stored in the cache. So for each element in the list, the key is the key
  that was used to store it in the cache. Therefore, the String() method should iterate through the list
  and for each element, get the key from the cache using the element's Value as the key? No, that's not
  correct. The element's Value is the value, so the key is stored in the cache. Therefore, the String()
  method can't get the key from the element. This is a problem. The initial code was incorrect, and the
  fix requires a different approach.

  Perhaps the correct way is to store the key and value in the element's Value as a struct. Then, in the
  String() method, each element's Value is a struct with Key and Value fields. That way, when iterating
  through the list, you can access both the key and value. Let me adjust the code accordingly. In the Put
  method, create a struct with Key and Value, and set that as the element's Value. Then, in the String()
  method, for each element, extract Key and Value from the struct. This would fix the syntax error and
  allow the String() method to correctly display the key-value pairs.

  So, I need to modify the code to use a struct for the element's Value. Let me make that change. Also,
  the test cases should be updated to check for the correct behavior. Once the code is fixed, the
  String() method should work as intended, and the tests should pass. Let me proceed with these changes.
  </think>

● Bash(go test -v /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go)

  So, I need to modify the code to use a struct for the element's Value. Let me make that change. Also,
  the test cases should be updated to check for the correct behavior. Once the code is fixed, the
  String() method should work as intended, and the tests should pass. Let me proceed with these changes.
  </think>

● Bash(go test -v /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go)
  ⎿  Error: Exit code 1
     go: go.mod file not found in current directory or any parent directory; see 'go help modules'

● <think>
  Okay, the user is trying to run the Go tests for the LRU cache implementation, but they're getting an
  error about the go.mod file not being found. Let me figure out what's going on here.

  First, the error message says "go: go.mod file not found in current directory or any parent directory;
  see 'go test help modules'". This indicates that the Go module isn't set up correctly. The go.mod file
  is necessary for Go modules, which are used to manage dependencies and version control. Since the user
  hasn't created a go.mod file, the test is failing.

  So, the next step is to help the user create a go.mod file. The go.mod file typically has the module
  name and the Go version. The module name is usually the directory name, so in this case, it would be
  "github.com/user/lru_cache" or something similar. But since the user might not have a GitHub
  repository, maybe a simple module name like "example.com/lru_cache" would work. The Go version is
  usually set to the latest stable version, but the user might need to specify it.

  I should use the Bash tool to run "go mod init" to create the go.mod file. The command "go mod init"
  initializes a new module, which creates the go.mod file in the current directory. The module name can
  be set to the current directory's name, which is "test_claude_code" in this case. So the command would
  be "go mod init example.com/lru_cache" or "go mod init github.com/..." if they have a GitHub repo. But
  since the user hasn't specified, I'll use a placeholder module name.

  Wait, the user's current directory is /home/faiq0913/TEMP/test_claude_code. The module name should be
  something like "github.com/faiq0913/test_claude_code" if they want to use a GitHub module. But if
  they're just starting out, maybe a local module name like "example.com/test_claude_code" is better. Let
  me check the Go documentation. The go mod init command creates a go.mod file with the module path. The
  module path is usually the import path, which for local modules can be a local path. However, the user
  might not have a module set up, so initializing one is necessary.

  So, the correct approach is to run "go mod init" with an appropriate module name. Let me suggest that
  to the user. Also, after creating the go.mod file, they might need to run "go mod tidy" to get any
  necessary dependencies. But since the code doesn't have any external dependencies, maybe that's not
  needed.

  I should inform the user about the missing go.mod file and offer to create it. Then, suggest running
  the tests again. If they're not using a module, they can still run tests with "go test" without a
  go.mod, but it's recommended to have one for proper module management. So, the plan is to create the
  go.mod file and then run the tests again.
  </think>

● Bash(go mod init example.com/lru_cache)
  I should inform the user about the missing go.mod file and offer to create it. Then, suggest running
  the tests again. If they're not using a module, they can still run tests with "go test" without a
  go.mod, but it's recommended to have one for proper module management. So, the plan is to create the
  go.mod file and then run the tests again.
  </think>

● Bash(go mod init example.com/lru_cache)
  ⎿  go: creating new go.mod: module example.com/lru_cache
     go: to add module requirements and sums:
        go mod tidy

● <think>
  Okay, the user tried to run the Go tests but got an error about the go.mod file. I helped them create
  the go.mod file with "go mod init example.com/lru_cache" and mentioned they need to run "go mod tidy"
  to add module requirements. Now, I should check if the user wants to proceed with that.

  Wait, the user hasn't responded yet. The last message was the output of the "go mod init" command. The
  next step is to run "go mod tidy" to get the necessary dependencies. But the user might not have any
  dependencies, so maybe that's not needed. However, the error message suggests that the module needs to
  be tidied.

  Alternatively, the user might not be using a module, and the tests can be run without one. But the
  error indicates that the module is missing. So, I should suggest running "go mod tidy" to set up the
  module properly. Let me check the tools available. The Bash tool can be used to run that command.

  I should also consider if the user wants to proceed with the tests. If they do, I'll run "go mod tidy"
  and then "go test" again. But since the user hasn't responded, I need to prompt them. However, the
  system message says to avoid unnecessary steps. Wait, the user's last message was the output of the "go
  mod init" command. The next logical step is to run "go mod tidy" to add any required dependencies.
  Then, run the tests again.

  But the user might not have any dependencies, so "go mod tidy" might not do anything. However, it's
  better to run it to ensure the module is set up correctly. Let me proceed with that. Then, run the
  tests. If there are no errors, the tests should pass. If not, I'll need to debug further.

  Alternatively, the user might not need a module and can run the tests without one. But the error
  suggests that the module is required. So, the correct approach is to initialize the module and then run
  "go mod tidy" to set up the dependencies. After that, run the tests.

  I should also check if the test file is correctly named and in the right directory. The test file is
  lru_cache_test.go, which is correct. So, the next steps are to run "go mod tidy" and then "go test"
  again. Let me do that.
  </think>

● Bash(go mod tidy && go test -v /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go)
● ⎿  Running…
     Error: Exit code 1
· Sli# /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go
     stat /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go: directory not found
     FAIL       /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go [setup failed]
─────FAIL────────────────────────────────────────────────────────────────────────────────────────────────

● <think>
  Okay, the user is encountering an error when trying to run the Go tests. The error message says "stat
  /home/faiq0913/TEMP/test_claude_code/lru_cache_test.go: directory not found". Wait, that doesn't make
  sense. The file lru_cache_test.go was created earlier, so why is the directory not found?

  Wait, maybe the user is trying to run the test file as if it's a directory. The error suggests that the
  path is a directory, but the file exists. Let me check the file path. The user's current working
  directory is /home/faiq0913/TEMP/test_claude_code. The test file is in that directory, so the path
  should be correct. But the error says the directory isn't found. Hmm, perhaps there's a typo in the
  file name. Let me verify the file exists.

  Wait, the user's previous tool calls show that the test file was written as "lru_cache_test.go". So the
  path should be correct. Maybe the user is in a different directory now. Let me check the current
  directory. The system message says the primary working directory is
  /home/faiq0913/TEMP/test_claude_code, so the path should be correct.

  Wait, the error might be because the test file was not created properly. Let me check the previous
  Write tool call. The content for lru_cache_test.go was provided, but maybe there was an issue with the
  content. The user's test code might have syntax errors or missing imports.

  Looking back, the test code was written with "package main" and imported "testing". But in Go, test
  files should have the same package name as the main file, and the test functions should be in the same
  package. However, the test file might not have the correct structure. For example, the test function
  should be named TestLRUCache and in the main package.

  Wait, the test code was written with the TestLRUCache function, which is correct. But maybe the code in
  the test file is incomplete or has errors. Let me check the test code again. The test function has
  some lines that might be cut off. For example, the line "if value, ok := cache.Get(\"e\"); !ok || value
  != 5 {" seems incomplete. The closing brace is missing, which would cause a syntax error.

  Ah, that's the issue! The test code was not properly formatted. The original test function had a
  missing closing brace, leading to a syntax error. So the test file can't be run because of the syntax
  error.

  So the next step is to correct the test code. I need to use the Edit tool to fix the syntax error in
  the test file. Specifically, the line "if value, ok := cache.Get(\"e\"); !ok || value != 5 {" is
  missing a closing brace. Let me adjust that.

  Once the test file is fixed, I can run "go test" again. Also, the user might need to create the go.mod
  file if they haven't already. But the previous "go mod init" command was run, so that's probably set
  up.

  So, I'll use the Edit tool to correct the test file's syntax error. Then, run the tests again. If that
  fails, I'll need to check for other issues, like missing imports or incorrect function definitions. But
  the main issue here is the missing brace in the test function.
  </think>
  ⎿  Error editing file

● <think>
  Okay, the user is trying to run the Go tests for the LRU cache implementation but is encountering an
  error. The previous attempt to edit the test file had a JSON parsing error, likely due to the content
  being too long or containing unescaped characters. Let me address this.

  First, I need to correct the test file's syntax error. The error message indicated a missing closing
  brace in the test function. The original test code had an incomplete line, so I should fix that. But
  the JSON input was invalid, so I need to ensure the arguments are properly formatted.

  Let me simplify the Edit tool call. Instead of replacing a long string, I'll target the specific line
  with the syntax error. The line in question is where the test checks the value after putting "e" with
  5. The original code had a missing closing brace, so I'll add that. Also, ensure the JSON is valid by
  escaping the quotes properly.

  So, the correct approach is to use the Edit tool with the exact line to fix. The old_string should be
  the incorrect line, and the new_string should have the corrected syntax. Let me structure the JSON
  correctly, making sure the file_path and content are properly escaped. Also, keep the replace_all as
  true to ensure all instances are fixed.

  Once the syntax error is resolved, the next step is to run the tests again. If the tests still fail,
  there might be other issues, but the main problem was the missing brace. Let me make sure the JSON is
  valid and the edit is applied correctly.
  </think>
  ⎿  Error editing file

● <think>
  Okay, the user is having trouble with the Go test file. The previous attempts to edit the file resulted
  in JSON parsing errors, probably because the content was too long or had unescaped characters. Let me
  try to fix this by making the Edit tool call more concise.

  First, I need to identify the exact line causing the issue. The error message mentions a syntax error
  in the test function, specifically with the line checking the value after putting "e" with 5. The
  original code had a missing closing brace, which was causing the syntax error.

  So, the correct approach is to use the Edit tool with the specific line. The old_string should be the
  incorrect line, and the new_string should have the corrected syntax. Let me make sure the JSON is
  properly formatted, escaping the quotes and keeping the content short.

  I'll structure the JSON with the file path, old string, and new string. The old string is the line with
  the syntax error, and the new string adds the missing closing brace. This should fix the syntax issue.
  Then, I can suggest running the tests again once the edit is applied.
  </think>
  ⎿  Error editing file

● <think>
  Okay, the user is having trouble with the Go test file. The previous attempts to edit the file resulted
  in JSON parsing errors, probably because the content was too long or had unescaped characters. Let me
  try to make the Edit tool call more concise.

  The error message indicates that the JSON input was invalid. The old_string and new_string might have
  had unescaped quotes or other issues. Let me ensure that the JSON is properly formatted with escaped
  quotes. Also, the content should be short enough to avoid truncation.

  I'll structure the JSON with the file path, old string, and new string. The old string is the line with
  the syntax error, and the new string adds the missing closing brace. Let me make sure the JSON is
  valid by escaping the quotes and keeping the content brief. Then, I can suggest running the tests again
  once the edit is applied.
  </think>

✢ Slithering… (22m 53s · ↓ 126.3k tokens)
  ⎿  Tip: Use /theme to change the color theme

─────────────────────────────────────────────────────────────────────────────────────────────────────────
❯  
─────────────────────────────────────────────────────────────────────────────────────────────────────────
  ⏵⏵ accept edits on (shift+tab to cycle) · esc to interrupt · ← for agents
v1/messages/count_tokens Endpoint
(.venv) faiq0913@MSI:~/open_source/ray$ curl -s $BASE/v1/messages/count_tokens -H 'content-type: application/json' -d '{
  "model": "claude-sonnet-4-5-20250929",
  "messages": [{"role": "user", "content": "hi"}]}' | jq
{
  "input_tokens": 9,
  "context_management": {
    "original_input_tokens": 9
  }
}
(.venv) faiq0913@MSI:~/open_source/ray$ curl -s $BASE/v1/messages -H 'content-type: application/json' -d '{
  "model": "does-not-exist", "max_tokens": 16,
  "messages": [{"role": "user", "content": "hi"}]}' | jq
{
  "type": "error",
  "error": {
    "type": "NotFoundError",
    "message": "The model `does-not-exist` does not exist."
  }
}

@wanadzhar913

wanadzhar913 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor Author
Ray Serve LLM logs
(.venv) root@bea9100ba116:/workspace# serve run config.yaml
2026-08-19 17:55:35,019 INFO scripts.py:480 -- Running config file: 'config.yaml'.
2026-08-19 17:55:35,034 INFO worker.py:1833 -- Connecting to existing Ray cluster at address: 172.24.0.2:6379...
2026-08-19 17:55:35,044 INFO worker.py:2024 -- Connected to Ray cluster.
(ServeController pid=19243) INFO 2026-08-19 17:55:38,293 controller 19243 -- HAProxy is enabled in ServeController, replacing Serve proxy with HAProxy.
(ProxyActor pid=28085) INFO 2026-08-19 17:55:42,925 proxy 172.24.0.2 -- Proxy starting on node 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02 (HTTP port: 8500).
(ProxyActor pid=28085) INFO 2026-08-19 17:55:43,097 proxy 172.24.0.2 -- Got updated endpoints: {}.
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,266 proxy 172.24.0.2 -- HAProxy starting on node 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02 (HTTP port: 8000).
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,307 proxy 172.24.0.2 -- Successfully generated HAProxy config file.
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,312 proxy 172.24.0.2 -- Using HAProxy binary: /workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,324 proxy 172.24.0.2 -- Starting HAProxy (spawn #1, pid=28225, stdout=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.1.stdout.log, stderr=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.1.stderr.log); args=['/workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy', '-db', '-f', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/haproxy.cfg', '-dR']
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,425 proxy 172.24.0.2 -- Got updated backend configs: [].
(ServeController pid=19243) WARNING 2026-08-19 17:55:43,514 controller 19243 -- Proxy actor readiness check for proxy on 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02 didn't complete in 5.0s.
(ServeController pid=19243) WARNING 2026-08-19 17:55:43,514 controller 19243 -- Proxy actor reported not ready on node 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02
INFO 2026-08-19 17:55:43,861 serve 27898 -- Started Serve in namespace "serve".
(ServeController pid=19243) INFO 2026-08-19 17:55:43,863 controller 19243 -- Deploying new app 'anthropic-direct'.
(ServeController pid=19243) INFO 2026-08-19 17:55:43,863 controller 19243 -- Importing and building app 'anthropic-direct'.
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,826 proxy 172.24.0.2 -- HAProxy started successfully.
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,859 proxy 172.24.0.2 -- Using HAProxy binary: /workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy
2026-08-19 17:55:43,869 SUCC scripts.py:537 -- Submitted deploy config successfully.
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:43,871 proxy 172.24.0.2 -- Starting HAProxy (spawn #2, pid=28237, stdout=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.2.stdout.log, stderr=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.2.stderr.log); args=['/workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy', '-db', '-f', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/haproxy.cfg', '-dR', '-sf', '28225', '-x', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock']
(HAProxyManager pid=28089) INFO 2026-08-19 17:55:44,374 proxy 172.24.0.2 -- Successfully performed graceful HAProxy reload with process restart.
(build_serve_application pid=28238) INFO 2026-08-19 17:55:48,349 controller build_anthropic-direct_28238 -- Importing application 'anthropic-direct' with arguments {'llm_configs': [{'model_loading_config': {'model_id': 'claude-sonnet-4-5-20250929', 'model_source': 'Qwen/Qwen3-8B'}, 'deployment_config': {'autoscaling_config': {'min_replicas': 1, 'max_replicas': 1}}, 'engine_kwargs': {'enable_auto_tool_choice': True, 'tool_call_parser': 'hermes', 'reasoning_parser': 'qwen3', 'hf_overrides': {'rope_scaling': {'rope_type': 'yarn', 'factor': 4.0, 'original_max_position_embeddings': 32768}}, 'max_model_len': 131072, 'gpu_memory_utilization': 0.9, 'tensor_parallel_size': 1, 'enable_prefix_caching': True}, 'runtime_env': {'env_vars': {'HF_TOKEN': '', 'VLLM_DISABLE_COMPILE_CACHE': '1'}}}]}.
(build_serve_application pid=28238) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(build_serve_application pid=28238)   import pynvml  # type: ignore[import]
(build_serve_application pid=28238) INFO 2026-08-19 17:56:33,887 controller build_anthropic-direct_28238 -- ============== Deployment Options ==============
(build_serve_application pid=28238) INFO 2026-08-19 17:56:33,888 controller build_anthropic-direct_28238 -- {'autoscaling_config': {'max_replicas': 1,
(build_serve_application pid=28238)                         'min_replicas': 1,
(build_serve_application pid=28238)                         'target_ongoing_requests': 1000000000},
(build_serve_application pid=28238)  'health_check_period_s': 10,
(build_serve_application pid=28238)  'health_check_timeout_s': 10,
(build_serve_application pid=28238)  'max_ongoing_requests': 1000000000,
(build_serve_application pid=28238)  'name': 'LLMServer:claude-sonnet-4-5-20250929',
(build_serve_application pid=28238)  'placement_group_bundles': [{'CPU': 1, 'GPU': 1}],
(build_serve_application pid=28238)  'placement_group_strategy': 'PACK',
(build_serve_application pid=28238)  'ray_actor_options': {'runtime_env': {'env_vars': {'HF_TOKEN': '',
(build_serve_application pid=28238)                                                     'VLLM_DISABLE_COMPILE_CACHE': '1'},
(build_serve_application pid=28238)                                        'worker_process_setup_hook': 'ray.llm._internal.serve._worker_process_setup_hook'}},
(build_serve_application pid=28238)  'request_router_config': RequestRouterConfig(request_router_class='ray.serve.experimental.round_robin_router.RoundRobinRouter', request_router_kwargs={}, request_routing_stats_period_s=10, request_routing_stats_timeout_s=30, initial_backoff_s=0.025, backoff_multiplier=2, max_backoff_s=0.5)}
(build_serve_application pid=28238) INFO 2026-08-19 17:56:33,900 controller build_anthropic-direct_28238 -- Direct streaming enabled: LLMServer=ingress, LLMRouter=ingress_request_router
(ServeController pid=19243) INFO 2026-08-19 17:56:34,028 controller 19243 -- Imported and built app 'anthropic-direct' successfully.
(ServeController pid=19243) INFO 2026-08-19 17:56:34,029 controller 19243 -- Raising graceful_shutdown_timeout_s for ingress deployment 'LLMServer:claude-sonnet-4-5-20250929' from 20.0s to 35.0s so the force-kill deadline covers the direct-ingress drain period.
(ServeController pid=19243) INFO 2026-08-19 17:56:34,030 controller 19243 -- Application 'anthropic-direct' has ingress request router deployment 'LLMRouter' configured.
(ServeController pid=19243) INFO 2026-08-19 17:56:34,031 controller 19243 -- Registering autoscaling state for deployment Deployment(name='LLMServer:claude-sonnet-4-5-20250929', app='anthropic-direct')
(ServeController pid=19243) INFO 2026-08-19 17:56:34,031 controller 19243 -- Deploying new version of Deployment(name='LLMServer:claude-sonnet-4-5-20250929', app='anthropic-direct') (initial target replicas: 1).
(ServeController pid=19243) INFO 2026-08-19 17:56:34,032 controller 19243 -- Deregistering autoscaling state for deployment Deployment(name='LLMRouter', app='anthropic-direct')
(ServeController pid=19243) WARNING 2026-08-19 17:56:34,032 controller 19243 -- Cannot deregister autoscaling state for deployment Deployment(name='LLMRouter', app='anthropic-direct') because it is not registered
(ServeController pid=19243) INFO 2026-08-19 17:56:34,033 controller 19243 -- Deploying new version of Deployment(name='LLMRouter', app='anthropic-direct') (initial target replicas: 0).
(ProxyActor pid=28085) INFO 2026-08-19 17:56:34,036 proxy 172.24.0.2 -- Got updated endpoints: {Deployment(name='LLMServer:claude-sonnet-4-5-20250929', app='anthropic-direct'): EndpointInfo(route='/', app_is_cross_language=False, route_patterns=None)}.
(ProxyActor pid=28085) INFO 2026-08-19 17:56:34,041 proxy 172.24.0.2 -- Started <ray.serve._private.router.SharedRouterLongPollClient object at 0x7f4009366de0>.
(ServeController pid=19243) INFO 2026-08-19 17:56:34,137 controller 19243 -- Adding 1 replica to Deployment(name='LLMServer:claude-sonnet-4-5-20250929', app='anthropic-direct').
(ServeController pid=19243) INFO 2026-08-19 17:56:34,139 controller 19243 -- Adding 1 replica to Deployment(name='LLMRouter', app='anthropic-direct').
(HAProxyManager pid=28089) INFO 2026-08-19 17:56:34,138 proxy 172.24.0.2 -- Got updated backend configs: [BackendConfig(app_name='anthropic-direct', name='http-anthropic-direct', path_prefix='/', servers=[], ingress_request_router_servers=[], fallback_server=ServerConfig(name='SERVE_PROXY_ACTOR-fallback-458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02', host='127.0.0.1', port=8500), protocol=HTTP)].
(HAProxyManager pid=28089) INFO 2026-08-19 17:56:34,172 proxy 172.24.0.2 -- Using HAProxy binary: /workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy
(HAProxyManager pid=28089) INFO 2026-08-19 17:56:34,184 proxy 172.24.0.2 -- Starting HAProxy (spawn #3, pid=28489, stdout=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.3.stdout.log, stderr=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.3.stderr.log); args=['/workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy', '-db', '-f', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/haproxy.cfg', '-dR', '-sf', '28237', '-x', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock']
(HAProxyManager pid=28089) INFO 2026-08-19 17:56:34,687 proxy 172.24.0.2 -- Successfully performed graceful HAProxy reload with process restart.
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 17:56:37,858 anthropic-direct_LLMRouter the5croz -- Started <ray.serve._private.router.SharedRouterLongPollClient object at 0x7f647c56fc20>.
(ServeController pid=19243) INFO 2026-08-19 17:56:37,961 controller 19243 -- Creating node manager for node 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02
(ServeController pid=19243) INFO 2026-08-19 17:56:37,961 controller 19243 -- Allocated RequestProtocol.HTTP port 30000 to replica the5croz on node 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 17:56:37,962 anthropic-direct_LLMRouter the5croz -- Allocated port 30000 for RequestProtocol.HTTP
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 17:56:37,963 anthropic-direct_LLMRouter the5croz -- Successfully started RequestProtocol.HTTP server on port 30000
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 17:56:37,963 anthropic-direct_LLMRouter the5croz -- Started HTTP server on port 30000
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488)   import pynvml  # type: ignore[import]
(ServeController pid=19243) WARNING 2026-08-19 17:57:04,222 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to be scheduled. This may be due to waiting for the cluster to auto-scale or for a runtime environment to be installed. Resources required for each replica: [{"GPU": 1.0, "CPU": 1.0}], total resources available: {}. Use `ray status` for more details.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 17:57:14,817 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Running tasks to download model files on worker nodes
(pid=28745) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(pid=28745)   import pynvml  # type: ignore[import]
(ServeController pid=19243) WARNING 2026-08-19 17:57:34,299 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(initialize_remote_node pid=28745) No cloud storage mirror configured
(ServeController pid=19243) WARNING 2026-08-19 17:58:04,383 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(_get_vllm_engine_config pid=28745) INFO 08-19 17:58:05 [model.py:623] Resolved architecture: Qwen3ForCausalLM
(_get_vllm_engine_config pid=28745) INFO 08-19 17:58:05 [model.py:1788] Using max model len 131072
(_get_vllm_engine_config pid=28745) INFO 08-19 17:58:05 [arg_utils.py:1951] Using ray runtime env (env vars redacted): {'env_vars': {'HF_TOKEN': '***', 'VLLM_DISABLE_COMPILE_CACHE': '***'}, 'worker_process_setup_hook': 'ray.llm._internal.serve._worker_process_setup_hook'}
(_get_vllm_engine_config pid=28745) INFO 08-19 17:58:05 [scheduler.py:252] Chunked prefill is enabled with max_num_batched_tokens=8192.
(_get_vllm_engine_config pid=28745) INFO 08-19 17:58:05 [vllm.py:1109] Asynchronous scheduling is enabled.
(_get_vllm_engine_config pid=28745) INFO 08-19 17:58:05 [kernel.py:295] Final IR op priority after setting platform defaults: IrOpPriorityConfig(rms_norm=['native'], fused_add_rms_norm=['native'])
(_get_vllm_engine_config pid=28745) WARNING 08-19 17:58:05 [vllm.py:2228] Model Runner V2 does not yet support the thinking_token_budget request parameter. Set VLLM_USE_V2_MODEL_RUNNER=0 if this is required.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 17:58:07,052 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Clearing the current platform cache ...
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 17:58:07,335 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Using executor class: <class 'vllm.v1.executor.ray_executor_v2.RayExecutorV2'>
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) WARNING 08-19 17:58:10 [system_utils.py:157] We must use the `spawn` multiprocessing start method. Overriding VLLM_WORKER_MULTIPROC_METHOD to 'spawn'. See https://docs.vllm.ai/en/latest/usage/troubleshooting.html#python-multiprocessing for more information. Reasons: In a Ray actor and can only be spawned
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488)   import pynvml  # type: ignore[import]
(ServeController pid=19243) WARNING 2026-08-19 17:58:34,385 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 17:58:55 [core.py:116] Initializing a V1 LLM engine (v0.26.0) with config: model='Qwen/Qwen3-8B', speculative_config=None, tokenizer='Qwen/Qwen3-8B', skip_tokenizer_init=False, tokenizer_mode=auto, revision=None, tokenizer_revision=None, trust_remote_code=False, dtype=torch.bfloat16, max_seq_len=131072, download_dir=None, load_format=auto, tensor_parallel_size=1, pipeline_parallel_size=1, data_parallel_size=1, decode_context_parallel_size=1, dcp_comm_backend=ag_rs, disable_custom_all_reduce=False, quantization=None, quantization_config=None, enforce_eager=False, enable_return_routed_experts=False, kv_cache_dtype=auto, device_config=cuda, structured_outputs_config=StructuredOutputsConfig(backend='auto', disable_any_whitespace=False, disable_additional_properties=False, reasoning_parser='qwen3', reasoning_parser_plugin='', enable_in_reasoning=False), observability_config=ObservabilityConfig(show_hidden_metrics_for_version=None, otlp_traces_endpoint=None, collect_detailed_traces=None, kv_cache_metrics=False, kv_cache_metrics_sample=0.01, cudagraph_metrics=False, enable_layerwise_nvtx_tracing=False, enable_mfu_metrics=False, enable_mm_processor_stats=False, enable_logging_iteration_details=False, jit_monitor_mode='warn', jit_monitor_verbose=False), seed=0, served_model_name=claude-sonnet-4-5-20250929, enable_prefix_caching=True, enable_chunked_prefill=True, pooler_config=None, compilation_config={'mode': <CompilationMode.VLLM_COMPILE: 3>, 'debug_dump_path': None, 'cache_dir': '', 'compile_cache_save_format': 'binary', 'backend': 'inductor', 'custom_ops': ['none'], 'ir_enable_torch_wrap': True, 'splitting_ops': ['vllm::unified_attention_with_output', 'vllm::unified_mla_attention_with_output', 'vllm::mamba_mixer2', 'vllm::mamba_mixer', 'vllm::short_conv', 'vllm::linear_attention', 'vllm::plamo2_mamba_mixer', 'vllm::qwen_gdn_attention_core', 'vllm::gdn_attention_core_xpu', 'vllm::olmo_hybrid_gdn_full_forward', 'vllm::kda_attention', 'vllm::sparse_attn_indexer', 'vllm::rocm_aiter_sparse_attn_indexer', 'vllm::deepseek_v4_attention', 'vllm::hpc_rope_norm_forward', 'vllm::unified_kv_cache_update', 'vllm::unified_mla_kv_cache_update'], 'compile_mm_encoder': False, 'cudagraph_mm_encoder': False, 'encoder_cudagraph_token_budgets': [], 'encoder_cudagraph_max_vision_items_per_batch': 0, 'encoder_cudagraph_max_frames_per_batch': None, 'compile_sizes': [], 'compile_ranges_endpoints': [8192], 'inductor_compile_config': {'enable_auto_functionalized_v2': False, 'size_asserts': False, 'alignment_asserts': False, 'scalar_asserts': False, 'combo_kernels': True, 'benchmark_combo_kernel': True}, 'inductor_passes': {}, 'cudagraph_mode': <CUDAGraphMode.FULL_AND_PIECEWISE: (2, 1)>, 'cudagraph_num_of_warmups': 1, 'cudagraph_capture_sizes': [1, 2, 4, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96, 104, 112, 120, 128, 136, 144, 152, 160, 168, 176, 184, 192, 200, 208, 216, 224, 232, 240, 248, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400, 416, 432, 448, 464, 480, 496, 512], 'cudagraph_copy_inputs': False, 'cudagraph_specialize_lora': True, 'use_inductor_graph_partition': False, 'pass_config': {'fuse_norm_quant': False, 'fuse_act_quant': False, 'fuse_attn_quant': False, 'enable_sp': False, 'fuse_gemm_comms': False, 'fuse_allreduce_rms': False, 'enable_qk_norm_rope_fusion': False, 'fuse_rope_kvcache_cat_mla': False, 'fuse_act_padding': False, 'fuse_qk_norm_rope_kvcache': False}, 'max_cudagraph_capture_size': 512, 'dynamic_shapes_config': {'type': <DynamicShapesType.BACKED: 'backed'>, 'evaluate_guards': False, 'assume_32_bit_indexing': False}, 'local_cache_dir': None, 'fast_moe_cold_start': False, 'static_all_moe_layers': []}, kernel_config=KernelConfig(ir_op_priority=IrOpPriorityConfig(rms_norm=['native'], fused_add_rms_norm=['native']), enable_flashinfer_autotune=True, enable_cutedsl_warmup=True, enable_bf16x3_router_gemm=False, moe_backend='auto', linear_backend='auto')
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 17:58:55 [ray_utils.py:602] Using the existing placement group
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) 2026-08-19 17:58:55,615       INFO worker.py:1683 -- Using address 172.24.0.2:6379 set in the environment variable RAY_ADDRESS
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) 2026-08-19 17:58:55,622       INFO worker.py:1833 -- Connecting to existing Ray cluster at address: 172.24.0.2:6379...
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) 2026-08-19 17:58:55,633       INFO worker.py:2024 -- Connected to Ray cluster.
(pid=29271) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(pid=29271)   import pynvml  # type: ignore[import]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (pid=29271) /workspace/ray/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py:61: FutureWarning: The pynvml package is deprecated. Please install nvidia-ml-py instead. If you did not install pynvml directly, please report this to the maintainers of the package that installed pynvml for you.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (pid=29271)   import pynvml  # type: ignore[import]
(ServeController pid=19243) WARNING 2026-08-19 17:59:04,465 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(ServeController pid=19243) WARNING 2026-08-19 17:59:34,503 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(RayWorkerProc pid=29271) WARNING 08-19 17:59:45 [worker_base.py:306] Missing `shared_worker_lock` argument from executor. This argument is needed for mm_processor_cache_type='shm'.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) WARNING 08-19 17:59:45 [worker_base.py:306] Missing `shared_worker_lock` argument from executor. This argument is needed for mm_processor_cache_type='shm'.
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:45 [parallel_state.py:1615] world_size=1 rank=0 local_rank=0 distributed_init_method=tcp://172.24.0.2:100 backend=nccl
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:45 [parallel_state.py:1946] rank 0 in world size 1 is assigned as DP rank 0, PP rank 0, PCP rank 0, TP rank 0, EP rank N/A, EPLB rank N/A
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:45 [gpu_worker.py:378] Using V2 Model Runner
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:45 [parallel_state.py:1615] world_size=1 rank=0 local_rank=0 distributed_init_method=tcp://172.24.0.2:100 backend=nccl
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:45 [parallel_state.py:1946] rank 0 in world size 1 is assigned as DP rank 0, PP rank 0, PCP rank 0, TP rank 0, EP rank N/A, EPLB rank N/A
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:45 [gpu_worker.py:378] Using V2 Model Runner
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:46 [model_runner.py:284] Loading model from scratch...
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:46 [model_runner.py:284] Loading model from scratch...
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:47 [cuda.py:482] Using FLASH_ATTN attention backend out of potential backends: ['FLASH_ATTN', 'FLASHINFER', 'TRITON_ATTN', 'FLEX_ATTENTION'].
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:47 [flash_attn.py:776] Using FlashAttention version 3
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:47 [cuda.py:482] Using FLASH_ATTN attention backend out of potential backends: ['FLASH_ATTN', 'FLASHINFER', 'TRITON_ATTN', 'FLEX_ATTENTION'].
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:47 [flash_attn.py:776] Using FlashAttention version 3
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:48 [weight_utils.py:869] Filesystem type for checkpoints: NFS4. Checkpoint size: 15.26 GiB. Available RAM: 1851.51 GiB.
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:48 [weight_utils.py:831] Prefetching checkpoint files into page cache started (in background, num_threads=8, block_size=16777216 bytes)
Loading safetensors checkpoint shards:   0% Completed | 0/5 [00:00<?, ?it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:48 [weight_utils.py:869] Filesystem type for checkpoints: NFS4. Checkpoint size: 15.26 GiB. Available RAM: 1851.51 GiB.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:48 [weight_utils.py:831] Prefetching checkpoint files into page cache started (in background, num_threads=8, block_size=16777216 bytes)
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards:   0% Completed | 0/5 [00:00<?, ?it/s]
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 10% (1/5)
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 10% (1/5)
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 20% (2/5)
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 20% (2/5)
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 30% (3/5)
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 30% (3/5)
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 40% (4/5)
Loading safetensors checkpoint shards:  20% Completed | 1/5 [00:02<00:09,  2.37s/it]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:50 [weight_utils.py:803] Prefetching checkpoint files: 40% (4/5)
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards:  20% Completed | 1/5 [00:02<00:09,  2.37s/it]
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:51 [weight_utils.py:803] Prefetching checkpoint files: 50% (5/5)
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:51 [weight_utils.py:826] Prefetching checkpoint files into page cache finished in 2.57s
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:51 [weight_utils.py:803] Prefetching checkpoint files: 50% (5/5)
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:51 [weight_utils.py:826] Prefetching checkpoint files into page cache finished in 2.57s
Loading safetensors checkpoint shards:  40% Completed | 2/5 [00:03<00:04,  1.38s/it]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards:  40% Completed | 2/5 [00:03<00:04,  1.38s/it]
Loading safetensors checkpoint shards:  60% Completed | 3/5 [00:03<00:02,  1.06s/it]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards:  60% Completed | 3/5 [00:03<00:02,  1.06s/it]
Loading safetensors checkpoint shards:  80% Completed | 4/5 [00:04<00:00,  1.16it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards:  80% Completed | 4/5 [00:04<00:00,  1.16it/s]
Loading safetensors checkpoint shards: 100% Completed | 5/5 [00:04<00:00,  1.53it/s]
Loading safetensors checkpoint shards: 100% Completed | 5/5 [00:04<00:00,  1.09it/s]
(RayWorkerProc pid=29271) (Worker pid=29271) 
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards: 100% Completed | 5/5 [00:04<00:00,  1.53it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Loading safetensors checkpoint shards: 100% Completed | 5/5 [00:04<00:00,  1.09it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) 
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:53 [default_loader.py:430] Loading weights took 4.62 seconds
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:53 [default_loader.py:430] Loading weights took 4.62 seconds
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:53 [model_runner.py:305] Model loading took 15.31 GiB and 7.150317 seconds
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:53 [topk_topp_sampler.py:55] Using FlashInfer for top-p & top-k sampling.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:53 [model_runner.py:305] Model loading took 15.31 GiB and 7.150317 seconds
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 17:59:53 [topk_topp_sampler.py:55] Using FlashInfer for top-p & top-k sampling.
(ServeController pid=19243) WARNING 2026-08-19 18:00:04,537 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:06 [backends.py:1092] vLLM's torch.compile cache is disabled.
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:06 [backends.py:1155] Dynamo bytecode transform time: 12.74 s
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:06 [backends.py:1092] vLLM's torch.compile cache is disabled.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:06 [backends.py:1155] Dynamo bytecode transform time: 12.74 s
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:12 [backends.py:393] Compiling a graph for compile range (1, 8192) takes 5.20 s
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:12 [backends.py:393] Compiling a graph for compile range (1, 8192) takes 5.20 s
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:13 [monitor.py:53] torch.compile and initial profiling/warmup run together took 19.48 s in total
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:13 [monitor.py:53] torch.compile and initial profiling/warmup run together took 19.48 s in total
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 18:00:14 [kv_cache_utils.py:2177] GPU KV cache size: 396,448 tokens
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 18:00:14 [kv_cache_utils.py:2178] Maximum concurrency for 131,072 tokens per request: 3.02x
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:14 [gpu_worker.py:560] Available KV cache memory: 54.45 GiB
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:14 [gpu_worker.py:560] Available KV cache memory: 54.45 GiB
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:14 [kernel_warmup.py:227] Using FlashInfer autotune cache file: /root/.cache/vllm/flashinfer_autotune_cache/0.6.14/90a/41ab9f40faa847c095d7bbd5b2b2c160d7a475f07dca476ed31a048a4e8d8764/autotune_configs.json
(RayWorkerProc pid=29271) (Worker pid=29271) WARNING 08-19 18:00:14 [kernel_warmup.py:258] No FlashInfer autotune cache entries found.Falling back to default tactics.
(RayWorkerProc pid=29271) (Worker pid=29271) 2026-08-19 18:00:14,819 - INFO - autotuner.py:651 - flashinfer.jit: [Autotuner]: Autotuning process starts ...
(RayWorkerProc pid=29271) (Worker pid=29271) 2026-08-19 18:00:14,841 - INFO - autotuner.py:674 - flashinfer.jit: [Autotuner]: Autotuning process ends
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:14 [kernel_warmup.py:227] Using FlashInfer autotune cache file: /root/.cache/vllm/flashinfer_autotune_cache/0.6.14/90a/41ab9f40faa847c095d7bbd5b2b2c160d7a475f07dca476ed31a048a4e8d8764/autotune_configs.json
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) WARNING 08-19 18:00:14 [kernel_warmup.py:258] No FlashInfer autotune cache entries found.Falling back to default tactics.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) 2026-08-19 18:00:14,819 - INFO - autotuner.py:651 - flashinfer.jit: [Autotuner]: Autotuning process starts ...
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) 2026-08-19 18:00:14,841 - INFO - autotuner.py:674 - flashinfer.jit: [Autotuner]: Autotuning process ends
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:14 [kernel_warmup.py:65] Warming up ll_bf16 router GEMM kernels.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:14 [kernel_warmup.py:65] Warming up ll_bf16 router GEMM kernels.
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:23 [cutedsl_warmup.py:101] Skipping CuTeDSL warmup because no compile units were requested.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:23 [cutedsl_warmup.py:101] Skipping CuTeDSL warmup because no compile units were requested.
Capturing CUDA graphs (PIECEWISE):   0%|          | 0/51 [00:00<?, ?it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):   0%|          | 0/51 [00:00<?, ?it/s]
Capturing CUDA graphs (PIECEWISE):   6%|▌         | 3/51 [00:00<00:01, 28.83it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):   6%|▌         | 3/51 [00:00<00:01, 28.83it/s]
Capturing CUDA graphs (PIECEWISE):  12%|█▏        | 6/51 [00:00<00:01, 29.03it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  12%|█▏        | 6/51 [00:00<00:01, 29.03it/s]
Capturing CUDA graphs (PIECEWISE):  18%|█▊        | 9/51 [00:00<00:01, 28.34it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  18%|█▊        | 9/51 [00:00<00:01, 28.34it/s]
Capturing CUDA graphs (PIECEWISE):  24%|██▎       | 12/51 [00:00<00:01, 28.86it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  24%|██▎       | 12/51 [00:00<00:01, 28.86it/s]
Capturing CUDA graphs (PIECEWISE):  29%|██▉       | 15/51 [00:00<00:01, 28.72it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  29%|██▉       | 15/51 [00:00<00:01, 28.72it/s]
Capturing CUDA graphs (PIECEWISE):  37%|███▋      | 19/51 [00:00<00:01, 29.78it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  37%|███▋      | 19/51 [00:00<00:01, 29.78it/s]
Capturing CUDA graphs (PIECEWISE):  43%|████▎     | 22/51 [00:00<00:00, 29.59it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  43%|████▎     | 22/51 [00:00<00:00, 29.59it/s]
Capturing CUDA graphs (PIECEWISE):  49%|████▉     | 25/51 [00:00<00:00, 29.65it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  49%|████▉     | 25/51 [00:00<00:00, 29.65it/s]
Capturing CUDA graphs (PIECEWISE):  57%|█████▋    | 29/51 [00:00<00:00, 29.79it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  57%|█████▋    | 29/51 [00:00<00:00, 29.79it/s]
Capturing CUDA graphs (PIECEWISE):  63%|██████▎   | 32/51 [00:01<00:00, 29.73it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  63%|██████▎   | 32/51 [00:01<00:00, 29.73it/s]
Capturing CUDA graphs (PIECEWISE):  69%|██████▊   | 35/51 [00:01<00:00, 28.92it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  69%|██████▊   | 35/51 [00:01<00:00, 28.92it/s]
Capturing CUDA graphs (PIECEWISE):  75%|███████▍  | 38/51 [00:01<00:00, 28.15it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  75%|███████▍  | 38/51 [00:01<00:00, 28.15it/s]
Capturing CUDA graphs (PIECEWISE):  80%|████████  | 41/51 [00:01<00:00, 27.66it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  80%|████████  | 41/51 [00:01<00:00, 27.66it/s]
Capturing CUDA graphs (PIECEWISE):  86%|████████▋ | 44/51 [00:01<00:00, 27.13it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  86%|████████▋ | 44/51 [00:01<00:00, 27.13it/s]
Capturing CUDA graphs (PIECEWISE):  92%|█████████▏| 47/51 [00:01<00:00, 27.06it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE):  92%|█████████▏| 47/51 [00:01<00:00, 27.06it/s]
Capturing CUDA graphs (PIECEWISE): 100%|██████████| 51/51 [00:01<00:00, 28.63it/s]
Capturing CUDA graphs (FULL):   0%|          | 0/51 [00:00<?, ?it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (PIECEWISE): 100%|██████████| 51/51 [00:01<00:00, 28.63it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):   0%|          | 0/51 [00:00<?, ?it/s]
Capturing CUDA graphs (FULL):   8%|▊         | 4/51 [00:00<00:01, 32.40it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):   8%|▊         | 4/51 [00:00<00:01, 32.40it/s]
Capturing CUDA graphs (FULL):  16%|█▌        | 8/51 [00:00<00:01, 33.90it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  16%|█▌        | 8/51 [00:00<00:01, 33.90it/s]
Capturing CUDA graphs (FULL):  24%|██▎       | 12/51 [00:00<00:01, 35.26it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  24%|██▎       | 12/51 [00:00<00:01, 35.26it/s]
Capturing CUDA graphs (FULL):  31%|███▏      | 16/51 [00:00<00:00, 36.95it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  31%|███▏      | 16/51 [00:00<00:00, 36.95it/s]
Capturing CUDA graphs (FULL):  41%|████      | 21/51 [00:00<00:00, 38.29it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  41%|████      | 21/51 [00:00<00:00, 38.29it/s]
Capturing CUDA graphs (FULL):  51%|█████     | 26/51 [00:00<00:00, 39.10it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  51%|█████     | 26/51 [00:00<00:00, 39.10it/s]
Capturing CUDA graphs (FULL):  59%|█████▉    | 30/51 [00:00<00:00, 39.27it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  59%|█████▉    | 30/51 [00:00<00:00, 39.27it/s]
Capturing CUDA graphs (FULL):  67%|██████▋   | 34/51 [00:00<00:00, 31.50it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  67%|██████▋   | 34/51 [00:00<00:00, 31.50it/s]
Capturing CUDA graphs (FULL):  75%|███████▍  | 38/51 [00:01<00:00, 33.58it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  75%|███████▍  | 38/51 [00:01<00:00, 33.58it/s]
Capturing CUDA graphs (FULL):  82%|████████▏ | 42/51 [00:01<00:00, 35.25it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  82%|████████▏ | 42/51 [00:01<00:00, 35.25it/s]
Capturing CUDA graphs (FULL):  92%|█████████▏| 47/51 [00:01<00:00, 37.11it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL):  92%|█████████▏| 47/51 [00:01<00:00, 37.11it/s]
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:26 [model_runner.py:747] Graph capturing finished in 4 secs, took 1.00 GiB
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:26 [gpu_worker.py:857] Free memory on device (78.66/79.18 GiB) on startup. Desired GPU memory utilization is (0.9, 71.26 GiB). Actual usage is 15.31 GiB for weight, 1.29 GiB for peak activation, 0.22 GiB for non-torch memory, and 1.0 GiB for CUDAGraph memory. Replace gpu_memory_utilization config with `--kv-cache-memory=57229567898` (53.3 GiB) to fit into requested memory, or `--kv-cache-memory=65178914304` (60.7 GiB) to fully utilize gpu memory. Current kv cache memory in use is 54.45 GiB.
Capturing CUDA graphs (FULL): 100%|██████████| 51/51 [00:01<00:00, 36.46it/s]
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:26 [model_runner.py:747] Graph capturing finished in 4 secs, took 1.00 GiB
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:26 [gpu_worker.py:857] Free memory on device (78.66/79.18 GiB) on startup. Desired GPU memory utilization is (0.9, 71.26 GiB). Actual usage is 15.31 GiB for weight, 1.29 GiB for peak activation, 0.22 GiB for non-torch memory, and 1.0 GiB for CUDAGraph memory. Replace gpu_memory_utilization config with `--kv-cache-memory=57229567898` (53.3 GiB) to fit into requested memory, or `--kv-cache-memory=65178914304` (60.7 GiB) to fully utilize gpu memory. Current kv cache memory in use is 54.45 GiB.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087Capturing CUDA graphs (FULL): 100%|██████████| 51/51 [00:01<00:00, 36.46it/s]
(RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:29 [jit_monitor.py:79] Kernel JIT monitor activated; monitored JIT compilations during inference will use mode=warn.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) (RayWorkerProc pid=29271) (Worker pid=29271) INFO 08-19 18:00:29 [jit_monitor.py:79] Kernel JIT monitor activated; monitored JIT compilations during inference will use mode=warn.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 18:00:30 [core.py:340] init engine (profile, create kv cache, warmup model) took 36.54 s (compilation: 19.48 s)
(ServeController pid=19243) WARNING 2026-08-19 18:00:34,543 controller 19243 -- Deployment 'LLMServer:claude-sonnet-4-5-20250929' in application 'anthropic-direct' has 1 replicas that have taken more than 30s to initialize.
(ServeController pid=19243) This may be caused by a slow __init__ or reconfigure method.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 18:00:48 [vllm.py:1109] Asynchronous scheduling is enabled.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) INFO 08-19 18:00:48 [kernel.py:295] Final IR op priority after setting platform defaults: IrOpPriorityConfig(rms_norm=['native'], fused_add_rms_norm=['native'])
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) (EngineCore pid=29087) WARNING 08-19 18:00:48 [vllm.py:2228] Model Runner V2 does not yet support the thinking_token_budget request parameter. Set VLLM_USE_V2_MODEL_RUNNER=0 if this is required.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:00:48 [parser_manager.py:37] "auto" tool choice has been enabled.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) WARNING 08-19 18:00:48 [model.py:1546] Default vLLM sampling parameters have been overridden by the model's `generation_config.json`: `{'temperature': 0.6, 'top_k': 20, 'top_p': 0.95}`. If this is not intended, please relaunch vLLM instance with `--generation-config vllm`.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:00:50 [hf.py:540] Detected the chat template content format to be 'string'. You can set `--chat-template-content-format` to override this.
(TelemetryAgent pid=22751) INFO 2026-08-19 18:00:51,088 serve 22751 -- The cached controller has died or is unreachable: The actor died unexpectedly before finishing this task.
(TelemetryAgent pid=22751)      class_name: ServeController
(TelemetryAgent pid=22751)      actor_id: 06d23f829656cc71a3322d9a01000000
(TelemetryAgent pid=22751)      pid: 19237
(TelemetryAgent pid=22751)      name: SERVE_CONTROLLER_ACTOR
(TelemetryAgent pid=22751)      namespace: serve
(TelemetryAgent pid=22751)      ip: 172.24.0.2
(TelemetryAgent pid=22751) The actor is dead because it was killed by `ray.kill`..
(TelemetryAgent pid=22751) INFO 2026-08-19 18:00:51,088 serve 22751 -- Nothing to shut down. There's no Serve application running on this Ray cluster.
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:00:51,080 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Started vLLM engine.
(ServeController pid=19243) INFO 2026-08-19 18:00:52,619 controller 19243 -- Allocated RequestProtocol.HTTP port 30001 to replica d2ngfytn on node 458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:00:52,620 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Allocated port 30001 for RequestProtocol.HTTP
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:00:52,620 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Successfully started RequestProtocol.HTTP server on port 30001
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:00:52,620 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn -- Started HTTP server on port 30001
(ProxyActor pid=28085) INFO 2026-08-19 18:00:52,705 proxy 172.24.0.2 -- Got updated endpoints: {Deployment(name='LLMServer:claude-sonnet-4-5-20250929', app='anthropic-direct'): EndpointInfo(route='/', app_is_cross_language=False, route_patterns=[RoutePattern(methods=['POST'], path='/detokenize'), RoutePattern(methods=['GET', 'HEAD'], path='/docs'), RoutePattern(methods=['GET', 'HEAD'], path='/docs/oauth2-redirect'), RoutePattern(methods=['POST'], path='/generative_scoring'), RoutePattern(methods=['GET'], path='/health'), RoutePattern(methods=['POST'], path='/inference/v1/generate'), RoutePattern(methods=['POST'], path='/invocations'), RoutePattern(methods=['POST'], path='/is_scaling_elastic_ep'), RoutePattern(methods=['GET'], path='/load'), RoutePattern(methods=['GET'], path='/metrics'), RoutePattern(methods=['GET', 'HEAD'], path='/openapi.json'), RoutePattern(methods=['GET', 'POST'], path='/ping'), RoutePattern(methods=['GET', 'HEAD'], path='/redoc'), RoutePattern(methods=['POST'], path='/scale_elastic_ep'), RoutePattern(methods=['POST'], path='/tokenize'), RoutePattern(methods=['POST'], path='/v1/chat/completions'), RoutePattern(methods=['POST'], path='/v1/chat/completions/batch'), RoutePattern(methods=['POST'], path='/v1/chat/completions/derender'), RoutePattern(methods=['POST'], path='/v1/chat/completions/render'), RoutePattern(methods=['POST'], path='/v1/completions'), RoutePattern(methods=['POST'], path='/v1/completions/derender'), RoutePattern(methods=['POST'], path='/v1/completions/render'), RoutePattern(methods=['POST'], path='/v1/messages'), RoutePattern(methods=['POST'], path='/v1/messages/count_tokens'), RoutePattern(methods=['GET'], path='/v1/models'), RoutePattern(methods=['GET'], path='/v1/models/{model:path}'), RoutePattern(methods=['POST'], path='/v1/responses'), RoutePattern(methods=['GET'], path='/v1/responses/{response_id}'), RoutePattern(methods=['POST'], path='/v1/responses/{response_id}/cancel'), RoutePattern(methods=['GET'], path='/version')])}.
(HAProxyManager pid=28089) INFO 2026-08-19 18:00:52,807 proxy 172.24.0.2 -- Got updated backend configs: [BackendConfig(app_name='anthropic-direct', name='http-anthropic-direct', path_prefix='/', servers=[ServerConfig(name='SERVE_REPLICA_anthropic-direct-LLMServer_claude-sonnet-4-5-20250929-d2ngfytn', host='127.0.0.1', port=30001)], ingress_request_router_servers=[ServerConfig(name='SERVE_REPLICA_anthropic-direct-LLMRouter-the5croz', host='127.0.0.1', port=30000)], fallback_server=ServerConfig(name='SERVE_PROXY_ACTOR-fallback-458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02', host='127.0.0.1', port=8500), protocol=HTTP)].
(HAProxyManager pid=28089) INFO 2026-08-19 18:00:52,850 proxy 172.24.0.2 -- Using HAProxy binary: /workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy
(HAProxyManager pid=28089) INFO 2026-08-19 18:00:52,862 proxy 172.24.0.2 -- Starting HAProxy (spawn #4, pid=30030, stdout=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.4.stdout.log, stderr=/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock.28089.4.stderr.log); args=['/workspace/ray/.venv/lib/python3.12/site-packages/ray_haproxy/bin/haproxy', '-db', '-f', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/haproxy.cfg', '-dR', '-sf', '28489', '-x', '/tmp/haproxy-serve/458b406f405b216f1957ecd79e1ef5562844f7859946a728042edf02/admin.sock']
(HAProxyManager pid=28089) INFO 2026-08-19 18:00:53,365 proxy 172.24.0.2 -- Successfully performed graceful HAProxy reload with process restart.
(ServeReplica:anthropic-direct:LLMRouter pid=28239) WARNING 2026-08-19 18:01:32,370 anthropic-direct_LLMRouter the5croz 3e847fa6-1f86-496f-a670-2464651d6a46 -- Could not derive a routing key from the request body. body_truncated=False. Falling back to load-balanced replica selection. A configured body-aware router such as PrefixCacheAffinityRouter cannot take effect for these requests. For truncated bodies, raise HAProxy's routing body limit.
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:01:32,371 anthropic-direct_LLMRouter the5croz 3e847fa6-1f86-496f-a670-2464651d6a46 -- POST __call__ 200 9.3ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:01:32 [loggers.py:310] Engine 000: Avg prompt throughput: 0.9 tokens/s, Avg generation throughput: 0.4 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 0.0%
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:01:33,039 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 3e847fa6-1f86-496f-a670-2464651d6a46 -- POST /v1/messages 200 667.2ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:01:42 [loggers.py:310] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 6.0 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 0.0%
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:01:52 [loggers.py:310] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 0.0 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 0.0%
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:02:02,652 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 24421355-01e1-48d9-b016-7afb5098491d -- GET / 404 1.0ms
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:02:12,425 anthropic-direct_LLMRouter the5croz 4493b8e2-932a-41ee-8e0f-a4b45319596d -- POST __call__ 200 1.6ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:02:15,711 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 4493b8e2-932a-41ee-8e0f-a4b45319596d -- POST /v1/messages 200 3285.7ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:02:22 [loggers.py:310] Engine 000: Avg prompt throughput: 3368.4 tokens/s, Avg generation throughput: 15.7 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 0.0%
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:02:32,616 anthropic-direct_LLMRouter the5croz 920cf95a-5398-416d-a19a-8288decc7d03 -- POST __call__ 200 1.1ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:02:32 [loggers.py:310] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 0.0 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 0.0%
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:02:32,815 anthropic-direct_LLMRouter the5croz dc6aa7a2-3730-4552-95ba-96bed59b6daf -- POST __call__ 200 1.1ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:02:37,409 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 920cf95a-5398-416d-a19a-8288decc7d03 -- POST /v1/messages 200 4792.0ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:02:42 [loggers.py:310] Engine 000: Avg prompt throughput: 80.4 tokens/s, Avg generation throughput: 165.5 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.5%, Prefix cache hit rate: 49.4%
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:02:44,368 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn dc6aa7a2-3730-4552-95ba-96bed59b6daf -- POST /v1/messages 200 11552.1ms
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:02:47,770 anthropic-direct_LLMRouter the5croz eb45f826-3872-415b-93a5-5be0abd3feb4 -- POST __call__ 200 1.0ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:02:48,665 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn eb45f826-3872-415b-93a5-5be0abd3feb4 -- POST /v1/messages 200 895.2ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:02:52 [loggers.py:310] Engine 000: Avg prompt throughput: 9.0 tokens/s, Avg generation throughput: 29.6 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 66.2%
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:02:56,524 anthropic-direct_LLMRouter the5croz 6bfc465f-2c52-4b3c-bd50-974a157306cc -- POST __call__ 200 1.0ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:03:00,567 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 6bfc465f-2c52-4b3c-bd50-974a157306cc -- POST /v1/messages 200 4042.2ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:03:02 [loggers.py:310] Engine 000: Avg prompt throughput: 21.5 tokens/s, Avg generation throughput: 41.5 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 74.5%
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:03:08,248 anthropic-direct_LLMRouter the5croz c088317c-581b-4dfb-a3be-33dbb8defadb -- POST __call__ 200 1.6ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:03:12,092 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn c088317c-581b-4dfb-a3be-33dbb8defadb -- POST /v1/messages 200 3843.7ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:03:12 [loggers.py:310] Engine 000: Avg prompt throughput: 6.6 tokens/s, Avg generation throughput: 39.0 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 79.6%
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:03:22 [loggers.py:310] Engine 000: Avg prompt throughput: 0.0 tokens/s, Avg generation throughput: 0.0 tokens/s, Running: 0 reqs, Waiting: 0 reqs, GPU KV cache usage: 0.0%, Prefix cache hit rate: 79.6%
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:03:29,659 anthropic-direct_LLMRouter the5croz 1998d5ae-3198-4eda-a1dd-45e32064890d -- POST __call__ 200 1.0ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 08-19 18:03:32 [loggers.py:310] Engine 000: Avg prompt throughput: 23.8 tokens/s, Avg generation throughput: 29.8 tokens/s, Running: 1 reqs, Waiting: 0 reqs, GPU KV cache usage: 8.7%, Prefix cache hit rate: 82.9%
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:03:33,318 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 1998d5ae-3198-4eda-a1dd-45e32064890d -- POST /v1/messages 200 3658.2ms
(ServeReplica:anthropic-direct:LLMRouter pid=28239) INFO 2026-08-19 18:03:36,924 anthropic-direct_LLMRouter the5croz 5ab0fc8c-60e9-4328-bf0c-82eadf6c8a81 -- POST __call__ 200 1.0ms
(ServeReplica:anthropic-direct:LLMServer:claude-sonnet-4-5-20250929 pid=28488) INFO 2026-08-19 18:03:38,933 anthropic-direct_LLMServer:claude-sonnet-4-5-20250929 d2ngfytn 5ab0fc8c-60e9-4328-bf0c-82eadf6c8a81 -- POST /v1/messages 200 2008.1ms

@vinay7373

Copy link
Copy Markdown
Contributor

Hello @wanadzhar913 and @eicherseiji, thanks for this PR. I stumbled on this PR while looking for v1/messages support. I went through the conversation and agree that direct streaming mostly solves this. One use case where I think the new plumbing may still be needed is multi-model behind one base URL.

Consider an agent like Claude Code that sends several model names to a single base URL and selecting by the model field (ANTHROPIC_MODEL for the main loop, ANTHROPIC_DEFAULT_HAIKU_MODEL for background/haiku tasks, CLAUDE_CODE_SUBAGENT_MODEL for subagents). Per the docs (https://code.claude.com/docs/en/model-config), "ANTHROPIC_BASE_URL changes where requests are sent, not which model answers them."

AFAIK direct streaming is single model per app today (limitations https://docs.ray.io/en/latest/serve/llm/user-guides/direct-streaming.html#limitations). So a request naming the second model just gets vLLM's The model ... does not exist back, and the documented workaround (one app per model on separate route prefixes) doesn't help a client that only has one base URL. The standard ingress already routes by model across deployments.

So if "multi-model behind one base URL" isn't on the near-term path for direct streaming then AnthropicIngress from this PR will be a useful bridge on the standard ingress path.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Sep 17, 2026
@wanadzhar913

Copy link
Copy Markdown
Contributor Author

/unstale

@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Sep 17, 2026
@wanadzhar913

Copy link
Copy Markdown
Contributor Author

Superceded by #66230, as per direction to move towards Direct Streaming (#66587 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community llm serve Ray Serve Related Issue unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ray serve] Add Native Anthropic Messages API (/v1/messages) Support to Ray Serve LLM

3 participants