GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Guide
  • Examples
  • Log in
  • Sign up

This view

  • Original page
  • New address

GeezerVison is showing modal.com — Proxy Tokens

Guide Introduction to Modal Getting started Functions Functions Invocation methods Function lookups Container lifecycle management Parametrized Functions Dynamic configuration Sandboxes Sandboxes Running commands Networking and security File access Snapshots Exit Snapshots BetaPricing and resources Sidecars BetaSecret injection BetaModel APIs Model APIs Models and pricing Agent integrations Endpoints Endpoints Supported models Candidates Training Quickstart Tinker-compatible API BetaMulti-node training Images Defining Images Using existing container images Named images Fast pull from registry GPUs and other resources GPU acceleration Using CUDA on Modal Configuring CPU, memory, and disk Scaling out Scaling out Input concurrency Batch processing Job queues Dynamic batching Multi-node Clusters Deployment Apps, Functions, and entrypoints Managing deployments Continuous deployment Scheduled Functions Observability HTTP Applications Servers Sticky Sessions Web Functions Streaming endpoints Web Function URLs Request timeouts Proxy Tokens Networking Tunnels Proxies BetaCluster networking Data sharing and storage Passing local data Volumes Storing model weights Cloud bucket mounts Dicts Queues Dataset ingestion Secrets and environment variables Secrets Environment variables Performance Cold start performance Memory Snapshots High-performance LLM inference Reliability and robustness Failures and retries Preemption Timeouts GPU health Troubleshooting Security and privacy Security and privacy Data residency Customer-supplied encryption keys AlphaAudit logs Integrations Using OIDC to authenticate with external services Connecting Modal to your Datadog account Connecting Modal to your OpenTelemetry provider Slack notifications Workspace & account settings Workspaces Environments Service users User groups Role-Based Access Control (RBAC) Billing Network egress billing Budgets Identity and provisioning Okta SSO Microsoft Entra SSO Google Workspace SSO Custom SAML SSO SCIM Integration Other topics Feature maturity Restricted Functions JavaScript/Go SDKs BetaModal 1.0 migration guide File and project structure Developing and debugging Jupyter notebooks Asynchronous API usage Global variables Region selection Localized placement GPU Metrics Search syntax

Proxy Tokens

Use Proxy Tokens to prevent unauthorized clients from reaching your Model APIs, Endpoints, Servers, and Web Functions. Proxy Tokens can be created in the Dashboard settings or with the modal workspace proxy-tokens CLI.

Authentication models 

Model APIs always require a Proxy Token. Endpoints and Servers require authentication by default. To accept public traffic instead, pass --unauthenticated to modal endpoint create or set unauthenticated=True in the @app.server() decorator:

@app.server()
class Private:
    ...


@app.server(unauthenticated=True)
class Public:
    ...

In contrast, Web Functions are publicly available by default. Enable authentication by setting requires_proxy_auth=True in the fastapi_endpoint, asgi_app, wsgi_app, or web_server decorators:

@app.function()
@modal.fastapi_endpoint()
def public():
    return "hello world"


@app.function()
@modal.fastapi_endpoint(requires_proxy_auth=True)
def private():
    return "hello friend"

The public endpoint can be hit by any client over the Internet:

curl https://public-url--goes-here.modal.run

The private endpoint cannot:

curl --fail-with-body https://private-url--goes-here.modal.run
# modal-http: missing credentials for proxy authorization
# curl: (22) The requested URL returned error: 401
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401

Authenticating requests 

A Proxy Token comprises a Token ID / Token Secret pair. Requests are authenticated by passing the pair in HTTP headers. They can be sent as separate Modal-Key and Modal-Secret headers:

export TOKEN_ID=wk-1234abcd
export TOKEN_SECRET=ws-1234abcd
curl -H "Modal-Key: $TOKEN_ID" \
     -H "Modal-Secret: $TOKEN_SECRET" \
     https://private-url--goes-here.modal.run

Alternatively, they can be joined with a period (.) and passed as a single Authorization: Bearer header:

export TOKEN_ID=wk-1234abcd
export TOKEN_SECRET=ws-1234abcd
curl -H "Authorization: Bearer $TOKEN_ID.$TOKEN_SECRET" \
     https://private-url--goes-here.modal.run

This is the same scheme the OpenAI API uses (Authorization: Bearer <api-key>), so the combined value can be used as the API key in any OpenAI-compatible client or gateway.

Environment scoping 

On Workspaces with RBAC enabled, tokens are scoped to specific Environments. See the RBAC guide for more information.

Blocking unauthenticated URLs 

Workspace Managers can prevent deployments in an Environment from exposing unauthenticated URLs — Endpoints created with --unauthenticated, Servers with unauthenticated=True, and Web Functions without requires_proxy_auth=True.

The control lives in Settings → Environments:

  • Workspace defaults sets a default that applies to every Environment unless the Environment overrides it.
  • Each Environment can Inherit the workspace default, or explicitly Block or Allow unauthenticated URLs.

When blocking is in effect, modal deploy, modal endpoint create, or creating an Endpoint through the Dashboard fail if proxy auth is not required.

Proxy TokensAuthentication modelsAuthenticating requestsEnvironment scopingBlocking unauthenticated URLs
See it in action
Create a Proxy Token
Deploy a proxy authorized endpoint
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.