Skip to content

Latest commit

 

History

History
527 lines (354 loc) · 13.1 KB

File metadata and controls

527 lines (354 loc) · 13.1 KB

Obtaining Provider API Keys

This guide explains how to get API keys for every provider supported by ModelMesh. You only need one key to get started — add more providers later for failover and free-tier aggregation.


Quick Reference

Provider Env Variable Free Tier Sign-Up Link
OpenAI OPENAI_API_KEY $5 credit (new accounts) platform.openai.com
Anthropic ANTHROPIC_API_KEY $5 credit (new accounts) console.anthropic.com
Google Gemini GOOGLE_API_KEY Generous free tier aistudio.google.com
xAI (Grok) XAI_API_KEY $25 free credit console.x.ai
DeepSeek DEEPSEEK_API_KEY Free trial credits platform.deepseek.com
Mistral AI MISTRAL_API_KEY Free tier available console.mistral.ai
Cohere COHERE_API_KEY Free trial tier dashboard.cohere.com
Groq GROQ_API_KEY Free tier (rate-limited) console.groq.com
Perplexity PERPLEXITY_API_KEY Free credits on signup perplexity.ai/settings/api
OpenRouter OPENROUTER_API_KEY Free models available openrouter.ai/keys
Together AI TOGETHER_API_KEY $5 free credit api.together.ai
ElevenLabs ELEVENLABS_API_KEY 10,000 chars/month free elevenlabs.io
AssemblyAI ASSEMBLYAI_API_KEY Free tier available assemblyai.com
Azure Speech AZURE_SPEECH_KEY 5M chars/month free portal.azure.com
Tavily TAVILY_API_KEY 1,000 searches/month free tavily.com
Serper SERPER_API_KEY 2,500 searches free serper.dev
Jina AI JINA_API_KEY 1M tokens/month free jina.ai
Firecrawl FIRECRAWL_API_KEY 500 pages/month free firecrawl.dev
Ollama OLLAMA_HOST Free (local) ollama.com
LM Studio LMSTUDIO_HOST Free (local) lmstudio.ai
vLLM VLLM_HOST Free (local) docs.vllm.ai
LocalAI LOCALAI_HOST Free (local) localai.io

Cloud LLM Providers

OpenAI

Models: GPT-4o, GPT-4o-mini, GPT-4 Turbo, o1, o3-mini, DALL-E 3, Whisper, TTS

  1. Go to platform.openai.com/signup
  2. Create an account (email or Google/Microsoft SSO)
  3. Navigate to API Keys in the left sidebar
  4. Click Create new secret key, give it a name
  5. Copy the key (starts with sk-)
export OPENAI_API_KEY="sk-..."

Connector ID: provider.openai.llm.v1


Anthropic

Models: Claude Opus 4, Claude Sonnet 4, Claude 3.5 Haiku

  1. Go to console.anthropic.com
  2. Sign up with email or Google SSO
  3. Navigate to API Keys in Settings
  4. Click Create Key
  5. Copy the key (starts with sk-ant-)
export ANTHROPIC_API_KEY="sk-ant-..."

Connector ID: anthropic.claude.v1


Google Gemini

Models: Gemini 2.0 Flash, Gemini 2.0 Pro, Gemini 1.5 Pro, Gemini 1.5 Flash

  1. Go to aistudio.google.com/apikey
  2. Sign in with your Google account
  3. Click Create API Key
  4. Select or create a Google Cloud project
  5. Copy the key (starts with AI)
export GOOGLE_API_KEY="AI..."

Connector ID: provider.google.gemini.v1

Tip: Gemini has one of the most generous free tiers — great for development and free-tier aggregation.


xAI (Grok)

Models: Grok-2, Grok-2 Mini, Grok-3, Grok-3 Mini

  1. Go to console.x.ai
  2. Sign up with your X (Twitter) account or email
  3. Navigate to API Keys
  4. Click Create API Key
  5. Copy the key
export XAI_API_KEY="xai-..."

Connector ID: provider.xai.grok.v1


DeepSeek

