Skip to main content

Models

Access 100+ models through OpenRouter. Format: openrouter/provider/model
  • Claude: openrouter/anthropic/claude-3.7-sonnet
  • GPT-4: openrouter/openai/gpt-4o
  • Gemini: openrouter/google/gemini-2.5-flash
  • Llama: openrouter/meta-llama/llama-3.3-70b-instruct
  • DeepSeek: openrouter/deepseek/deepseek-chat

Python

# export OPENROUTER_API_KEY=your-api-key
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a helpful assistant",
    llm="openrouter/anthropic/claude-3.7-sonnet"
)
agent.start("Explain quantum computing")

With Tools

# export OPENROUTER_API_KEY=your-api-key
from praisonaiagents import Agent

def translate(text: str, language: str) -> str:
    """Translate text to another language."""
    return f"Translated '{text}' to {language}"

agent = Agent(
    instructions="You are a translation assistant",
    llm="openrouter/openai/gpt-4o",
    tools=[translate]
)
agent.start("Translate 'Hello world' to Spanish")

Multi-Agent

# export OPENROUTER_API_KEY=your-api-key
from praisonaiagents import Agent, Task, Agents

researcher = Agent(
    instructions="You research topics thoroughly",
    llm="openrouter/anthropic/claude-3.7-sonnet"
)
writer = Agent(
    instructions="You write clear summaries",
    llm="openrouter/openai/gpt-4o-mini"
)

task1 = Task(description="Research blockchain technology", agent=researcher)
task2 = Task(description="Write a beginner's guide", agent=writer)

agents = Agents(agents=[researcher, writer], tasks=[task1, task2])
agents.start()

CLI

export OPENROUTER_API_KEY=your-api-key

# Basic prompt
python -m praisonai "Explain AI" --llm openrouter/anthropic/claude-3.7-sonnet

# With temperature
python -m praisonai "Write a poem" --llm openrouter/openai/gpt-4o --temperature 0.9

# Run agents.yaml
python -m praisonai

YAML

framework: praisonai
topic: Cross-provider AI research
agents:
  researcher:
    role: Research Analyst
    goal: Find comprehensive information
    instructions: You are an expert researcher
    llm:
      model: openrouter/anthropic/claude-3.7-sonnet
    tasks:
      research_task:
        description: Research the latest AI developments
        expected_output: Detailed research report

  writer:
    role: Content Writer
    goal: Create engaging content
    instructions: You write clear and engaging content
    llm:
      model: openrouter/openai/gpt-4o-mini
    tasks:
      write_task:
        description: Write a summary of the research
        expected_output: Well-written summary article