LiteLLM Proxy
tracer never points the agent directly at your upstream model API. Instead, each job starts its own LiteLLM proxy, which normalizes the endpoint, exposes both OpenAI- and Anthropic-compatible protocols, and attaches the trajectory logger.
Why a proxy
- Protocol bridging — different agent scaffolds expect OpenAI or Anthropic message formats. The proxy serves both from one upstream model.
- Trajectory capture — the proxy's logger writes each request/response to
litellm-trajectory.jsonl, which is what makes the run reproducible and convertible to SFT data. - Isolation — each job gets a fresh, per-job config so concurrent or sequential jobs don't share state.
Configuration
The upstream model is declared in config.yaml under runtime_info.input.llm_api:
llm_api:
api_key: <your-key>
api_base_url: "https://your-openai-compatible-endpoint/v1"
model: "openai/Qwen3.6-35B-A3B"
protocols: [openai_compatible, anthropic_compatible]
served_via: per_job_litellm_proxy
input_cost_per_token: 0.0000021
output_cost_per_token: 0.0000084The proxy itself is configured under runtime_info.input.litellm_proxy:
litellm_proxy:
config_template: scripts/serve_llm/litellm_config.example.yaml
port: 4003
master_key: dummy-key-cfThe master key is the local proxy credential and may be a functional dummy.
The upstream llm_api.api_key is real and must not be committed.
Lifecycle
scripts/start.sh handles the proxy automatically:
- Renders a per-job config from the template into
artifacts/litellm/<job>/litellm_config_tracer.yaml. - Starts the proxy on
litellm_proxy.port, passing the config to Harbor's LiteLLM serve script viaLITELLM_CONFIG. - Starts the dedicated LiteLLM 1.83.14 environment and waits for the port to become reachable.
- Runs the Harbor job against the proxy.
- Stops the proxy from the EXIT trap and archives the run, including failures and interruptions.
Stop the proxy after the job
The proxy is a long-running process. If a hard interruption bypasses normal cleanup, stop only the process group started for this job and matched to its configured port. Never kill unrelated LiteLLM processes on a shared host.