API Documentation
Accessing API Documentation
Section titled “Accessing API Documentation”To access the API Documentation, navigate to your workspace and click on API Documentation
in the left sidebar. This will take you to the API documentation page where you can explore all available endpoints and model types.
The API Documentation page provides a centralized location for developers to understand how to interact with the FloTorch Gateway API, including request formats, response examples, and model specifications.
Model Types
Section titled “Model Types”The FloTorch gateway supports two types of model specifications that you can use in your API requests:
FloTorch Model Access
Section titled “FloTorch Model Access”- Format:
flotorch/<model_name>
- Example:
flotorch/smart-model
- Description: FloTorch-managed models with intelligent routing and optimization
- Use Case: Use this format when you want to leverage FloTorch’s intelligent model routing and optimization features
Provider Model Access
Section titled “Provider Model Access”- Format:
<provider_name>/<model_name>
- Example:
open-ai-provider/gpt-4
- Description: Access specific provider models (still routed through FloTorch gateway)
- Use Case: Use this format when you need to access a specific model from a particular provider
API Endpoints
Section titled “API Endpoints”The API Documentation is organized into different sections, each containing relevant endpoints for specific functionality:
Models
Section titled “Models”Contains endpoints for model-related operations:
- POST
/openai/v1/chat/completions
- Chat completions - POST
/openai/v1/embeddings
- Generate embeddings - POST
/openai/v1/vector_stores/{id}/search
- Vector store search
Agents
Section titled “Agents”Contains endpoints for agent management:
- GET
/v1/agents/{name}
- Get agent details
Memory
Section titled “Memory”Contains endpoints for memory operations:
- POST
/v1/memory/{provider}/memories/list
- List memories - POST
/v1/memory/{provider}/memories
- Create memory - GET
/v1/memory/{provider}/memories/{id}
- Get specific memory - PUT
/v1/memory/{provider}/memories/{id}
- Update memory - DELETE
/v1/memory/{provider}/memories/{id}
- Delete memory - POST
/v1/memory/{provider}/memories/search
- Search memories
RAG (Retrieval-Augmented Generation)
Section titled “RAG (Retrieval-Augmented Generation)”Contains endpoints for RAG operations:
- POST
/v1/rag/{endpoint}/generate
- Generate with RAG
MCP Tools
Section titled “MCP Tools”Contains endpoints for Model Context Protocol operations:
- POST
/v1/mcps/{name}/proxy
- Execute Model Context Protocol operations (tools, resources, etc.)
Sessions
Section titled “Sessions”Contains endpoints for session management:
- GET
/v1/sessions
- List sessions - POST
/v1/sessions
- Create session - GET
/v1/sessions/{uid}
- Get session details - DELETE
/v1/sessions/{uid}
- Delete session - GET
/v1/sessions/{uid}/events
- Get session events - POST
/v1/sessions/{uid}/events
- Add session event
Workflows
Section titled “Workflows”Contains endpoints for workflow operations:
- GET
/v1/workflows/{name}
- Fetch workflow configuration - POST
/v1/workflows/{name}/run
- Submit workflow - GET
/v1/workflows/{name}/invocations/{invocationId}
- Get workflow invocation details
Using the API Documentation
Section titled “Using the API Documentation”Navigating Between Sections
Section titled “Navigating Between Sections”- Use the section tabs at the top of the API endpoints area to switch between different endpoint categories
- Each section is clearly labeled with an icon and name for easy identification
- The active section is highlighted with a primary color background
Viewing Endpoint Details
Section titled “Viewing Endpoint Details”Each endpoint card displays:
- HTTP Method - Color-coded badge (GET, POST, PUT, DELETE)
- Endpoint Path - Full URL path with copy button
- Description - Brief explanation of what the endpoint does
- Request Body Example - Expandable JSON example (when applicable)
- Response Example - Expandable JSON response example (when applicable)
Copying Code Examples
Section titled “Copying Code Examples”- Click the copy button next to any endpoint URL to copy the full path
- Expand request body examples to view formatted JSON
- Click the copy button in the code block to copy the entire JSON example
- Use these examples directly in your API requests
Request Body Examples
Section titled “Request Body Examples”- Click on “View Example Request Body” to expand and see formatted JSON
- Examples are syntax-highlighted for better readability
- All examples include realistic data that you can modify for your use case
Response Examples
Section titled “Response Examples”- Click on “View Example Response” to see what the API returns
- Response examples show the expected structure and data types
- Use these to understand how to parse API responses in your application
Gateway URL Configuration
Section titled “Gateway URL Configuration”The API Documentation automatically displays your workspace’s gateway URL as the base URL for all endpoints. This URL is:
- Automatically loaded when you access the documentation page
- Used as the prefix for all endpoint examples
- Required for making actual API requests to the FloTorch Gateway
If the gateway URL cannot be loaded, you’ll see an error message with instructions to check your connection.
Quickstart Integration
Section titled “Quickstart Integration”The API Documentation page includes a “Quickstart docs” button that links to external comprehensive documentation. This provides:
- Detailed setup instructions
- Authentication requirements
- Advanced usage examples
- Best practices and troubleshooting
Best Practices
Section titled “Best Practices”Using Model Types
Section titled “Using Model Types”- Use
flotorch/<model_name>
format for optimal performance and intelligent routing - Use
<provider>/<model_name>
format when you need specific provider models - Always ensure the model name matches exactly what’s available in your workspace
Making API Requests
Section titled “Making API Requests”- Include proper authentication headers in your requests
- Use the exact endpoint paths shown in the documentation
- Follow the request body format exactly as shown in examples
- Handle responses according to the provided response examples
Error Handling
Section titled “Error Handling”- Check the HTTP status codes in responses
- Review error messages for troubleshooting
- Ensure your request format matches the documentation examples
The API Documentation feature provides everything you need to successfully integrate with the FloTorch Gateway API, from understanding model types to implementing complete workflows.