Serve hosted and local AI models next to your data
Spice serves hosted and local AI models from the same runtime that queries your data. Call chat and decision models through OpenAI-compatible APIs or from SQL, with no separate inference server.

Do more with your data
Increase the reliability, performance, and security of data-driven AI workflows.
100x
up to 100x faster queries
80%
up to 80% cost savings on data lakehouse spend
2x
increase in data reliability for critical workloads
AI grounded in your data
Spice runs local models in the same process as the accelerated data they read, and it calls hosted models from that same runtime. Tools such as sql and search let each chat model answer from federated and accelerated datasets, which reduces hallucinations.
View the docs

Flexible models and deployments
Serve commercial models from OpenAI, Anthropic, xAI, Google, and Amazon Bedrock, or open-weight models from Hugging Face, in one Spicepod. The same runtime deploys on a laptop, in Kubernetes, at the edge, or in Spice Cloud.
View the docs

Built-in tooling and memory
Give models built-in tools for SQL queries, search, and table schemas. The memory tools store facts in a read-write memory dataset, so a model can recall them in later conversations.
View the docs

AI sandboxing
Limit what each model can reach. A model calls only the tools in its tools parameter. The built-in data tools query only the datasets in its datasets list, and MCP tools call their configured MCP servers. Task history, on by default, records each call.
View the docs

Integrations across all your data sources
Spice connects to OpenAI, Anthropic, xAI, Azure OpenAI, Google Vertex AI, Amazon Bedrock, Databricks, TypeSafe, and OpenAI-compatible endpoints such as NVIDIA NIM. It also runs Hugging Face and local models. Every model shares one runtime for API access, rate limits, and observability, and chat models also share its tools.

Deployed in production
Teams use Spice to run AI inference next to their data in production.

“Partnering with Spice AI has transformed how NRC Health delivers AI-driven insights. By unifying siloed data across systems, we accelerated AI feature development, reducing time-to-market from months to weeks - and sometimes days. With predictable costs and faster innovation, Spice isn't just solving some of our data and AI challenges - it's helping us redefine personalized healthcare.”
Tim Ottersburg
VP of Technology, NRC Health

“Spice AI grounds AI in our actual data, using SQL queries across many data sources. This brings accuracy to probabilistic AI systems, which are very prone to hallucinations.”
Rachel Wong
CTO, Basis Set
FAQs
Answers to common questions about serving AI models in Spice
Yes. Model serving is part of the Spice runtime, which is open source under the Apache 2.0 license. The same Spicepod runs on a laptop, in a container, or on Kubernetes. Spice Cloud and Enterprise add managed hosting, prebuilt GPU images, and support.
Spice gives models tools that read your data, such as sql and search. The model can then answer from current records instead of from its training data alone. Grounding reduces hallucinations but does not remove them. Retrieval-augmented generation applies the same pattern to documents.
No. Spice v2.0 removed the evals feature and the /v1/evals endpoint. To score model output, run an external evaluation framework against the Spice chat endpoint. Task history keeps the input of each call, and setting captured_output: truncated under runtime.task_history keeps the output too.
Spice runs as one binary or container, so models deploy wherever the runtime runs. Options are a laptop, a Kubernetes cluster, an edge device, or Spice Cloud. See edge-to-cloud deployments for the architecture of each option.
Spice serves AI models from the same runtime that federates and accelerates SQL queries. Local models run inside that runtime, in the same process as the accelerated data they read. Hosted models stay with their provider, and Spice sends each call to the provider's API. Applications reach both kinds through OpenAI-compatible HTTP APIs and SQL functions. A model call moves through four steps:
- Declare: the
modelssection ofspicepod.yamlnames each model. Thefromprefix selects the provider, such asopenai:gpt-4o-miniorhuggingface:huggingface.co/<org>/<repo>. - Load: at startup, Spice resolves each
${secrets:...}reference in the model parameters from a secret store. Spice downloads Hugging Face weights, or reads afile:model from disk. The mistral.rs inference engine then loads the local weights. - Ground: the tools in a model's
toolsparameter, such assql,search, andtable_schema, let the model query federated and accelerated datasets. A model with notoolsparameter gets no tools. - Serve: applications call a chat model at
/v1/chat/completions, or from a SQL query withai(). Decision models answer/v1/decisionsand the SQL decision functions. Task history, which is on by default, records each call in thespice.runtime.task_historytable.
The following Spicepod defines one hosted model and one local model:
version: v1
kind: Spicepod
name: model-serving
models:
- name: hosted
from: openai:gpt-4o-mini
params:
openai_api_key: ${secrets:OPENAI_API_KEY}
system_prompt: Answer questions about the sales datasets.
tools: auto
- name: local
from: huggingface:huggingface.co/lmstudio-community/Qwen2.5-Coder-3B-Instruct-GGUF
files:
- path: Qwen2.5-Coder-3B-Instruct-Q3_K_L.ggufAny OpenAI-compatible client can then call either model by its Spice name:
curl http://localhost:8090/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model": "local", "messages": [{"role": "user", "content": "What is a Spicepod?"}], "stream": true}'To use the OpenAI SDK, set its base URL to http://localhost:8090/v1 and pass the Spice model name as model. The same client code then calls hosted and local models. The models documentation has the full configuration reference for each provider.
Spice calls hosted models through each provider's API and runs local models in the runtime. The from prefix sets the provider:
| Provider | from prefix | Where the model runs | Credentials |
|---|---|---|---|
| OpenAI and compatible endpoints, such as NVIDIA NIM | openai: | Hosted | openai_api_key, plus endpoint for a compatible API |
| Anthropic | anthropic: | Hosted | anthropic_api_key |
| xAI | xai: | Hosted | xai_api_key |
| Azure OpenAI | azure: | Hosted | azure_api_key or azure_entra_token |
| Google Vertex AI | google: | Hosted | google_project and google_location, plus google_service_account_path, google_service_account_key, or google_application_default_credentials |
| Amazon Bedrock | bedrock: | Hosted | aws_region, plus aws_access_key_id and aws_secret_access_key or an IAM role through aws_iam_role_source |
| Databricks | databricks: | Hosted | databricks_token, or databricks_client_id and databricks_client_secret |
| Spice Cloud | spiceai: | Hosted | spiceai_api_key |
| TypeSafe | typesafe: | Hosted, for decisions only | typesafe_api_key |
| Hugging Face | huggingface: | Local, after download | hf_token for gated models |
| Local file | file: | Local | None |
TypeSafe models, such as typesafe:jev, answer only the SQL decision functions and /v1/decisions. They do not serve chat. Local models load from GGUF, GGML, or SafeTensors files. Spice rejects pickle-format weights (.pt, .pth, .bin, .ckpt) unless the model sets trust_pickle: true, because loading a pickle file can run code.
Release builds of the open-source runtime run local models on the CPU, so a GPU is optional. Small quantized GGUF models give the best CPU latency. For CUDA or Metal, build from source with make install-cuda or make install-metal. Spice Cloud and Enterprise ship prebuilt CUDA images. The distributions reference lists each build.
Spice exposes each model through several interfaces. One model can serve a chat application and a batch SQL job at the same time:
| Interface | Endpoint or function | Use it for |
|---|---|---|
| Chat Completions | POST /v1/chat/completions | OpenAI SDK clients, streamed chat, and tool calls |
| Responses | POST /v1/responses | OpenAI Responses API clients, for models whose provider offers that API |
| SQL text | ai(message) or ai(message, model_name) | Summarizing, translating, or generating text for each row in a query |
| SQL decisions | ai_if, ai_probability, ai_classify, ai_score, and ai_decide | A typed answer for each row: true or false, a probability, a label, or a score |
| Decisions API | POST /v1/decisions | Several typed questions about one input, in the request shape of OpenAI's Decisions API |
| Text-to-SQL | POST /v1/nsql | Natural-language questions that Spice answers with generated SQL |
| Embeddings | POST /v1/embeddings | Vectors from the models in the embeddings section |
| Model list | GET /v1/models | Discovering the models a runtime serves |
The ai() function sends one model call per row and runs the calls in parallel. It splits large inputs into batches of up to 1,000 rows, and each message can be up to 1 MB. The decision functions and /v1/decisions run on any chat model, an OpenAI decision model such as gpt-6-luna, or a TypeSafe model. LLM inference from SQL shows these functions in larger workloads.
Spice applies the same runtime controls to every model, hosted or local. Configure them per model in the Spicepod:
- Tool access: a model calls only the tools in its
toolsparameter. The MCP server gateway adds tools from external MCP servers to the same list. - Rate limits:
max_concurrencyandrequests_per_minute_limitcap the calls Spice sends to a model. Defaults follow each provider's published limits, and the cap also applies to the parallel calls fromai(). - Tool recursion:
tool_recursion_limit, 10 by default, stops a chain of tool calls inside one request from looping. - Secrets:
${secrets:...}references resolve API keys at startup, so keys stay out of the Spicepod file. - Usage tracking: task history records chat and completion calls as
ai_chatandai_completiontasks with their token counts. It records/v1/decisionscalls asai_decisiontasks and SQL decision batches asai_decidetasks. Query them inspice.runtime.task_history. Thellm_prompt_tokens_totalandllm_completion_tokens_totalmetrics give the same totals for dashboards.
A W3C traceparent header on the request sets the trace_id that task history records, so each call matches the caller's trace. For isolation beyond these controls, see secure AI sandboxing. To run model serving as a managed service, compare Spice Cloud and Enterprise plans.
See Spice in action
Walk through your use case with an engineer and see how Spice handles federation, acceleration, and AI integration for production workloads.
Talk to an engineer (opens in a new tab)