Skip to main content
Genkit provides a unified API for working with AI models from different providers. Whether you’re using Gemini, Claude, GPT, Llama, or any other model, the interface is the same.

Model Abstraction

Genkit abstracts away provider-specific APIs into a single, consistent interface:
This abstraction means:
  • Switch providers easily: Change one line to try different models
  • Multi-model workflows: Use different models for different tasks
  • Consistent error handling: Same error types across providers
  • Unified tracing: All model calls appear the same in traces

Model References

Models are referenced by a namespace/name format:
Examples:
  • googleai/gemini-2.0-flash
  • anthropic/claude-3-5-sonnet
  • ollama/llama2
  • vertexai/gemini-1.5-pro

Generating Content

Basic Text Generation

Structured Output

Request JSON output that matches a schema:

Multimodal Input

Send images, audio, and video to multimodal models:

Model Configuration

Configure model behavior with parameters:

Default Configuration

Set defaults at the Genkit level:

Tool Calling

Models can call functions (tools) to extend their capabilities:

Streaming Responses

Stream responses as they’re generated:

Available Model Providers

Official Providers

Community Providers

  • Amazon Bedrock: Claude, Llama, Titan models
  • Mistral AI: Mistral, Mixtral models
  • Cohere: Command models + reranking
  • DeepSeek: DeepSeek models
  • xAI: Grok models
  • HuggingFace: Inference API models
  • Cloudflare Workers AI: Edge AI models
  • Azure AI Foundry: 11,000+ models

Model Middleware

Add behavior to model calls with middleware:
Common middleware:
  • Retry: Automatic retry with exponential backoff
  • Caching: Cache responses for identical requests
  • Safety: Filter harmful content
  • Logging: Log all requests/responses
  • Custom: Build your own

Response Metadata

All responses include metadata:

Next Steps

  • Learn about Prompts - managing prompt templates
  • Explore Tools - extending models with functions
  • See Flows - building multi-step AI workflows