API Reference
Complete reference for using the AICR API Server.
Overview
The AICR API Server provides HTTP REST access to recipe generation and bundle creation for GPU-accelerated infrastructure. Use the API for programmatic access to configuration recommendations and deployment artifacts.
API vs CLI
- Use the API for remote recipe generation and bundle creation
- Use the CLI for local operations, snapshot capture, and ConfigMap integration
Base URL
Local development (example):
Start the local server:
Quick Start
Get a Recipe
Generate an optimized configuration recipe for your environment:
Generate Bundles
Create deployment bundles from a recipe:
Endpoints
GET /
Service information and available routes.
Response:
GET /v1/recipe
Generate an optimized configuration recipe based on environment parameters.
Query Parameters:
Examples:
POST /v1/recipe
Generate an optimized configuration recipe from a criteria file body. This endpoint provides an alternative to query parameters, accepting a Kubernetes-style RecipeCriteria resource in the request body.
Content Types:
application/json- JSON formatapplication/x-yaml- YAML format
Request Body:
The request body must be a RecipeCriteria resource:
Examples:
Error Responses:
400 Bad Request- Invalid criteria format, missing required fields, or invalid enum values405 Method Not Allowed- Only GET and POST are supported
Response:
metadata.excludedOverlays is optional. When present, each entry includes the overlay name and a machine-readable reason such as constraint-failed or mixin-constraint-failed.
GET /v1/query
Query a specific value from a fully hydrated recipe. Resolves a recipe from criteria (same parameters as GET /v1/recipe), merges all base, overlay, and inline overrides, then returns the value at the given selector path.
Query Parameters:
All GET /v1/recipe parameters are supported, plus:
Response:
- Scalar values (string, number, bool) are returned as plain JSON values
- Complex values (maps, lists) are returned as JSON objects/arrays
Examples:
POST /v1/bundle
Generate deployment bundles from a recipe.
Query Parameters:
Request Body:
The request body is the recipe (RecipeResult) directly. No wrapper object needed.
Components
Bundler names correspond to component names in recipes/registry.yaml. Any component registered there can be passed as a bundler. Current components:
Examples:
Response Headers:
Bundle Structure
GET /health
Service health check (liveness probe).
Response:
GET /ready
Service readiness check (readiness probe).
Response:
GET /metrics
Prometheus metrics endpoint.
Key Metrics:
Complete Workflow Example
Fetch a recipe and generate bundles in one workflow:
Error Handling
Error Response Format
Error Codes
Handling Rate Limits
When rate limited (HTTP 429), use the Retry-After header:
Rate Limiting
- Limit: 100 requests per second per IP
- Burst: 200 requests
- Headers:
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset - 429 Response: Includes
Retry-Afterheader
Criteria Allowlists
The API server can be configured to restrict which criteria values are allowed. This enables operators to limit the API to specific accelerators, services, intents, or OS types.
Configuration
Allowlists are configured via environment variables when starting the server:
Behavior:
- If an environment variable is not set, all values for that criteria are allowed
- If an environment variable is set, only the specified values are permitted
- The
anyvalue is always allowed regardless of allowlist configuration - Allowlists apply to both
/v1/recipeand/v1/bundleendpoints
Example Configuration
Error Response
When a disallowed criteria value is requested:
Response (HTTP 400):
CLI Behavior
The CLI (aicr) is not affected by allowlists. Allowlists only apply to the API server, allowing operators to restrict API access while maintaining full CLI functionality for administrative tasks.
Programming Language Examples
Python
Go
JavaScript/Node.js
Shell Script (Batch Processing)
OpenAPI Specification
The full OpenAPI 3.1 specification is available at: api/aicr/v1/server.yaml
Generate client SDKs:
Troubleshooting
Common Issues
“Invalid accelerator type” error:
“Recipe is required” error:
Empty zip file:
Connection refused (local):
See Also
- CLI Reference - Command-line interface
- Agent Deployment - Kubernetes agent for snapshot capture
- Installation Guide - Setup instructions
- Data Flow - Understanding recipe data architecture
- Automation Guide - CI/CD integration patterns
- Kubernetes Deployment - Self-hosted API server deployment