Vellum AI Python SDK

raw JSON →
1.14.7 verified Fri May 01 auth: no python

Vellum is an AI workflow platform that allows you to build, deploy, and manage AI applications. The Python SDK provides programmatic access to Vellum's APIs for workflow execution, prompt management, and model deployment. Current stable version is 1.14.7, with active development and frequent releases.

pip install vellum-ai
error ModuleNotFoundError: No module named 'vellum_ai'
cause Attempting to import from the incorrect module name
fix
Use 'import vellum' or 'from vellum import ...'
error vellum.exceptions.InvalidApiKeyError: API key is invalid or missing
cause Missing or incorrect VELLUM_API_KEY environment variable
fix
Set VELLUM_API_KEY environment variable or pass api_key argument to VellumClient
gotcha The pip package is 'vellum-ai', but the Python module is just 'vellum'. Many users incorrectly import from 'vellum_ai' which does not exist.
fix Use 'import vellum' or 'from vellum import ...'
breaking In version 1.14.0, the Port class added __rrshift__ method which changes how ports behave with operators. If you were using manual port assignments, this may cause unexpected behavior.
fix Review port usage if using >> operator with Port objects.
deprecated The 'hosted_by' field has been added to ML Model responses. Deprecations may apply to older model fields.
fix Check release notes for deprecated fields.

Initialize the client with API key and execute a workflow deployment.

import os
from vellum import VellumClient

client = VellumClient(api_key=os.environ.get('VELLUM_API_KEY', ''))
# Execute a workflow
result = client.execute_workflow(
    workflow_deployment_name="my_workflow",
    inputs={"question": "What is the capital of France?"}
)
print(result)