Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2025 06:28 AM
Was successful creating an endpoint using the API rather than the UI:
import requests
import json
# Set the name of the MLflow endpoint
endpoint_name = "test-throughput-endpoint"
# Name of the foundation model in Unity Catalog
model_name = "system.ai.llama-4-maverick"
# Get the API endpoint and token for the current notebook context
API_ROOT = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiUrl().get()
API_TOKEN = dbutils.notebook.entry_point.getDbutils().notebook().getContext().apiToken().get()
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {API_TOKEN}"}
# Configuration for Unity Catalog foundation model
data = {
"name": endpoint_name,
"config": {
"served_entities": [
{
"entity_name": model_name,
"entity_version": "1", # Use string version for UC models
"workload_size": "Small", # Foundation models typically need GPU
"scale_to_zero_enabled": True
}
]
},
}
response = requests.post(
url=f"{API_ROOT}/api/2.0/serving-endpoints",
json=data,
headers=headers
)
print(f"Status Code: {response.status_code}")
print(json.dumps(response.json(), indent=4))