Llm Integrations logo

Llm Integrations

Community
Omar-Obando
llm-integrations

Use when integrating LLM providers (OpenAI, DeepSeek, OpenRouter, Anthropic, Google), configuring API keys, optimizing costs, implementing rate limiting, and managing LLM usage across projects. Includes best practices for cost optimization and API management. Based on OpenAI, Anthropic, Google, and other LLM provider official documentation.

Overview

PublisherOmar-Obando
Repositoryqwen-orchestrator
Skill namellm-integrations
Stars
53
Forks
13
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by Omar-Obando on GitHub. Read the source before you install it.

Installation

Install the Llm Integrations AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/llm-integrations
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Omar-Obando/qwen-orchestrator.git /tmp/qwen-orchestrator
mkdir -p .claude/skills
cp -r /tmp/qwen-orchestrator/skills/llm-integrations .claude/skills/llm-integrations
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Llm Integrations in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Llm Integrations on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Llm Integrations is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

LLM Integrations Skill — Provider Configuration & Cost Optimization

Overview

This skill provides comprehensive guidance for integrating LLM providers (OpenAI, DeepSeek, OpenRouter, Anthropic, Google), configuring API keys, optimizing costs, implementing rate limiting, and managing LLM usage across projects. It includes best practices for cost optimization and API management. Based on OpenAI, Anthropic, Google, and other LLM provider official documentation.

When to Use

Use this skill when:

  • Integrating LLM providers (OpenAI, DeepSeek, OpenRouter, Anthropic, Google, Qwen)
  • Configuring API keys and authentication for multiple providers
  • Optimizing LLM costs across projects
  • Implementing rate limiting for API calls
  • Managing LLM usage across multiple projects
  • Choosing the right model for specific tasks
  • Setting up multi-provider fallback strategies
  • Implementing cost tracking and monitoring
  • Building API key rotation and management
  • Creating LLM usage dashboards
  • Implementing token counting and budgeting
  • Setting up alerting for unusual usage
  • Building LLM caching strategies
  • Implementing prompt caching where supported
  • Managing model versions and upgrades
  • Setting up staging vs production API keys
  • Implementing LLM performance monitoring
  • Building LLM observability with tracing
  • Creating LLM security policies
  • Managing rate limits across providers

Do NOT use this skill when:

  • Building stateful workflows with complex state (use langgraph skill)
  • Designing database schema (use database-design skill)
  • Creating UI components (use frontend-design skill)
  • Implementing provider-specific agent features (use qwen-agent, langchain, or langgraph skills)
  • Managing agent teams and coordination (use agent-task-coordinator skill)
  • Building Qwen-specific integrations (use qwen-agent skill)
  • Implementing LangChain-specific patterns (use langchain skill)

Why avoid: LLM Integrations is for configuration and management. For actual agent/chain implementation, use domain-specific skills.

Provider Integration

OpenAI

python
from langchain_openai import ChatOpenAI, OpenAIEmbeddings
import openai

# Configure API key
openai.api_key = "your-openai-api-key"

# Chat model
llm = ChatOpenAI(
    model="gpt-4o",
    temperature=0.7,
    max_tokens=2048,
    api_key="your-openai-api-key"
)

# Embeddings
embeddings = OpenAIEmbeddings(
    model="text-embedding-3-large",
    api_key="your-openai-api-key"
)

# Direct API
response = openai.ChatCompletion.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "Hello"}
    ],
    temperature=0.7,
    max_tokens=2048
)

DeepSeek

python
from langchain_openai import ChatOpenAI

# DeepSeek API
llm = ChatOpenAI(
    model="deepseek-chat",
    temperature=0.7,
    max_tokens=2048,
    openai_api_key="your-deepseek-api-key",
    openai_api_base="https://api.deepseek.com/v1"
)

# Cost-effective alternative to GPT-4
# ~90% cheaper than GPT-4, similar performance

OpenRouter

python
from langchain_openai import ChatOpenAI

# OpenRouter API
llm = ChatOpenAI(
    model="openrouter/meta-llama/llama-3-70b-instruct:free",
    temperature=0.7,
    max_tokens=2048,
    openai_api_key="your-openrouter-api-key",
    openai_api_base="https://openrouter.ai/api/v1"
)

# Free tier available for some models
# Supports multiple providers (Meta, Mistral, etc.)

Anthropic

python
from langchain_anthropic import ChatAnthropic

# Anthropic API
llm = ChatAnthropic(
    model="claude-3-5-sonnet-20240620",
    temperature=0.7,
    max_tokens=2048,
    api_key="your-anthropic-api-key"
)

# Claude models: excellent for reasoning and coding

Google Gemini

python
from langchain_google_genai import ChatGoogleGenerativeAI

# Google Gemini API
llm = ChatGoogleGenerativeAI(
    model="gemini-3.1-pro",
    temperature=0.7,
    max_tokens=2048,
    google_api_key="your-google-api-key"
)

# Gemini Pro: strong multimodal capabilities

Cost Optimization

Model Selection Matrix

