Using Gemma 2B Instruct on Replicate API
Implementation guide · Gemma · Google DeepMind
Replicate API exposes Gemma 2B Instruct through model ID google-deepmind/gemma-2b-it. Use the setup steps, sourced pricing, capabilities, and official provider links below to validate this route before deployment.
Last refreshed 2026-04-19. Next refresh: weekly.
Quick Start
- 1
- 2Use the Replicate API SDK or REST API to call
google-deepmind/gemma-2b-it— see the documentation for request format. - 3
Code Examples
pip install replicateREPLICATE_API_TOKENgoogle-deepmind/gemma-2b-itReplicate uses "owner/model-name" format (e.g. "meta/meta-llama-3-8b-instruct") for the latest version, or "owner/model-name:version-sha" to pin to a specific version. The REST endpoint splits owner and model-name into the path: /v1/models/{owner}/{model-name}/predictions.
import replicate
# reads REPLICATE_API_TOKEN from env
# google-deepmind/gemma-2b-it format: "owner/model-name" (latest version) or "owner/model-name:version-hash"
output = replicate.run(
"google-deepmind/gemma-2b-it",
input={"prompt": "Hello"}
)
# Output is a list or generator depending on the model
print("".join(output))Pricing on Replicate API
| Type | Price (per 1M) |
|---|---|
| Input tokens | $0.05 |
| Output tokens | $0.25 |
Capabilities
About Gemma 2B Instruct
Gemma 2B Instruct is a large language model developed by Google, designed to balance performance and accessibility with its 2 billion parameters. Derived from the Gemini family, it excels in tasks such as text generation, code interpretation, and mathematical problem-solving. Built on a transformer decoder architecture, it features multi-query attention, RoPE, GeGLU activations, and RMSNorm. Trained on approximately 6 trillion tokens, including web documents, code, and mathematical content, it uses SFT and RLHF for instruction-tuning. Notable for its lightweight design permitting deployment on consumer-grade hardware, it's open-source and optimized for dialogue applications.