GitHubGet started

Use the model you already pay for

Ailoy runs Claude, GPT and Gemini through the CLIs you are already logged into. Switch to an API key, Bedrock, OpenRouter or your own server with one line.

# the CLI is the default
AgentBuilder("anthropic/claude-haiku-5-5")
Needs claude on PATH, logged in

Every way to reach a model, from the same code

agent.py
from ailoy import AgentBuilder

agent = await AgentBuilder("anthropic/claude-haiku-5-5").build()

async for output in agent.run("Plan my week"):
    print(output["message"])
agent.py
AgentBuilder("anthropic/claude-haiku-5-5")
agent.py
AgentBuilder("anthropic")
.env and agent.py
# .env
ANTHROPIC_API_KEY=...

# agent.py
ailoy.set_lang_model_provider("anthropic", "api")
AgentBuilder("anthropic/claude-haiku-5-5")
.env and agent.py
# .env
AWS_BEARER_TOKEN_BEDROCK=...

# agent.py
ailoy.set_lang_model_provider("anthropic", "bedrock")
AgentBuilder("anthropic/claude-haiku-5-5")
terminal and agent.py
$ vllm serve deepseek-ai/DeepSeek-V3.2

# agent.py
ailoy.set_lang_model_provider("deepseek-ai", "vllm")
AgentBuilder("deepseek-ai/DeepSeek-V3.2")
  1. 01

    Your CLI login, no API key

    Claude, GPT and Gemini run through Claude Code, Codex or Gemini CLI by default. If it works in your terminal, your agent works too.

    Needs
    The CLI on PATH, logged in
    Works with
    claudegptgemini
  2. 02

    Swap models with one string

    Every model is named org/name. Change the string and the rest of your agent stays the same.

    Needs
    Only what the model’s backend needs
    Works with
    claudegptgeminideepseekkimiglmqwen
  3. 03

    Name the org, get its default

    Leave off the model name and the CLI picks the model it would use on its own.

    Needs
    A CLI backend: the CLI decides the model
    Works with
    claudegptgemini
  4. 04

    Or the org’s own API

    Set the org’s key and switch the backend to api. DeepSeek, Kimi, GLM and Qwen are on their API already.

    Needs
    The org’s key, such as ANTHROPIC_API_KEY or DEEPSEEK_API_KEY
    Works with
    claudegptgeminideepseekkimiglmqwen
  5. 05

    Bedrock and OpenRouter, same name

    Keep the model name you already use. Ailoy finds it in the Bedrock or OpenRouter catalog for you. Bedrock uses your AWS_REGION, else us-east-1.

    Needs
    AWS_BEARER_TOKEN_BEDROCK, or OPENROUTER_API_KEY. Bedrock has every org but Google
    Works with
    claudegptgeminideepseekkimiglmqwen
  6. 06

    Open models on your own server

    Serve DeepSeek, Kimi, GLM or Qwen with vLLM. Ailoy reads the address from VLLM_BASE_URL, http://localhost:8000/v1 by default.

    Needs
    VLLM_BASE_URL, and VLLM_API_KEY if the server wants one
    Works with
    deepseekkimiglmqwen

Plug in a model Ailoy does not ship

Give set_lang_model_provider a factory instead of a backend name. It returns any object with an infer method, so an in-house model or a test stub works like any other. This one hands back what you type.

echo.py
class Echo:
    async def infer(self, messages, tools, options):
        text = messages[-1]["contents"][0]["text"]
        return {
            "message": {
                "role": "assistant",
                "contents": [{"type": "text", "text": text}],
            },
            "finish_reason": {"type": "stop"},
        }

ailoy.set_lang_model_provider("mine", lambda org, name: Echo())
agent = await AgentBuilder("mine/echo").build()

Reply from mine/echo

Hello from my own model

Keep reading

FAQs

Can I use my Claude subscription?

Yes. Claude runs through the logged-in Claude Code CLI by default.

Can vLLM serve Claude or GPT?

No. vLLM covers deepseek-ai, moonshotai, zai-org and Qwen.

Do model options work on every backend?

Yes. thinking_effort and output_schema work the same whether the model runs through a CLI, an API, Bedrock, OpenRouter or vLLM.

Can I add a provider Ailoy does not ship?

Yes. Pass a factory to set_lang_model_provider.

Can I call a model without an agent?

Yes. LangModel.create runs a model on the messages you give it, with no tools and no history. infer returns the whole reply and infer_stream streams it.

Run your first agent
on your own model

Install the package, name a model and run it