Skip to Content
DocsModelsProviders

Providers

String dispatch by prefix

String prefixResolves toRequired env var
claude-* (incl. claude-opus-*, claude-sonnet-*, claude-haiku-*)AnthropicModelANTHROPIC_API_KEY
gpt-*, o1-*, o3-*OpenAIModelOPENAI_API_KEY
mistral-*LiteLLMModelprovider-specific
command-* (Cohere)LiteLLMModelCOHERE_API_KEY
bedrock/*LiteLLMModelAWS creds
vertex_ai/*LiteLLMModelGCP creds
gemini/*LiteLLMModelGEMINI_API_KEY
together_ai/*LiteLLMModelTOGETHER_API_KEY
replicate/*LiteLLMModelREPLICATE_API_KEY
azure/*LiteLLMModelAzure creds
ollama/*LiteLLMModellocal Ollama running
groq/*LiteLLMModelGROQ_API_KEY
litellm/*LiteLLMModel (explicit opt-in; strips the prefix)provider-specific
echoEchoModelnone

Anything that doesn’t match one of these prefixes raises ConfigError rather than guessing — so o4-*, mixtral-*, or a bare provider name won’t resolve. For those, prefix with litellm/ (e.g. litellm/mistral/mixtral-8x7b) to route explicitly through LiteLLM.

from loomflow import Agent Agent("...", model="claude-opus-4-7") Agent("...", model="claude-haiku-4-5") Agent("...", model="gpt-4o") Agent("...", model="o3-mini") Agent("...", model="mistral-large") Agent("...", model="command-r-plus") Agent("...", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0") Agent("...", model="vertex_ai/gemini-pro") Agent("...", model="ollama/llama3") Agent("...", model="groq/llama-3.1-70b") Agent("...", model="litellm/claude-3-haiku") # explicit opt-in

Anthropic

from loomflow import Agent agent = Agent("...", model="claude-opus-4-7") # ANTHROPIC_API_KEY must be set.

Install: pip install 'loomflow[anthropic]'.

The adapter wraps the official anthropic SDK’s AsyncAnthropic.messages.create(stream=True, ...). Tool calls serialize to Anthropic’s content-block format under the hood.

OpenAI

from loomflow import Agent agent = Agent("...", model="gpt-4o") # OPENAI_API_KEY must be set.

Install: pip install 'loomflow[openai]'.

OpenAI-compatible endpoints (Together, Fireworks, Anyscale, vLLM) work via base_url= on the underlying client.

LiteLLM (~100 providers behind one adapter)

from loomflow import Agent agent = Agent("...", model="mistral-large") agent = Agent("...", model="bedrock/anthropic.claude-3-sonnet-20240229-v1:0") agent = Agent("...", model="ollama/llama3")

Install: pip install 'loomflow[litellm]'.

Provider auth is whatever litellm expects. Typically env vars matching the provider’s official client (AWS_PROFILE, GOOGLE_APPLICATION_CREDENTIALS, MISTRAL_API_KEY, COHERE_API_KEY, etc.). See LiteLLM’s docs for the full matrix.

Echo

agent = Agent("...", model="echo") result = await agent.run("hi") print(result.output) # "Echo: hi"

EchoModel echoes the prompt as the assistant’s reply. No tool calls, no streaming meaningful tokens. For smoke-testing the agent loop without burning real tokens.

Scripted

from loomflow import Agent, ScriptedModel, ScriptedTurn model = ScriptedModel(turns=[ ScriptedTurn(text="The answer is 42."), ScriptedTurn(tool_calls=[...]), ScriptedTurn(text="Done."), ]) agent = Agent("...", model=model)

For tests with deterministic multi-turn scenarios. Each ScriptedTurn becomes one model response; the framework consumes them in order.

Secrets handling

API keys resolve in this order inside every adapter:

  1. Explicit api_key= argument on the adapter.
  2. secrets.lookup_sync(<ENV_VAR_NAME>) if a Secrets backend is wired on Agent(tuning=Tuning(secrets=...)).
  3. os.environ[<ENV_VAR_NAME>] as the bare fallback.

For Vault / AWS Secrets Manager / 1Password, write a custom Secrets adapter. See Secrets resolution.

Per-tenant model selection. Different tenants can use different models. Pass an instance per call by constructing a different Agent per tenant, or set up a router architecture where the classifier picks a specialist with the right model.

Last updated on