TaskRecommended ModelCost Estimate
Simple queriesGPT-3.5-turbo / Qwen-Turbo$0.50/1M tokens
General tasksGPT-4 / Qwen-Plus$30/1M tokens
Complex reasoningGPT-4o / Qwen-Max$125/1M tokens
Coding tasksClaude-3-5-Sonnet$3/1M tokens
Embeddingstext-embedding-3-small$0.02/1M tokens

Cost Tracking

python
import time

class CostTracker:
    def __init__(self):
        self.total_cost = 0
        self.total_tokens = 0
        self.call_count = 0

    def track_call(self, prompt_tokens: int, completion_tokens: int, model: str):
        """Track API call costs."""
        self.total_tokens += prompt_tokens + completion_tokens
        self.call_count += 1

        # Cost per 1M tokens (approximate)
        costs = {
            "gpt-3.5-turbo": 0.50,
            "gpt-4": 30.00,
            "gpt-4o": 125.00,
            "claude-3-5-sonnet": 3.00,
            "deepseek-chat": 0.14,  # Very cost-effective
            "qwen-turbo": 0.50,
            "qwen-plus": 2.00,
            "qwen-max": 120.00
        }

        cost_per_million = costs.get(model, 10.00)
        cost = (prompt_tokens + completion_tokens) / 1_000_000 * cost_per_million
        self.total_cost += cost

    def get_stats(self):
        """Get cost statistics."""
        return {
            "total_cost": self.total_cost,
            "total_tokens": self.total_tokens,
            "call_count": self.call_count,
            "avg_cost_per_call": self.total_cost / self.call_count if self.call_count > 0 else 0
        }

# Usage
tracker = CostTracker()

# Track calls
tracker.track_call(prompt_tokens=100, completion_tokens=50, model="gpt-4")
tracker.track_call(prompt_tokens=200, completion_tokens=100, model="deepseek-chat")

stats = tracker.get_stats()
print(f"Total cost: ${stats['total_cost']:.2f}")
print(f"Total tokens: {stats['total_tokens']}")

Cost-Saving Strategies

python
# ✅ GOOD: Use cost-effective models
def call_llm(prompt: str, task_type: str) -> str:
    """Call LLM with cost-effective model selection."""

    models = {
        "simple": "gpt-3.5-turbo",  # $0.50/1M tokens
        "general": "deepseek-chat",  # $0.14/1M tokens (very cost-effective)
        "complex": "gpt-4o",  # $125/1M tokens
        "coding": "claude-3-5-sonnet",  # $3/1M tokens
        "embedding": "text-embedding-3-small"  # $0.02/1M tokens
    }

    model = models.get(task_type, "deepseek-chat")
    return call_api(prompt, model)

Rate Limiting

python
import time
from threading import Lock

class RateLimiter:
    def __init__(self, max_requests: int = 10, time_window: float = 60.0):
        self.max_requests = max_requests
        self.time_window = time_window
        self.requests = []
        self.lock = Lock()

    def acquire(self):
        """Acquire permission to make a request, waiting if necessary."""
        while True:
            with self.lock:
                current_time = time.time()
                self.requests = [req_time for req_time in self.requests
                               if current_time - req_time < self.time_window]

                if len(self.requests) < self.max_requests:
                    self.requests.append(current_time)
                    return

            # Wait before retrying
            time.sleep(0.1)

# Usage
rate_limiter = RateLimiter(max_requests=10, time_window=60)

def call_llm_with_rate_limit(prompt: str, model: str) -> str:
    """Call LLM with rate limiting."""
    rate_limiter.acquire()
    return call_api(prompt, model)

API Key Management

Environment Variables

bash
# .env file
OPENAI_API_KEY=sk-...
DEEPSEEK_API_KEY=sk-...
OPENROUTER_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-...
GOOGLE_API_KEY=AIza...
python
import os
from dotenv import load_dotenv

load_dotenv()

# Load API keys
openai_api_key = os.getenv("OPENAI_API_KEY")
deepseek_api_key = os.getenv("DEEPSEEK_API_KEY")
openrouter_api_key = os.getenv("OPENROUTER_API_KEY")

Secret Management

python
# ✅ GOOD: Use secret management
import boto3
from botocore.exceptions import ClientError

def get_secret(secret_name: str) -> str:
    """Get secret from AWS Secrets Manager."""
    session = boto3.session.Session()
    client = session.client(service_name="secretsmanager")

    try:
        get_secret_value_response = client.get_secret_value(SecretId=secret_name)
        return get_secret_value_response["SecretString"]
    except ClientError as e:
        raise Exception(f"Error getting secret: {e}")

# Usage
openai_api_key = get_secret("openai/api_key")

Fallback Strategy

