Agent integrations
Use the hostname of your Model API as the agent’s model ID. Copy it from the dashboard.
If your agent asks for a base URL, use the region in the hostname. For example,
the base URL for my-endpoint.us-west.modal.direct is https://inference.us-west.modal.direct. For an EU model, use its eu-west hostname and https://inference.eu-west.modal.direct. Include /v1 when the agent’s configuration below shows it.
For the API key, join your Proxy Token ID and
secret with a period (wk-<id>.ws-<secret>). The token needs access to your
Model API’s Environment.
To list the model IDs your token can use, request /v1/models in the same region.
curl "https://inference.us-west.modal.direct/v1/models" \
-H "Authorization: Bearer $MODAL_PROXY_TOKEN_ID.$MODAL_PROXY_TOKEN_SECRET"OpenCode
Install OpenCode, run /connect, and select Modal
as the provider. Enter your Proxy Token
as the API key. Then run /models and
select your Model API by hostname.
For CI or other headless use, set the token in the environment instead of
running /connect:
export MODAL_PROXY_TOKEN="wk-<id>.ws-<secret>"By default, OpenCode’s Modal provider lists models from the us-west gateway.
Hermes Agent
Install Hermes Agent and install the Modal plugin:
hermes plugins install modalEnter your Proxy Token when prompted. Run hermes model, select Modal as the
provider, and select your Model API by hostname.
To use an Endpoint with Hermes,
set MODAL_BASE_URL to its base URL, for example https://<workspace>-<env>--<app>.<region>.modal.direct/v1.
To use an EU model, set MODAL_BASE_URL to an eu-west hostname or gateway.
Omp
Install Omp, run /login modal, and enter your Proxy Token.
Then run /model and select your Model API by hostname. Alternatively, set MODAL_BASE_URL to an Endpoint’s base URL, for example https://<workspace>-<env>--<app>.<region>.modal.direct/v1.
For CI or other headless use, set the token in the environment instead of
running /login modal:
export MODAL_PROXY_TOKEN="wk-<id>.ws-<secret>"To use an EU model, set MODAL_BASE_URL to an eu-west hostname or gateway.
Codex
Install Codex and define Modal as a
model provider in ~/.codex/config.toml:
# ~/.codex/config.toml
[model_providers.modal]
name = "Modal"
base_url = "https://inference.us-west.modal.direct/v1"
env_key = "MODAL_PROXY_TOKEN"
wire_api = "responses"Then you can run Codex via the following command with the Model API hostname as the model ID:
export MODAL_PROXY_TOKEN="$MODAL_PROXY_TOKEN_ID.$MODAL_PROXY_TOKEN_SECRET"
codex \
--model my-endpoint.us-west.modal.direct \
--config model_provider='"modal"'Claude Code
Install Claude Code. Set ANTHROPIC_AUTH_TOKEN to your Proxy Token and ANTHROPIC_MODEL to the hostname
of a Model API that supports tool calling.
export ANTHROPIC_BASE_URL="https://inference.us-west.modal.direct"
export ANTHROPIC_AUTH_TOKEN="wk-<id>.ws-<secret>"
export ANTHROPIC_MODEL="my-endpoint.us-west.modal.direct"
export ANTHROPIC_DEFAULT_FABLE_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_OPUS_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_SONNET_MODEL="$ANTHROPIC_MODEL"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="$ANTHROPIC_MODEL"
claude