| icon | robot |
|---|---|
| description | Use the AI Gateway for LLM inference, embeddings, and search across multiple model providers. |
Spice.ai provides an OpenAI-compatible AI Gateway that lets you access multiple model providers through a unified API. This enables LLM inference, embeddings, vector search, and RAG workflows.
See AI Gateway for full feature details.
| Provider | Documentation |
|---|---|
| OpenAI | OpenAI |
| Anthropic | Anthropic |
| Azure OpenAI | Azure |
| xAI (Grok) | XAI |
| Hugging Face | Hugging Face |
| Perplexity | Perplexity |
| Spice.ai | SpiceAI |
See Model Providers for the complete list.
Store your model provider API key as a secret in your app (e.g., OPENAI_API_KEY).
models:
- from: openai:gpt-4o
name: my_model
params:
openai_api_key: "${secrets:OPENAI_API_KEY}"Deploy your app to make the model available.
Send requests to the LLM API:
curl https://data.spiceai.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"model": "my_model",
"messages": [{"role": "user", "content": "Hello!"}]
}'The AI Gateway exposes an OpenAI-compatible interface at https://data.spiceai.io/v1/chat/completions. You can use any OpenAI-compatible client library — just point it at the Spice.ai endpoint and use your app's API key.
Configure custom tools and system prompts in your model configuration to tailor AI behavior. See AI Gateway for configuration options.
Spice supports vector and hybrid search for retrieval-augmented generation (RAG) workflows:
- Configure embeddings for your datasets.
- Use the Search API for semantic search.
All AI requests include full OpenTelemetry observability for tracing request flows, latency, and errors.
- Model not configured — Ensure a model is defined in your Spicepod and the app is deployed.
- Missing secret — Verify the model provider API key is stored as a secret and referenced correctly with
${secrets:SECRET_NAME}. - Secret changes require redeployment — After adding or updating secrets, redeploy the app.
- Check that the model name in your API request matches the
namefield in your Spicepod model configuration. - Verify the
fromfield uses a valid provider and model identifier.
These typically come from the upstream model provider (e.g., OpenAI). Check your provider's usage dashboard and rate limits.