Skip to main content

Model name parsing

Harbor uses LiteLLM to parse model slugs during setup. Use the same LiteLLM model slug across all agents. Browse Harbor Model Lookup, or enter a model name below to see its provider and parsed model name.
  • Input model (-m) → Your original model name.
  • Parsed provider → Selects Harbor’s built-in credential and endpoint mappings.
  • Parsed model ID → Usually sent to the inference provider; adapters may transform it.
Try openai/gpt-6-sol, openrouter/openai/gpt-6-sol, anthropic/claude-sonnet-5-5, deepseek/deepseek-v4-flash, or fireworks_ai/accounts/my-account/models/my-custom-model. Model slugs that cannot be parsed by LiteLLM are forwarded directly to the agent. Each agent adapter may then infer the provider from the model slug.

Automatic Secret Collection

For recognized providers and built-in agents, Harbor supports automatic secret collection from host environment variables. This behavior is agent and provider specific, unrelated host variables are not forwarded. See your agent’s auth settings.
These agent-specific variables are recognized in addition to provider variables.ACP registry agents do not use this automatic forwarding; always pass their credentials with --agent-env.

Automatic Secret Routing

For built-in agents, Harbor automatically matches model provider secrets to the expected agent api key name. This means you can use your OPENROUTER_API_KEY even though Codex reads OPENAI_API_KEY; Harbor handles the rename for you. For example, when using OpenRouter with Codex, Codex only expects the API key in OPENAI_API_KEY. Harbor assigns the value of OPENROUTER_API_KEY to OPENAI_API_KEY so Codex can authenticate with OpenRouter. This lets you use one provider key, such as OPENROUTER_API_KEY, across multiple agents without knowing each agent’s native credential variable name. It is especially useful for benchmark sweeps that compare different agents using the same model and provider.

Automatic Secret Routing rules

Recommended: use --dry-run first. You don’t need to understand all the routing rules—it shows the resolved credential, endpoint, model, and API format.
When multiple secrets are supplied that match either the provider or the agent, Harbor uses the following precedence rules to determine which secret is utilized.
  1. --api-key-name ENV_VAR_NAME
  2. --agent-env ENV_VAR_NAME matching the parsed model slug’s provider
  3. --agent-env ENV_VAR_NAME matching the chosen agent’s declared defaults
  4. Host environment variables matching the parsed model slug’s provider
  5. Host environment variables matching the chosen agent’s declared provider
Use harbor run --dry-run to see which variable will be chosen in order of precedence.
Use the Model Auth Override options in harbor run, harbor job start, or harbor trial start when you need a different endpoint, credential variable, or API format:
--base-url, --api-key-name, and --api-format can each be used independently, without --skip-model-parsing-and-provider-mapping. When you enable --skip-model-parsing-and-provider-mapping, you will typically use these overrides together to specify the endpoint, credential variable, and API format explicitly.
Base URL environment variable injection follows the same selection and routing rules as credentials.

Advanced

Parsing and credential mapping under the hood

LiteLLM splits the model name into a provider and model ID. Harbor then looks up that provider in PROVIDERS and combines its credential and endpoint candidates with the agent’s declared fallbacks and any explicit overrides. If parsing does not identify a provider, Harbor uses the agent’s default_provider. After applying precedence, Harbor writes the selected credential value to the agent’s declared destination. In this Codex example, the value of OPENROUTER_API_KEY is injected as OPENAI_API_KEY.
Model parsing and credential routing: LiteLLM identifies OpenRouter, Harbor applies overrides then provider credentials then Codex fallbacks, and injects the selected value into OPENAI_API_KEY.
Model parsing and credential routing: LiteLLM identifies OpenRouter, Harbor applies overrides then provider credentials then Codex fallbacks, and injects the selected value into OPENAI_API_KEY.

Skipping model parsing and credential mapping

In certain cases, such as hosting a local model, it may be necessary to skip the model name parsing and subsequent credential mapping. To accomplish this, use --skip-model-parsing-and-provider-mapping (or --sm) in your harbor run command. With --skip-model-parsing-and-provider-mapping, Harbor preserves the model name exactly and uses harbor-skip-parsing as the provider marker. The red steps above (LiteLLM parsing and provider mapping) are skipped. The agent’s declared fallbacks, explicit overrides, precedence, and credential injection still apply. In this example, --api-key-name CUSTOM_KEY selects the value of CUSTOM_KEY, which Codex receives as OPENAI_API_KEY. Skipping parsing does not disable this final injection step.
Skipping model parsing: the local model path is preserved, provider lookup is bypassed, and an explicit CUSTOM_KEY override is injected into Codex as OPENAI_API_KEY.
Skipping model parsing: the local model path is preserved, provider lookup is bypassed, and an explicit CUSTOM_KEY override is injected into Codex as OPENAI_API_KEY.

Inspecting agent auth settings

Browse Harbor Agent Auth Lookup to see each agent’s credential mappings, default endpoints, and supported API format overrides. Use harbor agent auth <agent> to inspect an agent’s default provider, credential and endpoint routing, and supported API formats.
Harbor provider defaults (bypassed by --skip-model-parsing-and-provider-mapping)Agent connection settings

Selecting API formats

An API format defines how the agent communicates with the model provider. Claude Code supports only Anthropic Messages, while agents such as Grok Build support multiple formats. Harbor selects the agent’s default format for the provider identified by LiteLLM. Use --api-format to override this default. Values are openai_responses, openai_chat_completions, anthropic_messages, google_generate_content, and bedrock_converse. Each agent accepts only the formats it supports.

Routing across API formats

The provider determines where Harbor looks for credentials and which endpoint it uses. The agent’s selected API format determines how it sends requests and which variable receives the credential. These can differ even for the same agent. Some agents read the same credential variable for every provider; others change it based on the API format. Grok Build is an example of the latter: In the OpenRouter case, OPENAI_API_KEY is the variable Grok Build reads; requests still go to OpenRouter using the OpenRouter credential. For a custom endpoint, use --api-format to select its protocol, --api-key-name to select the credential source, and --base-url to select the endpoint. The agent still determines the destination variable.

Local Models

Local models may require explicit routing to preserve the model name and select the endpoint and credential. This Codex example assumes a vLLM server with Responses and tool calling support, serving the model as /dev/shm/my-model:
vLLM does not require authentication by default; if you enable --api-key, set VLLM_API_KEY to that value. Replace the URL with your server’s address as seen from the agent environment. host.docker.internal reaches the host from Docker on macOS; localhost inside the agent refers to its own container.