Core Concepts
This guide explains the fundamental concepts you need to understand when using LangMart. Understanding these concepts will help you make the most of the platform.
Models and Providers
What is a Provider?
A provider is a company that offers AI/LLM services. LangMart integrates with multiple providers, giving you access to their models through a single API.
| Provider | Description | Popular Models |
|---|---|---|
| OpenAI | Creator of GPT models | gpt-4o, gpt-4-turbo, gpt-3.5-turbo |
| Anthropic | Creator of Claude | claude-3.5-sonnet, claude-3-opus |
| Google AI | gemini-1.5-pro, gemini-pro | |
| Groq | Fast inference | llama-3.3-70b, mixtral-8x7b |
| Mistral | European AI company | mistral-large, mistral-medium |
| OpenRouter | Meta-router | 100+ models from various sources |
What is a Model?
A model is a specific AI system trained for language tasks. Each model has unique characteristics:
| Characteristic | Description | Example |
|---|---|---|
| Context Window | Maximum input/output tokens | 128K tokens |
| Capabilities | What the model can do | Vision, Tool Use, Reasoning |
| Speed | Response latency | Fast (< 1s), Medium, Slow |
| Quality | Output quality level | High, Medium, Standard |
| Cost | Price per 1K tokens | $0.001 - $0.06 |
Model Naming Convention
LangMart uses a standardized naming format:
provider/model-nameExamples:
openai/gpt-4o- GPT-4o from OpenAIanthropic/claude-3.5-sonnet- Claude 3.5 Sonnet from Anthropicgroq/llama-3.3-70b-versatile- Llama 3.3 70B on Groq infrastructure
Model Categories
Models are organized into categories based on their capabilities:
| Category | Description | Use Cases |
|---|---|---|
| Chat | Conversational models | Chatbots, assistants |
| Completion | Text completion | Code completion, writing |
| Embedding | Text to vectors | Search, similarity |
| Image Generation | Text to image | Art, design |
| Vision | Image understanding | Analysis, description |
Connections
What is a Connection?
A connection links LangMart to a provider using your API credentials. Connections enable:
- Using your own provider API keys
- Accessing provider-specific features
- Managing rate limits and quotas
- Tracking usage per connection
Connection Types
| Type | Description | Best For |
|---|---|---|
| Platform Default | LangMart's shared keys | Getting started, testing |
| Individual | Your personal API key | Personal projects |
| Organization | Shared team API key | Team collaboration |
Creating a Connection
- Go to Connections in the sidebar
- Click Add Connection
- Select the provider
- Enter your API key
- (Optional) Set rate limits and quotas
- Click Create
Connection Scope
| Scope | Access | Visibility |
|---|---|---|
| Individual | Only you | Private |
| Organization | All org members | Shared |
Why Use Your Own Connection?
| Reason | Benefit |
|---|---|
| Higher Limits | Provider rate limits don't compete with others |
| Direct Billing | Pay the provider directly, potentially cheaper |
| Enterprise Features | Access enterprise-only features |
| Compliance | Meet data residency requirements |
| Custom Endpoints | Connect to private deployments |
Credits and Billing
How Billing Works
LangMart uses a credit-based billing system:
- Purchase Credits - Buy credits through the platform
- Use Credits - Credits are deducted based on token usage
- Track Spending - Monitor usage in real-time
Understanding Token Pricing
AI models charge based on tokens - pieces of text roughly equivalent to 4 characters or 3/4 of a word.
Input: "Hello, how are you today?" = ~7 tokens
Output: "I'm doing great, thanks for asking!" = ~9 tokensPrice Calculation
Cost = (Input Tokens * Input Price) + (Output Tokens * Output Price)Example:
- Model: groq/llama-3.3-70b-versatile
- Input: 1,000 tokens @ $0.0006/1K = $0.0006
- Output: 500 tokens @ $0.0008/1K = $0.0004
- Total: $0.001
Billing Modes
| Mode | Description | Who Pays |
|---|---|---|
| Member Pays | Individual users pay from their balance | You |
| Org Pays | Organization covers usage costs | Organization |
Viewing Usage
Track your usage in multiple ways:
| View | Location | Shows |
|---|---|---|
| Dashboard | Home page | Today's summary |
| Analytics | Analytics page | Detailed breakdown |
| Requests | Request Logs | Per-request details |
| Billing | Settings > Billing | Invoices and history |
Cost Optimization Tips
- Choose the Right Model - Don't use GPT-4 when GPT-3.5 suffices
- Optimize Prompts - Shorter prompts = fewer input tokens
- Set Max Tokens - Limit output length when appropriate
- Use Caching - Avoid duplicate requests
- Monitor Usage - Set up alerts for spending thresholds
Organizations and Teams
What is an Organization?
An organization is a group of users who share resources. Organizations enable:
- Team collaboration
- Shared connections
- Centralized billing
- Access control
Organization Roles
| Role | Permissions |
|---|---|
| Owner | Full control, billing, delete org |
| Admin | Manage members, connections, settings |
| Member | Use resources, view analytics |
| Viewer | Read-only access |
Creating an Organization
- Go to Organizations in the sidebar
- Click Create Organization
- Enter organization name and details
- Invite team members
Switching Organizations
If you belong to multiple organizations:
- Click your profile icon
- Select Switch Organization
- Choose the organization
Inviting Members
- Go to Organizations > Your Organization
- Click Invite Member
- Enter email address
- Select role
- Send invitation
Invitees receive an email with a link to join.
Gateway Architecture (Simplified)
Understanding LangMart's architecture helps you troubleshoot and optimize.
What is a Gateway?
A gateway is a server component that processes your API requests. LangMart uses different gateway types for different purposes.
Request Flow
Your App LangMart Provider
│ │ │
│──── API Request ─────>│ │
│ │ │
│ │── Validate & Route ───>│
│ │ │
│ │<──── Provider API ─────│
│ │ │
│<─── Response ─────────│ │Gateway Types
| Type | Purpose | When Used |
|---|---|---|
| Type 1 | Full platform gateway | Most requests |
| Type 2 | Cloud provider routing | Provider connections |
What This Means for You
- Reliability - Multiple gateways provide redundancy
- Performance - Requests are routed optimally
- Flexibility - Different providers handled appropriately
API Compatibility
OpenAI Compatibility
LangMart's API is designed to be a drop-in replacement for OpenAI's API:
# OpenAI
from openai import OpenAI
client = OpenAI(api_key="sk-...")
# LangMart - just change base_url
from openai import OpenAI
client = OpenAI(
api_key="sk-langmart-...",
base_url="https://api.langmart.ai/v1"
)Supported Endpoints
| Endpoint | Status | Description |
|---|---|---|
/v1/chat/completions |
Full | Chat completions |
/v1/completions |
Full | Text completions |
/v1/embeddings |
Full | Text embeddings |
/v1/models |
Full | List models |
/v1/images/generations |
Partial | Image generation |
Provider-Specific Features
Some provider features are available through LangMart:
| Feature | Support | Notes |
|---|---|---|
| Streaming | Yes | Server-Sent Events |
| Function Calling | Yes | Tools/functions |
| Vision | Yes | Image inputs |
| JSON Mode | Yes | Structured output |
Alerts and Monitoring
Setting Up Alerts
Alerts notify you when certain conditions are met:
| Alert Type | Trigger | Example |
|---|---|---|
| Usage | Token/request threshold | > 1M tokens/day |
| Cost | Spending threshold | > $50/day |
| Error Rate | Error percentage | > 5% errors |
Creating an Alert
- Go to Alerts in the sidebar
- Click Create Alert
- Select alert type and condition
- Set threshold value
- Choose notification method
- Save
Notification Methods
| Method | Description |
|---|---|
| In-App | Notification in dashboard |
| Email to your address | |
| Webhook | HTTP POST to your endpoint |
Glossary
| Term | Definition |
|---|---|
| API Key | Secret credential for API authentication |
| Connection | Link between LangMart and a provider using your credentials |
| Credits | LangMart's billing currency |
| Gateway | Server component that processes requests |
| Model | A specific AI system (e.g., GPT-4o) |
| Organization | Group of users sharing resources |
| Provider | Company offering AI services (e.g., OpenAI) |
| Token | Unit of text for pricing (~4 characters) |
Next Steps
Now that you understand the core concepts:
- Create Your First Connection - Add your own provider keys
- Explore Models - Find the right model for your use case
- Set Up Alerts - Monitor your usage
- Manage Your Team - Invite collaborators