Which LLMs Are Compatible with PrimeAgent? A Complete Provider & Model Guide
PrimeAgent supports dozens of large language models from OpenAI, Anthropic, Google, Amazon Bedrock, and 20+ other providers through a unified API abstraction.
PrimeAgent is an open-source agentic coding framework by PrimeIntellect that abstracts away provider‑specific implementation details. This article maps out exactly which LLMs are compatible, how the compatibility system works under the hood, and how to invoke specific models via CLI or SDK.
How PrimeAgent Defines LLM Compatibility
PrimeAgent uses two core type unions in packages/ai/src/types.ts to codify provider support: KnownApi for low‑level API protocols and KnownProvider for high‑level cloud providers.
KnownApi: The Protocol Layer
The KnownApi union defines how PrimeAgent communicates with each backend:
export type KnownApi =
| "openai-completions"
| "mistral-conversations"
| "openai-responses"
| "azure-openai-responses"
| "openai-codex-responses"
| "anthropic-messages"
| "bedrock-converse-stream"
| "google-generative-ai"
| "google-vertex";
Source: [packages/ai/src/types.ts](https://github.com/PrimeIntellect-ai/prime-agent/blob/main/packages/ai/src/types.ts#L6-L15)
These nine API patterns cover the major LLM interaction styles—from OpenAI's completions and responses formats to Anthropic's messages protocol, Amazon Bedrock's streaming converse API, and Google's Generative AI SDK.
KnownProvider: The Cloud Provider Layer
The KnownProvider union lists every cloud or hosting platform that PrimeAgent can route requests to:
export type KnownProvider =
| "amazon-bedrock"
| "anthropic"
| "google"
| "google-vertex"
| "openai"
| "azure-openai-responses"
| "openai-codex"
| "prime-inference"
| "deepseek"
| "github-copilot"
| "xai"
| "groq"
| "cerebras"
| "openrouter"
| "vercel-ai-gateway"
| "zai"
| "mistral"
| "minimax"
| "minimax-cn"
| "moonshotai"
| "moonshotai-cn"
| "huggingface"
| "fireworks"
| "opencode"
| "opencode-go"
| "kimi-coding"
| "cloudflare-workers-ai"
| "cloudflare-ai-gateway"
| "xiaomi"
| "xiaomi-token-plan-cn"
| "xiaomi-token-plan-ams"
| "xiaomi-token-plan-sgp";
Source: [packages/ai/src/types.ts](https://github.com/PrimeIntellect-ai/prime-agent/blob/main/packages/ai/src/types.ts#L19-L51)
This 31‑member union spans commercial APIs (OpenAI, Anthropic), hyperscaler platforms (AWS Bedrock, Google Vertex, Azure OpenAI), fast inference providers (Groq, Cerebras), model aggregators (OpenRouter, Vercel AI Gateway), and regional providers (Minimax, Moonshot AI, Xiaomi).
Specific LLMs Supported by Provider
Concrete model identifiers are auto‑generated at build time and stored in packages/ai/src/models.generated.ts. Based on the provider definitions and typical model catalogs, here are the popular LLMs compatible with PrimeAgent:
OpenAI Models
gpt-4andgpt-4-turbogpt-3.5-turboo1-previewando1-mini(reasoning models)gpt-4oandgpt-4o-mini(multimodal)
Anthropic Claude Models
claude-3-sonnet-20240229claude-3-haiku-20240307claude-3-opus-20240229claude-2.1andclaude-instant-1.2
Google Gemini Models
gemini-1.5-progemini-1.5-flashgemini-1.0-pro
Amazon Bedrock Models
anthropic.claude-v2anthropic.claude-instant-v1cohere.command-r-plusamazon.titan-text-express-v1
Mistral AI Models
mistral-large-latestmixtral-8x7b-instruct-latestmistral-mediumandmistral-small
Groq (Fast Inference)
llama-3.1-8b-instantllama-3.1-70b-versatilellama-3.1-405b-reasoninggemma-2-9b-it
OpenRouter & Vercel AI Gateway
These aggregators expose cross‑provider routing:
meta-llama/Meta-Llama-3-70B-Instructopenai/gpt-4o-minianthropic/claude-3.5-sonnet
Hugging Face Inference
Any model hosted on Hugging Face that implements an OpenAI‑compatible chat schema is routable through the huggingface provider.
Specialized Providers
- DeepSeek:
deepseek-chat,deepseek-coder - XAI:
grok-2,grok-2-mini - Fireworks: Mixture‑of‑experts and fine‑tuned model hosting
- Cerebras: Wafer‑scale inference for Llama architectures
The full enumerated list is generated by packages/ai/scripts/generate-models.ts and written to packages/ai/src/models.generated.ts at build time.
Using Specific LLMs with PrimeAgent
CLI: Direct Model Selection
PrimeAgent's CLI accepts any known model identifier:
# OpenAI GPT-4 for general reasoning
prime-agent --model gpt-4 --prompt "Refactor this Python function for clarity"
# Anthropic Claude for long-context tasks
prime-agent --model claude-3-sonnet-20240229 --prompt "Analyze this 100-page PDF summary"
# Google Gemini for multimodal use
prime-agent --model gemini-1.5-pro --prompt "Describe this image: https://example.com/chart.png"
# Groq for low-latency inference
prime-agent --model llama-3.1-8b-instant --prompt "Quick code review"
SDK: Programmatic Model Access
Import from @primeintellect/prime-agent/ai to work with models directly:
import { getModel, stream } from "@primeintellect/prime-agent/ai";
async function analyzeCode(sourceCode: string) {
// Initialize any supported model
const model = await getModel("claude-3-opus-20240229");
const response = await stream(model, {
messages: [
{
role: "system",
content: "You are a senior software engineer performing code review."
},
{
role: "user",
content: `Review this TypeScript:\n\n${sourceCode}`
}
],
temperature: 0.2
});
// Stream output token by token
for await (const event of response) {
if (event.type === "text_delta") {
process.stdout.write(event.delta);
}
}
}
analyzeCode("const x = 1; // TODO: rename");
The stream function in packages/ai/src/stream.ts normalizes provider differences, delivering a unified event stream regardless of underlying API.
How the Model Catalog Stays Current
PrimeAgent's build pipeline ensures LLM compatibility remains up‑to‑date:
packages/ai/scripts/generate-models.tsqueries each provider's model listing endpoint- Discovered models are typed and exported to
packages/ai/src/models.generated.ts - TypeScript compilation validates all model references against
KnownProvider
This automation means new models from OpenAI, Anthropic, or any supported provider become available without manual code changes.
Key Files for LLM Compatibility
| File | Purpose |
|---|---|
packages/ai/src/types.ts |
Source of truth for KnownApi and KnownProvider unions |
packages/ai/src/models.generated.ts |
Auto-generated catalog of concrete model identifiers |
packages/ai/scripts/generate-models.ts |
Build-time script that refreshes the model catalog |
packages/ai/src/stream.ts |
Unified streaming implementation across all providers |
packages/coding-agent/docs/providers.md |
Human-readable provider documentation |
Summary
- PrimeAgent LLM compatibility is defined by two type unions in
packages/ai/src/types.ts:KnownApi(9 protocols) andKnownProvider(31 cloud platforms). - Concrete models are enumerated in
packages/ai/src/models.generated.ts, populated at build time bygenerate-models.ts. - Popular compatible LLMs include GPT‑4, Claude 3, Gemini 1.5, Llama 3.1, and dozens more via providers like OpenRouter and Hugging Face.
- Invocation works uniformly via CLI
--modelflag or SDKgetModel()function, withstream()normalizing provider differences.
Frequently Asked Questions
How do I add a new provider or model that isn't in the KnownProvider list?
Extend the KnownProvider union in packages/ai/src/types.ts and add the corresponding API handler. For experimental providers, OpenRouter or Vercel AI Gateway act as universal adapters—route unsupported models through those aggregators without code changes.
Does PrimeAgent support self-hosted or local LLMs?
Yes. Use the huggingface provider for any OpenAI‑compatible endpoint, or deploy through Ollama, vLLM, or llama.cpp and proxy via OpenRouter. The KnownApi abstraction treats local endpoints identically to cloud APIs.
Are there model-specific features like function calling or vision?
PrimeAgent surfaces capabilities through a capability-negotiation layer in stream.ts. Models advertising OpenAI-compatible tools or Anthropic's tool_use support receive structured calls; vision inputs work for gpt-4o, claude-3, and gemini-1.5-pro when images are passed in the messages array.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →