LLM API
Chat Completions
Chat completion generated successfully
The specified model was not found
An internal server error occurred while processing the chat completion
POST /v1/chat/completions HTTP/1.1
Host: us-east-1-prod-aws-data.spiceai.io
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 143
{
"model": "gpt-4o",
"messages": [
{
"role": "developer",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"stream": false
}{
"id": "chatcmpl-123",
"object": "chat.completion",
"created": 1677652288,
"model": "gpt-4o-mini",
"system_fingerprint": "fp_44709d6fcb",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "\n\nHello there, how may I assist you today?"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21,
"completion_tokens_details": {
"reasoning_tokens": 0,
"accepted_prediction_tokens": 0,
"rejected_prediction_tokens": 0
}
}
}The format of the response, one of 'application/json' (default), 'application/vnd.spiceai.nsql.v1+json', 'application/sql', 'text/csv' or 'text/plain'. 'application/sql' will only return the SQL query generated by the model.
SQL query executed successfully
Invalid request parameters
Internal server error
POST /v1/nsql HTTP/1.1
Host: us-east-1-prod-aws-data.spiceai.io
X-API-KEY: YOUR_API_KEY
Accept: text
Content-Type: application/json
Content-Length: 132
{
"query": "Get the top 5 customers by total sales",
"model": "nql",
"stream": false,
"sample_data_enabled": true,
"datasets": [
"sales_data"
]
}[
{
"customer_id": "12345",
"total_sales": 150000
},
{
"customer_id": "67890",
"total_sales": 125000
}
]The format of the response (e.g., json or csv).
If true, includes the status of each model in the response.
A comma-separated list of metadata fields to include in the response (e.g., supports_responses_api)
List of models in JSON format
Internal server error occurred while processing models
GET /v1/models HTTP/1.1
Host: us-east-1-prod-aws-data.spiceai.io
X-API-KEY: YOUR_API_KEY
Accept: */*
{
"object": "list",
"data": [
{
"id": "gpt-4",
"object": "model",
"owned_by": "openai",
"datasets": null,
"status": "ready"
},
{
"id": "text-embedding-ada-002",
"object": "model",
"owned_by": "openai-internal",
"datasets": [
"text-dataset-1",
"text-dataset-2"
],
"status": "ready"
}
]
}Last updated
Was this helpful?