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:

Base URL: 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}'
}
Security Notice: Always keep your API key secure. Do not expose it in client-side code or public repositories.

Endpoints

Models

GET /api/v1/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 /api/v1/workspaces

Get list of all workspaces.

Example Request

response = requests.get(
    'https://platform.logicsphere.ai/api/v1/workspaces',
    headers=headers
)
print(response.json())
POST /api/v1/workspaces

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())
POST /api/v1/workspaces/{workspaceId}

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

POST /api/v1/chat/{workspaceId}/completions

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

Support

For additional support or questions about the LogicSphere API, contact our technical support team at support@logicsphere.ai.

Next Steps: Now that you understand the basics, explore our detailed endpoint documentation to learn more about specific API features.

Last Updated: December 2024