Skip to main content
POST
/
v1
/
vector_stores
from openai import OpenAI
client = OpenAI()

vector_store = client.beta.vector_stores.create(
    name="Product Documentation",
    file_ids=["file-abc123", "file-abc456"],
    metadata={"project": "customer_support"}
)

print(vector_store.id)
{
  "id": "vs_abc123",
  "object": "vector_store",
  "name": "Product Documentation",
  "status": "in_progress",
  "usage_bytes": 0,
  "created_at": 1699061776,
  "file_counts": {
    "in_progress": 2,
    "completed": 0,
    "failed": 0,
    "cancelled": 0,
    "total": 2
  },
  "metadata": {
    "project": "customer_support"
  },
  "expires_after": null,
  "expires_at": null
}
Create a vector store.

Request Body

name
string
The name of the vector store.
file_ids
array
A list of File IDs that the vector store should use. Useful for tools like file_search that can access files.
description
string
A description for the vector store. Can be used to describe the vector store’s purpose.
expires_after
object
The expiration policy for a vector store.
chunking_strategy
object
The chunking strategy used to chunk the file(s). If not set, will use the auto strategy. Only applicable if file_ids is non-empty.
metadata
object
Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format.Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Response

Returns a VectorStore object.
id
string
The identifier, which can be referenced in API endpoints.
object
string
The object type, always vector_store.
name
string
The name of the vector store.
status
string
The status of the vector store. One of:
  • expired
  • in_progress
  • completed
file_counts
object
Counts of files by status.
created_at
integer
The Unix timestamp (in seconds) for when the vector store was created.
usage_bytes
integer
The total number of bytes used by the files in the vector store.
from openai import OpenAI
client = OpenAI()

vector_store = client.beta.vector_stores.create(
    name="Product Documentation",
    file_ids=["file-abc123", "file-abc456"],
    metadata={"project": "customer_support"}
)

print(vector_store.id)
{
  "id": "vs_abc123",
  "object": "vector_store",
  "name": "Product Documentation",
  "status": "in_progress",
  "usage_bytes": 0,
  "created_at": 1699061776,
  "file_counts": {
    "in_progress": 2,
    "completed": 0,
    "failed": 0,
    "cancelled": 0,
    "total": 2
  },
  "metadata": {
    "project": "customer_support"
  },
  "expires_after": null,
  "expires_at": null
}

Build docs developers (and LLMs) love