Skip to content

Repository files navigation

spice oss logo

CodeQLLicense: Apache-2.0DiscordFollow on X

GitHub Actions Workflow Status - buildGitHub Actions Workflow Status - docker buildGitHub Actions Workflow Status - unit testsGitHub Actions Workflow Status - integration testsGitHub Actions Workflow Status - integration tests (models)GitHub Actions Workflow Status - benchmark tests

📄 Docs | ⚡️ Quickstart | 🧑‍🍳 Cookbook

Spice is a SQL query and AI compute engine, written in Rust, for data-driven apps and agents.

Spice.ai Open Source accelerated data query and LLM-inference engine

Spice provides four industry standard APIs in a lightweight, portable runtime (single binary/container):

  1. SQL Query APIs: Supports HTTP, Arrow Flight, Arrow Flight SQL, ODBC, JDBC, and ADBC.
  2. OpenAI-Compatible APIs: Provides HTTP APIs for OpenAI SDK compatibility, local model serving (CUDA/Metal accelerated), and hosted model gateway.
  3. Iceberg Catalog REST APIs: Offers a unified API for Iceberg Catalog.
  4. MCP HTTP+SSE APIs: Enables integration with external tools via Model Context Protocol (MCP) using HTTP and Server-Sent Events (SSE).

🎯 Goal: Developers can focus on building data apps and AI agents confidently, knowing they are grounded in data.

Spice is primarily used for:

If you want to build with DataFusion or using DuckDB, Spice provides a simple, flexible, and production-ready engine you can just use.

📣 Read the Spice.ai 1.0-stable announcement.

Spice is built-on industry leading technologies including Apache DataFusion, Apache Arrow, Arrow Flight, SQLite, and DuckDB.

How Spice works.

🎥 Watch the CMU Databases Accelerating Data and AI with Spice.ai Open-Source 🎥 Watch How to Query Data using Spice, OpenAI, and MCP

Why Spice?

Spice.ai

Spice simplifies building data-driven AI applications and agents by making it fast and easy to query, federate, and accelerate data from one or more sources using SQL, while grounding AI in real-time, reliable data. Co-locate datasets with apps and AI models to power AI feedback loops, enable RAG and search, and deliver fast, low-latency data-query and AI-inference with full control over cost and performance.

How is Spice different?

  1. AI-Native Runtime: Spice combines data query and AI inference in a single engine, for data-grounded AI and accurate AI.

  2. Application-Focused: Designed to run distributed at the application and agent level, often as a 1:1 or 1:N mapping between app and Spice instance, unlike traditional data systems built for many apps on one centralized database. It’s common to spin up multiple Spice instances—even one per tenant or customer.

  3. Dual-Engine Acceleration: Supports both OLAP (Arrow/DuckDB) and OLTP (SQLite/PostgreSQL) engines at the dataset level, providing flexible performance across analytical and transactional workloads.

  4. Disaggregated Storage: Separation of compute from disaggregated storage, co-locating local, materialized working sets of data with applications, dashboards, or ML pipelines while accessing source data in its original storage.

  5. Edge to Cloud Native: Deploy as a standalone instance, Kubernetes sidecar, microservice, or cluster—across edge/POP, on-prem, and public clouds. Chain multiple Spice instances for tier-optimized, distributed deployments.

How does Spice compare?

Data Query and Analytics

FeatureSpiceTrino / PrestoDremioClickHouseMaterialize
Primary Use-CaseData & AI apps/agentsBig data analyticsInteractive analyticsReal-time analyticsReal-time analytics
Primary deployment modelSidecarClusterClusterClusterCluster
Federated Query Support
Acceleration/Materialization✅ (Arrow, SQLite, DuckDB, PostgreSQL)Intermediate storageReflections (Iceberg)Materialized views✅ (Real-time views)
Catalog Support✅ (Iceberg, Unity Catalog)
Query Result CachingLimited
Multi-Modal Acceleration✅ (OLAP + OLTP)
Change Data Capture (CDC)✅ (Debezium)✅ (Debezium)

AI Apps and Agents

FeatureSpiceLangChainLlamaIndexAgentOps.aiOllama
Primary Use-CaseData & AI appsAgentic workflowsRAG appsAgent operationsLLM apps
Programming LanguageAny language (HTTP interface)JavaScript, PythonPythonPythonAny language (HTTP interface)
Unified Data + AI Runtime
Federated Data Query
Accelerated Data Access
Tools/Functions✅ (MCP HTTP+SSE)LimitedLimited
LLM Memory
Evaluations (Evals)LimitedLimited
Search✅ (VSS)LimitedLimited
Caching✅ (Query and results caching)Limited
Embeddings✅ (Built-in & pluggable models/DBs)Limited

✅ = Fully supported ❌ = Not supported Limited = Partial or restricted support

Example Use-Cases

Data-grounded Agentic AI Applications

  • OpenAI-compatible API: Connect to hosted models (OpenAI, Anthropic, xAI) or deploy locally (Llama, NVIDIA NIM). AI Gateway Recipe
  • Federated Data Access: Query using SQL and NSQL (text-to-SQL) across databases, data warehouses, and data lakes with advanced query push-down for fast retrieval across disparate data sources. Federated SQL Query Recipe
  • Search and RAG: Search and retrieve context with accelerated embeddings for retrieval-augmented generation (RAG) workflows. Vector Search over GitHub Files
  • LLM Memory and Observability: Store and retrieve history and context for AI agents while gaining deep visibility into data flows, model performance, and traces. LLM Memory Recipe | Observability & Monitoring Features Documentation

Database CDN and Query Mesh

  • Data Acceleration: Co-locate materialized datasets in Arrow, SQLite, and DuckDB with applications for sub-second query. DuckDB Data Accelerator Recipe
  • Resiliency and Local Dataset Replication: Maintain application availability with local replicas of critical datasets. Local Dataset Replication Recipe
  • Responsive Dashboards: Enable fast, real-time analytics by accelerating data for frontends and BI tools. Sales BI Dashboard Demo
  • Simplified Legacy Migration: Use a single endpoint to unify legacy systems with modern infrastructure, including federated SQL querying across multiple sources. Federated SQL Query Recipe

Retrieval-Augmented Generation (RAG)

FAQ

  • Is Spice a cache? No specifically; you can think of Spice data acceleration as an active cache, materialization, or data prefetcher. A cache would fetch data on a cache-miss while Spice prefetches and materializes filtered data on an interval, trigger, or as data changes using CDC. In addition to acceleration Spice supports results caching.

  • Is Spice a CDN for databases? Yes, a common use-case for Spice is as a CDN for different data sources. Using CDN concepts, Spice enables you to ship (load) a working set of your database (or data lake, or data warehouse) where it's most frequently accessed, like from a data-intensive application or for AI context.

➡️ Docs FAQ

Watch a 30-sec BI dashboard acceleration demo

BI.dashboard.acceleration.with.Spice.mp4

See more demos on YouTube.

Supported Data Connectors

NameDescriptionStatusProtocol/Format
databricks (mode: delta_lake)DatabricksStableS3/Delta Lake
delta_lakeDelta LakeStableDelta Lake
dremioDremioStableArrow Flight
duckdbDuckDBStableEmbedded
fileFileStableParquet, CSV
githubGitHubStableGitHub API
postgresPostgreSQLStable
s3S3StableParquet, CSV
mysqlMySQLStable
graphqlGraphQLRelease CandidateJSON
spice.aiSpice.aiRelease CandidateArrow Flight
databricks (mode: spark_connect)DatabricksBetaSpark Connect
flightsqlFlightSQLBetaArrow Flight SQL
icebergApache IcebergBetaParquet
mssqlMicrosoft SQL ServerBetaTabular Data Stream (TDS)
odbcODBCBetaODBC
snowflakeSnowflakeBetaArrow
sparkSparkBetaSpark Connect
abfsAzure BlobFSAlphaParquet, CSV
clickhouseClickhouseAlpha
debeziumDebezium CDCAlphaKafka + JSON
dynamodbAmazon DynamoDBAlpha
ftp, sftpFTP/SFTPAlphaParquet, CSV
http, httpsHTTP(s)AlphaParquet, CSV
imapIMAPAlphaIMAP Emails
localpodLocal dataset replicationAlpha
sharepointMicrosoft SharePointAlphaUnstructured UTF-8 documents
mongodbMongoDBComing Soon
elasticsearchElasticSearchRoadmap

Supported Data Accelerators

NameDescriptionStatusEngine Modes
arrowIn-Memory Arrow RecordsStablememory
duckdbEmbedded DuckDBStablememory, file
postgresAttached PostgreSQLRelease CandidateN/A
sqliteEmbedded SQLiteRelease Candidatememory, file

Supported Model Providers

NameDescriptionStatusML Format(s)LLM Format(s)
openaiOpenAI (or compatible) LLM endpointRelease Candidate-OpenAI-compatible HTTP endpoint
fileLocal filesystemRelease CandidateONNXGGUF, GGML, SafeTensor
huggingfaceModels hosted on HuggingFaceRelease CandidateONNXGGUF, GGML, SafeTensor
spice.aiModels hosted on the Spice.ai Cloud PlatformONNXOpenAI-compatible HTTP endpoint
azureAzure OpenAI-OpenAI-compatible HTTP endpoint
anthropicModels hosted on AnthropicAlpha-OpenAI-compatible HTTP endpoint
xaiModels hosted on xAIAlpha-OpenAI-compatible HTTP endpoint

