Skip to main content
Deploy Gemma 4 E2B Instruct through Explore, the Baseten CLI, or the Management API. Each path creates a dedicated endpoint that you can call from Python. You’ll need a Baseten account. This example uses an L4 GPU. Review pricing before deploying; provisioned replicas incur charges even while idle.

Deploy the model

Follow one tab. Each creates a separate deployment of the same model. Explore supplies a suggested configuration; the CLI and API use the Gemma recipe, so serving settings can differ.

Install and sign in

Terminal
For other platforms or a specific version, see the Baseten CLI install reference.Sign in:
Terminal

Prepare the configuration

Create a project directory:
Terminal
Copy config.yaml from the E2B tab of the Gemma 4 recipe into this directory. It defines the weights, vLLM server, and L4 hardware.Accept the model’s Hugging Face terms. Save a read token with access to its weights in Baseten secrets as hf_access_token, the name used by the recipe.

Push the configuration

From the project directory, run:
--tail shows logs; --wait waits for Active. Save your model ID and continue to call the model.

Wait for the deployment

Open Dedicated Inference in the dashboard, select your model, and wait for Active. The CLI’s --wait flag already waits for this state. If startup fails, check the deployment’s build and runtime logs. For API automation, poll Get deployment with the model and deployment IDs until status is ACTIVE.

Call the model

Use the same OpenAI-compatible request for any deployment path. Find your model ID in the CLI or API output, or select Copy ID beside the model name in the dashboard. Create a personal key in API keys if you don’t have one. Set it in the terminal where you’ll run the client:
Save this as chat.py and replace {model_id} with your model ID:
chat.py
Run it with uv. The response wording varies:
The URL selects your deployed model’s production environment. The model field matches the serving name in its configuration.

Clean up

Exiting the client script doesn’t stop the deployment. When you’re finished testing, deactivate the deployment to release its replicas and stop its compute charges. Its endpoint stops serving requests; the model and configuration remain available for reactivation.
  1. Open Dedicated Inference in the dashboard and select the model you created.
  2. Under Deployments, select the deployment you used in this example.
  3. Select Deactivate deployment, then Yes, deactivate.
  4. Wait for the deployment’s status to become Inactive.
See Manage the deployment lifecycle to reactivate it later.

Next steps