Models: DeepSeek-V3, DeepSeek-R1, DeepSeek-Coder

  1. Go to platform.deepseek.com
  2. Create an account
  3. Navigate to API Keys
  4. Click Create new API key
  5. Copy the key
export DEEPSEEK_API_KEY="sk-..."

Connector ID: provider.deepseek.api.v1

Tip: DeepSeek offers very competitive pricing — one of the lowest cost-per-token providers.


Mistral AI

Models: Mistral Large, Mistral Small, Mistral Nemo, Codestral, Pixtral

  1. Go to console.mistral.ai
  2. Create an account
  3. Navigate to API Keys in the sidebar
  4. Click Create new key
  5. Copy the key
export MISTRAL_API_KEY="..."

Connector ID: provider.mistral.api.v1


Cohere

Models: Command R+, Command R, Embed, Rerank

  1. Go to dashboard.cohere.com
  2. Sign up with email or Google SSO
  3. Navigate to API Keys
  4. Your trial key is shown automatically
  5. Copy the key
export COHERE_API_KEY="..."

Connector ID: provider.cohere.nlp.v1


Groq

Models: LLaMA 3.3, Gemma 2, Mixtral (ultra-fast inference)

  1. Go to console.groq.com
  2. Sign up with email or Google SSO
  3. Navigate to API Keys
  4. Click Create API Key
  5. Copy the key (starts with gsk_)
export GROQ_API_KEY="gsk_..."

Connector ID: provider.groq.api.v1

Tip: Groq provides extremely fast inference using LPU hardware. Great for low-latency use cases.


Perplexity

Models: Sonar, Sonar Pro (search-augmented generation)

  1. Go to perplexity.ai/settings/api
  2. Sign up or log in
  3. Navigate to API settings
  4. Generate an API key
  5. Copy the key (starts with pplx-)
export PERPLEXITY_API_KEY="pplx-..."

Connector ID: provider.perplexity.search.v1


Aggregator Platforms

OpenRouter

Access to 200+ models from multiple providers through a single API key.

  1. Go to openrouter.ai/keys
  2. Sign up with email or Google SSO
  3. Click Create Key
  4. Copy the key (starts with sk-or-)
export OPENROUTER_API_KEY="sk-or-..."

Connector ID: provider.openrouter.gateway.v1

Tip: OpenRouter includes many free models. Useful for accessing models from providers without direct API access.


Together AI

Models: LLaMA, Mistral, Qwen, and other open-source models at scale.

  1. Go to api.together.ai
  2. Create an account
  3. Navigate to Settings → API Keys
  4. Copy your key
export TOGETHER_API_KEY="..."

Connector ID: provider.together.api.v1


Audio & Media Providers

ElevenLabs

Capabilities: Text-to-Speech (high-quality voices)

  1. Go to elevenlabs.io and sign up
  2. Navigate to your Profile (bottom-left)
  3. Click API Key section
  4. Copy your API key
export ELEVENLABS_API_KEY="..."

Connector ID: provider.elevenlabs.tts.v1


AssemblyAI

Capabilities: Speech-to-Text, transcription, audio intelligence

  1. Go to assemblyai.com and sign up
  2. Navigate to your Dashboard
  3. Your API key is displayed on the dashboard home page
  4. Copy the key
export ASSEMBLYAI_API_KEY="..."

Connector ID: provider.assemblyai.stt.v1


Azure Speech

Capabilities: Text-to-Speech, Speech-to-Text (Microsoft Neural Voices)

  1. Go to portal.azure.com
  2. Create an Azure account (free tier available)
  3. Create a Speech Services resource
  4. Navigate to Keys and Endpoint
  5. Copy Key 1 and note the Region
export AZURE_SPEECH_KEY="..."
export AZURE_SPEECH_REGION="eastus"   # your region

Connector ID: provider.azure.tts.v1


Web Service Providers

Tavily

Capabilities: AI-optimized web search

  1. Go to tavily.com and sign up
  2. Navigate to your Dashboard
  3. Your API key is shown on the overview page
  4. Copy the key (starts with tvly-)
export TAVILY_API_KEY="tvly-..."

Connector ID: provider.tavily.search.v1