Supported Embeddings Providers

NameDescriptionStatusML Format(s)LLM Format(s)*
openaiOpenAI (or compatible) LLM endpointRelease Candidate-OpenAI-compatible HTTP endpoint
fileLocal filesystemRelease CandidateONNXGGUF, GGML, SafeTensor
huggingfaceModels hosted on HuggingFaceRelease CandidateONNXGGUF, GGML, SafeTensor
azureAzure OpenAIAlpha-OpenAI-compatible HTTP endpoint

Supported Catalogs

Catalog Connectors connect to external catalog providers and make their tables available for federated SQL query in Spice. Configuring accelerations for tables in external catalogs is not supported. The schema hierarchy of the external catalog is preserved in Spice.

NameDescriptionStatusProtocol/Format
unity_catalogUnity CatalogStableDelta Lake
databricksDatabricksBetaSpark Connect, S3/Delta Lake
icebergApache IcebergBetaParquet
spice.aiSpice.ai Cloud PlatformBetaArrow Flight
glueAWS GlueComing SoonJSON, Parquet, Iceberg

⚡️ Quickstart (Local Machine)

quickstart.mp4

Installation

Install the Spice CLI:

On macOS, Linux, and WSL:

curl https://install.spiceai.org | /bin/bash

Or using brew:

brew install spiceai/spiceai/spice

On Windows using PowerShell:

iex ((New-Object System.Net.WebClient).DownloadString("https://install.spiceai.org/Install.ps1"))

Usage

Step 1. Initialize a new Spice app with the spice init command:

spice init spice_qs

A spicepod.yaml file is created in the spice_qs directory. Change to that directory:

cd spice_qs

Step 2. Start the Spice runtime:

spice run

Example output will be shown as follows:

2025/01/20 11:26:10 INFO Spice.ai runtime starting...
2025-01-20T19:26:10.679068Z INFO runtime::init::dataset: No datasets were configured. If this is unexpected, check the Spicepod configuration.
2025-01-20T19:26:10.679716Z INFO runtime::flight: Spice Runtime Flight listening on 127.0.0.1:50051
2025-01-20T19:26:10.679786Z INFO runtime::metrics_server: Spice Runtime Metrics listening on 127.0.0.1:9090
2025-01-20T19:26:10.680140Z INFO runtime::http: Spice Runtime HTTP listening on 127.0.0.1:8090
2025-01-20T19:26:10.682080Z INFO runtime::opentelemetry: Spice Runtime OpenTelemetry listening on 127.0.0.1:50052
2025-01-20T19:26:10.879126Z INFO runtime::init::results_cache: Initialized results cache; max size: 128.00 MiB, item ttl: 1s

The runtime is now started and ready for queries.

Step 3. In a new terminal window, add the spiceai/quickstart Spicepod. A Spicepod is a package of configuration defining datasets and ML models.

spice add spiceai/quickstart

The spicepod.yaml file will be updated with the spiceai/quickstart dependency.

version: v1kind: Spicepodname: spice_qsdependencies:
- spiceai/quickstart

The spiceai/quickstart Spicepod will add a taxi_trips data table to the runtime which is now available to query by SQL.

