Getting Started with the LogicSphere API
Welcome to the LogicSphere API Reference Guide. Our API provides a powerful and flexible way to integrate LogicSphere's AI capabilities into your existing systems and workflows.
On This Page
Overview
The LogicSphere API allows you to:
- Access and manage all of the available Large Language Models (LLMs) in LogicSphere
- Integrate LogicSphere's features into your existing applications
- Automate workspace and chat management
https://platform.logicsphere.ai
Authentication
To use the LogicSphere API, you must first authenticate using your API key. Include this key in the header of your API requests.
import requests
API_KEY = 'your_api_key_here'
headers = {
'Authorization': f'Bearer {API_KEY}'
}
Endpoints
Models
Retrieve the list of available Large Language Models (LLMs).
Example Request
response = requests.get(
'https://platform.logicsphere.ai/api/v1/models',
headers=headers
)
print(response.json())
Workspaces
Get list of all workspaces.
Example Request
response = requests.get(
'https://platform.logicsphere.ai/api/v1/workspaces',
headers=headers
)
print(response.json())
Create a new workspace.
Request Body
{
"modelIds": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
"name": "Data Analysis",
"chatHistoryType": "TEAM",
"contextType": "SHARED",
"sharingType": "TEAM"
}
Example Request
payload = {
"modelIds": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
"name": "Data Analysis",
"chatHistoryType": "USER",
"contextType": "SHARED",
"sharingType": "TEAM"
}
response = requests.post(
'https://platform.logicsphere.ai/api/v1/workspaces',
json=payload,
headers=headers
)
print(response.json())
Update an existing workspace.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId |
string | The unique identifier of the workspace |
Request Body
{
"modelIds": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
"name": "Data Analysis",
"chatHistoryType": "TEAM",
"contextType": "PRIVATE",
"sharingType": "PRIVATE"
}
Example Request
workspace_id = "29f7f2f9-3fe7-43e9-b50e-3f0a50cd5d4b"
payload = {
"modelIds": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"],
"name": "Data Analysis",
"chatHistoryType": "TEAM",
"contextType": "PRIVATE",
"sharingType": "PRIVATE"
}
response = requests.post(
f'https://platform.logicsphere.ai/api/v1/workspaces/{workspace_id}',
json=payload,
headers=headers
)
print(response.json())
Chat
Send a chat message within a workspace and receive AI-generated completions.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
workspaceId |
string | The unique identifier of the workspace |
Request Body
{
"messages": [
{
"role": "user",
"content": "Tell me a joke"
}
]
}
Example Request
workspace_id = "29f7f2f9-3fe7-43e9-b50e-3f0a50cd5d4b"
payload = {
"messages": [
{
"role": "user",
"content": "Tell me a joke"
}
]
}
response = requests.post(
f'https://platform.logicsphere.ai/api/v1/chat/{workspace_id}/completions',
json=payload,
headers=headers
)
print(response.json())
Error Handling
The LogicSphere API uses standard HTTP response codes to indicate success or failure of an API request.
| Status Code | Description |
|---|---|
| 200 OK | Request succeeded |
| 400 Bad Request | The server cannot process the request due to a client error |
| 403 Unauthorized | Authentication failed or user does not have permissions |
| 500 Internal Server Error | An error occurred on the server side |
Best Practices
- Security: Always keep your API key secure. Do not expose it in client-side code.
- Rate Limiting: Be mindful of rate limits to avoid service disruptions.
- Error Handling: Implement robust error handling in your integration to manage different response codes gracefully.
- Logging: Log API requests and responses for debugging and monitoring purposes.
- Timeouts: Set appropriate timeout values for your API requests to handle network issues.
Support
For additional support or questions about the LogicSphere API, contact our technical support team at support@logicsphere.ai.
Last Updated: December 2024