Serper

Capabilities: Google Search API (SERP results)

  1. Go to serper.dev and sign up
  2. Navigate to API Key in your dashboard
  3. Copy your key
export SERPER_API_KEY="..."

Connector ID: provider.serper.search.v1


Jina AI

Capabilities: Embeddings, reranking, web content extraction

  1. Go to jina.ai and sign up
  2. Navigate to API Keys in your account settings
  3. Create and copy your key
export JINA_API_KEY="..."

Connector ID: provider.jina.ai.v1


Firecrawl

Capabilities: Web scraping, content extraction, markdown conversion

  1. Go to firecrawl.dev and sign up
  2. Navigate to API Keys in your dashboard
  3. Create and copy your key (starts with fc-)
export FIRECRAWL_API_KEY="fc-..."

Connector ID: provider.firecrawl.scrape.v1


Local / Self-Hosted Providers

These providers run on your own machine — no API key required, no usage costs.

Ollama (Local)

Models: LLaMA 3, Mistral, Gemma, Phi, CodeLLaMA, and 100+ more

  1. Download from ollama.com
  2. Install and run: ollama serve
  3. Pull a model: ollama pull llama3.3
  4. The API is available at http://localhost:11434
export OLLAMA_HOST="http://localhost:11434"

Connector ID: ollama.local.v1


LM Studio (Local)

Models: Any GGUF model from Hugging Face

  1. Download from lmstudio.ai
  2. Install and launch LM Studio
  3. Download a model from the Discover tab
  4. Start the local server (Developer tab)
  5. The API is available at http://localhost:1234
export LMSTUDIO_HOST="http://localhost:1234"

Connector ID: lmstudio.local.v1


vLLM (Local)

Models: Any Hugging Face model with high-performance serving

  1. Install: pip install vllm
  2. Start the server:
    python -m vllm.entrypoints.openai.api_server \
      --model meta-llama/Llama-3.3-70B-Instruct
  3. The API is available at http://localhost:8000
export VLLM_HOST="http://localhost:8000"

Connector ID: vllm.local.v1


LocalAI (Local)

Models: LLaMA, Whisper, Stable Diffusion, and more via OpenAI-compatible API

  1. Install from localai.io
  2. Or run via Docker:
    docker run -p 8080:8080 localai/localai
  3. The API is available at http://localhost:8080
export LOCALAI_HOST="http://localhost:8080"

Connector ID: localai.local.v1


Using Keys in ModelMesh

Environment Variables (Simplest)

Set one or more keys and call create():

export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."
import modelmesh
client = modelmesh.create("chat-completion")
# ModelMesh auto-detects all configured providers

.env File (Development)

Create a .env file in your project root:

cp .env.example .env
# Edit .env and add your keys

YAML Configuration (Production)

Reference keys via secret store in modelmesh.yaml:

providers:
  openai.llm.v1:
    connector: openai.llm.v1
    config:
      api_key: "${secrets:OPENAI_API_KEY}"

Programmatic (Dynamic)

Pass keys directly in code:

import modelmesh

client = modelmesh.create(
    "chat-completion",
    providers={"openai": {"api_key": "sk-..."}},
)

Best Practices

  1. Start with one provider — you can always add more later
  2. Use free tiers — Gemini, Groq, and OpenRouter offer generous free tiers
  3. Never commit keys — use .env files (gitignored) or secret stores
  4. Rotate keys regularly — especially for production deployments
  5. Set budget limits — prevent surprise bills with ModelMesh budget enforcement
  6. Use local providers for development — Ollama and LM Studio are free and fast

Recommended Free-Tier Stack

For maximum free usage, set up these providers:

export GOOGLE_API_KEY="AI..."           # Gemini: generous free tier
export GROQ_API_KEY="gsk_..."           # Groq: fast free inference
export OPENROUTER_API_KEY="sk-or-..."   # OpenRouter: access to free models
client = modelmesh.create("chat-completion")
# Chains all three providers automatically

ModelMesh rotates between them when quotas are exhausted.


See also: System Configuration | Connector Catalogue | FAQ | Troubleshooting