2025-01-20T19:26:30.011633Z INFO runtime::init::dataset: Dataset taxi_trips registered (s3://spiceai-demo-datasets/taxi_trips/2024/), acceleration (arrow), results cache enabled.
2025-01-20T19:26:30.013002Z INFO runtime::accelerated_table::refresh_task: Loading data for dataset taxi_trips
2025-01-20T19:26:40.312839Z INFO runtime::accelerated_table::refresh_task: Loaded 2,964,624 rows (399.41 MiB) fordataset taxi_tripsin 10s 299ms

Step 4. Start the Spice SQL REPL:

spice sql

The SQL REPL inferface will be shown:

Welcome to the Spice.ai SQL REPL! Type 'help'for help.
show tables; -- list available tables
sql>

Enter show tables; to display the available tables for query:

sql> show tables;
+---------------+--------------+---------------+------------+
| table_catalog | table_schema | table_name | table_type |
+---------------+--------------+---------------+------------+
| spice | public | taxi_trips | BASE TABLE || spice | runtime | query_history | BASE TABLE || spice | runtime | metrics | BASE TABLE |
+---------------+--------------+---------------+------------+
Time: 0.022671708 seconds. 3 rows.

Enter a query to display the longest taxi trips:

SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESCLIMIT10;

Output:

+---------------+--------------+
| trip_distance | total_amount |
+---------------+--------------+
| 312722.3 | 22.15 || 97793.92 | 36.31 || 82015.45 | 21.56 || 72975.97 | 20.04 || 71752.26 | 49.57 || 59282.45 | 33.52 || 59076.43 | 23.17 || 58298.51 | 18.63 || 51619.36 | 24.2 || 44018.64 | 52.43 |
+---------------+--------------+
Time: 0.045150667 seconds. 10 rows.

⚙️ Runtime Container Deployment

Using the Docker image locally:

docker pull spiceai/spiceai

In a Dockerfile:

from spiceai/spiceai:latest

Using Helm:

helm repo add spiceai https://helm.spiceai.org
helm install spiceai spiceai/spiceai

🏎️ Next Steps

Explore the Spice.ai Cookbook

The Spice.ai Cookbook is a collection of recipes and examples for using Spice. Find it at https://github.com/spiceai/cookbook.

Using Spice.ai Cloud Platform

Access ready-to-use Spicepods and datasets hosted on the Spice.ai Cloud Platform using the Spice runtime. A list of public Spicepods is available on Spicerack: https://spicerack.org/.

To use public datasets, create a free account on Spice.ai:

  1. Visit spice.ai and click Try for Free. Try for Free

  2. After creating an account, create an app to generate an API key. Create App

Once set up, you can access ready-to-use Spicepods including datasets. For this demonstration, use the taxi_trips dataset from the Spice.ai Quickstart.

Step 1. Initialize a new project.

# Initialize a new Spice app
spice init spice_app
# Change to app directorycd spice_app

Step 2. Log in and authenticate from the command line using the spice login command. A pop up browser window will prompt you to authenticate:

spice login

Step 3. Start the runtime:

# Start the runtime
spice run

Step 4. Configure the dataset:

In a new terminal window, configure a new dataset using the spice dataset configure command:

spice dataset configure

Enter a dataset name that will be used to reference the dataset in queries. This name does not need to match the name in the dataset source.

dataset name: (spice_app) taxi_trips

Enter the description of the dataset:

description: Taxi trips dataset

Enter the location of the dataset:

from: spice.ai/spiceai/quickstart/datasets/taxi_trips

Select y when prompted whether to accelerate the data:

Locally accelerate (y/n)? y

You should see the following output from your runtime terminal:

2024-12-16T05:12:45.803694Z INFO runtime::init::dataset: Dataset taxi_trips registered (spice.ai/spiceai/quickstart/datasets/taxi_trips), acceleration (arrow, 10s refresh), results cache enabled.
2024-12-16T05:12:45.805494Z INFO runtime::accelerated_table::refresh_task: Loading data for dataset taxi_trips
2024-12-16T05:13:24.218345Z INFO runtime::accelerated_table::refresh_task: Loaded 2,964,624 rows (8.41 GiB) fordataset taxi_tripsin 38s 412ms.

Step 5. In a new terminal window, use the Spice SQL REPL to query the dataset

spice sql
SELECT tpep_pickup_datetime, passenger_count, trip_distance from taxi_trips LIMIT 10;

The output displays the results of the query along with the query execution time:

+----------------------+-----------------+---------------+
| tpep_pickup_datetime | passenger_count | trip_distance |
+----------------------+-----------------+---------------+
| 2024-01-11T12:55:12 | 1 | 0.0 || 2024-01-11T12:55:12 | 1 | 0.0 || 2024-01-11T12:04:56 | 1 | 0.63 || 2024-01-11T12:18:31 | 1 | 1.38 || 2024-01-11T12:39:26 | 1 | 1.01 || 2024-01-11T12:18:58 | 1 | 5.13 || 2024-01-11T12:43:13 | 1 | 2.9 || 2024-01-11T12:05:41 | 1 | 1.36 || 2024-01-11T12:20:41 | 1 | 1.11 || 2024-01-11T12:37:25 | 1 | 2.04 |
+----------------------+-----------------+---------------+
Time: 0.00538925 seconds. 10 rows.

You can experiment with the time it takes to generate queries when using non-accelerated datasets. You can change the acceleration setting from true to false in the datasets.yaml file.

📄 Documentation

Comprehensive documentation is available at spiceai.org/docs.

Over 45 quickstarts and samples available in the Spice Cookbook.

🔌 Extensibility

Spice.ai is designed to be extensible with extension points documented at EXTENSIBILITY.md. Build custom Data Connectors, Data Accelerators, Catalog Connectors, Secret Stores, Models, or Embeddings.

🔨 Upcoming Features

🚀 See the Roadmap for upcoming features.

🤝 Connect with us

We greatly appreciate and value your support! You can help Spice in a number of ways:

⭐️ star this repo! Thank you for your support! 🙏

About

A portable accelerated data query and LLM-inference engine, written in Rust, for data-grounded AI apps and agents.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages