anthropic.py
Python · 259 lines21 class Valves(BaseModel):22 ANTHROPIC_API_KEY: str = Field(default="")23 24 def __init__(self):25 self.type = "manifold"26 self.id = "anthropic"27 self.name = "anthropic/"28 self.valves = self.Valves(29 **{"ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY", "")}30 )31 self.MAX_IMAGE_SIZE = 5 * 1024 * 1024 # 5MB per image32 Anthropic Manifold Pipe
A simple Python interface to interact with Anthropic language models via the Open Web UI manifold pipe system.
Features
- Supports multiple Anthropic models.
- Handles text and image inputs (with size validation).
- Supports streaming and non-streaming responses.
- Easy to configure with your Anthropic API key.
Notes
- Images must be under 5MB each and total under 100MB for a request.
- The model name should be prefixed with
"anthropic."(e.g.,"anthropic.claude-3-opus-20240229"). - Errors during requests are returned as strings.
License
MIT License
Authors
- justinh-rahb (GitHub)
- christian-taillon
0
3 