python
class MultiProviderLLM:
    def __init__(self):
        self.providers = {
            "primary": "openai",
            "fallback": ["deepseek", "openrouter"]
        }
        self.api_keys = {
            "openai": os.getenv("OPENAI_API_KEY"),
            "deepseek": os.getenv("DEEPSEEK_API_KEY"),
            "openrouter": os.getenv("OPENROUTER_API_KEY")
        }

    def call(self, prompt: str, model: str, provider: str = None) -> str:
        """Call LLM with fallback strategy."""
        providers = [provider] if provider else list(self.providers.values())

        for provider in providers:
            try:
                return self._call_provider(prompt, model, provider)
            except Exception as e:
                print(f"Provider {provider} failed: {e}")
                continue

        raise Exception("All providers failed")

    def _call_provider(self, prompt: str, model: str, provider: str) -> str:
        """Call specific provider."""
        api_key = self.api_keys[provider]

        if provider == "openai":
            return call_openai(prompt, model, api_key)
        elif provider == "deepseek":
            return call_deepseek(prompt, model, api_key)
        elif provider == "openrouter":
            return call_openrouter(prompt, model, api_key)

Best Practices

1. Use Appropriate Models

python
# ✅ GOOD: Appropriate model selection
def call_llm(prompt: str, task_type: str) -> str:
    """Call LLM with appropriate model selection."""

    models = {
        "simple": "gpt-3.5-turbo",
        "general": "deepseek-chat",
        "complex": "gpt-4o",
        "coding": "claude-3-5-sonnet",
        "embedding": "text-embedding-3-small"
    }

    model = models.get(task_type, "deepseek-chat")
    return call_api(prompt, model)

2. Implement Error Handling

python
# ✅ GOOD: Error handling
try:
    response = call_api(prompt, model)
except Exception as e:
    logger.error(f"LLM API Error: {e}")
    response = "An error occurred. Please try again."

3. Use Caching

python
from functools import lru_cache

@lru_cache(maxsize=100)
def cached_call(prompt: str, model: str) -> str:
    """Cached LLM call."""
    return call_api(prompt, model)

# Usage
result = cached_call("What's 2+2?", "gpt-3.5-turbo")

4. Monitor Usage

python
class UsageMonitor:
    def __init__(self):
        self.usage = {}

    def track(self, provider: str, tokens: int, cost: float):
        """Track usage."""
        if provider not in self.usage:
            self.usage[provider] = {"tokens": 0, "cost": 0.0}

        self.usage[provider]["tokens"] += tokens
        self.usage[provider]["cost"] += cost

    def get_report(self):
        """Get usage report."""
        return self.usage

# Usage
monitor = UsageMonitor()
monitor.track("openai", tokens=1000, cost=0.03)
monitor.track("deepseek", tokens=2000, cost=0.00028)

report = monitor.get_report()

Common Anti-Patterns

❌ Bad: Hardcoded API Keys

python
# ❌ BAD: Hardcoded API keys
def call_openai(prompt: str) -> str:
    api_key = "sk-..."  # Hardcoded!
    return openai.ChatCompletion.create(api_key=api_key, ...)

Problems:

  • Security risk
  • Difficult to manage
  • Hard to rotate keys

✅ Good: Environment Variables

python
# ✅ GOOD: Environment variables
import os

def call_openai(prompt: str) -> str:
    api_key = os.getenv("OPENAI_API_KEY")
    return openai.ChatCompletion.create(api_key=api_key, ...)

❌ Bad: No Rate Limiting

python
# ❌ BAD: No rate limiting
def call_llm(prompt: str) -> str:
    return call_api(prompt, "gpt-4")  # Can hit rate limits

✅ Good: With Rate Limiting

python
# ✅ GOOD: With rate limiting
rate_limiter = RateLimiter(max_requests=10, time_window=60)

def call_llm(prompt: str) -> str:
    rate_limiter.acquire()  # Wait if needed
    return call_api(prompt, "gpt-4")

❌ Bad: No Error Handling

python
# ❌ BAD: No error handling
response = call_api(prompt, "gpt-4")  # Can crash
result = response.choices[0].text

✅ Good: With Error Handling

python
# ✅ GOOD: With error handling
try:
    response = call_api(prompt, "gpt-4")
    result = response.choices[0].text
except Exception as e:
    logger.error(f"API Error: {e}")
    result = "An error occurred. Please try again."

Real-World Impact

Before this skill:

  • Hardcoded API keys
  • No rate limiting
  • Poor cost management
  • No error handling

After this skill:

  • Secure API key management
  • Rate limiting implemented
  • Cost optimization
  • Robust error handling

Cross-References

  • qwen-agent - For Qwen-specific integrations
  • langchain - For LangChain integration
  • langgraph - For stateful workflows

References

Frequently asked questions

What does the Llm Integrations AI skill do?

Use when integrating LLM providers (OpenAI, DeepSeek, OpenRouter, Anthropic, Google), configuring API keys, optimizing costs, implementing rate limiting, and managing LLM usage across projects. Includes best practices for cost optimization and API management. Based on OpenAI, Anthropic, Google, and other LLM provider official documentation.

Why use Llm Integrations on TypingMind?

Because you install it once and use it with any model. Llm Integrations is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Llm Integrations in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/llm-integrations. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Llm Integrations?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Llm Integrations?

As many as you like. As long as a model supports skills, you can use Llm Integrations with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Llm Integrations AI skill free?

Yes. It is published on GitHub by Omar-Obando under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