Overview
Creates a memory space in the current project. A memory space logically isolates memories and experiences. The response returns a spaceId, which is used as the {spaceId} path parameter in subsequent memory and experience API requests.
API details
Constraints
- The caller must have an API key. For more information, see Manage AI API keys.
Request path
POST {BASE_URL}/api/v1/memory/spaces
Request headers
Name |
Required |
Example value |
Description |
|---|---|---|---|
| Authorization | Yes | Bearer {token} | Authentication information. |
| Content-Type | No | application/json | Request body format. |
| X-OB-Project-ID | Yes | your-project-id | Project ID |
Request parameters
Body parameters
Name |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| spaceName | string | Yes | my-space | The name of the space, which must not exceed 128 characters in length. |
| description | string | No | A space for storing memories. | The maximum length of the space description is 512 characters. |
| dims | integer | No | 1536 | Vector dimensionality. If not specified, the server will determine it based on the provider's default value. |
| providerType | string | No | openai | Type of the LLM provider. This parameter does not affect the embedder (which is always qwen). |
| providerBaseUrl | string | No | https://api.openai.com | The base URL of the LLM service. |
| providerApiKey | string | No | sk-... | API key of the LLM service. |
| providerLlmModel | string | No | gpt-4 | The name of the LLM model. |
| providerEmbeddingModel | string | No | text-embedding-ada-002 | Vector model name. |
Response
Response parameters
Name |
Type |
Description |
|---|---|---|
| success | boolean | Whether the request was successful |
| code | string | Response code. |
| message | string | Response message. |
| data | object | Response data. |
Data fields
Upon successful creation, the data field contains information about the created memory space. The specific structure is defined by the server.
Request example
curl --request POST '{BASE_URL}/api/v1/memory/spaces' \
--header 'Authorization: Bearer {token}' \
--header 'X-OB-Project-ID: your-project-id' \
--header 'Content-Type: application/json' \
--data '{
"spaceName": "my-space",
"description": "A space for storing memories.",
"dims": 1024,
"providerType": "openai",
"providerBaseUrl": "https://api.openai.com",
"providerApiKey": "sk-...",
"providerLlmModel": "gpt-4",
"providerEmbeddingModel": "text-embedding-ada-002"
}'
Response example
{
"success": true,
"code": "201",
"message": "Created",
"data": {
"spaceId": "spc-1234567890abcdef"
}
}
