Msglm — Development skill for Claude Code
msglm makes it a little easier to create messages for language models like Claude and OpenAI GPTs.
How to install Msglm
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open AnswerDotAI/msglm and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Msglm does
msglm makes it a little easier to create messages for language models like Claude and OpenAI GPTs.
Alternatives in Development
- Prompt Net Requests — I want to enhance the AsyncPlaywrightCrawlerStrategy to optionally capture network requests and console messag 85.8k ★
- Agent.System.Main.Communication Additions — messages 19k ★
- Claude Code Proxy — Run Claude Code on OpenAI models 3.3k ★
README
msglm
Installation
Install the latest version from pypi
$ pip install msglm
Usage
To use an LLM we need to structure our messages in a particular format.
Here’s an example of a text chat from the OpenAI docs.
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "user", "content": "What's the Wild Atlantic Way?"}
]
)
Generating the correct format for a particular API can get tedious. The goal of *msglm* is to make it easier.
The examples below will show you how to use *msglm* for text and image chats with OpenAI and Anthropic.
Text Chats
For a text chat simply pass a list of strings and the api format (e.g. “openai”) to **mk_msgs** and it will generate the correct format.
mk_msgs(["Hello, world!", "some assistant response"], api="openai")
[
{"role": "user", "content": "Hello, world!"},
{"role": "assistant", "content": "Some assistant response"}
]
anthropic
from msglm import mk_msgs_anthropic as mk_msgs
from anthropic import Anthropic
client = Anthropic()
r = client.messages.create(
model="claude-3-haiku-20240307",
max_tokens=1024,
messages=[mk_msgs(["Hello, world!", "some LLM response"])]
)
print(r.content[0].text)
openai
from msglm import mk_msgs_openai as mk_msgs
from openai import OpenAI
client = OpenAI()
r = client.chat.completions.create(
model="gpt-4o-mini",
messages=[mk_msgs(["Hello, world!", "some LLM response"])]
)
print(r.choices[0].message.content)
Image Chats
For an image chat simply pass the raw image bytes in a list with your question to *mk_msgs* and it will generate the correct format.
mk_msg([img, "What's in this image?"], api="anthropic")
[
{
"role": "user",
"content": [
{"type": "image", "source": {
Related Skills
BBilingual
Claude Code plugin: prompt in English, read the answer in your language. Shows a display-only translation unde
Ape Skills
Skills for apes like us, so we can do our jobs better and make our lives easier.
Claude Skill Progressive Disclosure
Make Claude Code skills easier to discover without cluttering your context. Automatically index your skills so
Little Agent
A lightweight embedded agent framework (similar to Claude Code and OpenAI Codex).
Claude Codex Nebius Proxy
A Claude Code + Codex CLI → Nebius bridge. Accepts Claude /v1/messages and Codex /v1/responses requests, conve
Oh My Opencode
#1 OpenCode Plugin- Battery included. ASYNC SUBAGENTS (YES LIKE CLAUDE CODE) · Curated agents with proper mode
Related Agents
Lean Main
Default main-session agent for token-efficient work. Behaves like normal Claude Code, but reads as little as p
AI Saglayici Uzmani
Anthropic Messages API ve OpenAI Codex App Server entegrasyonunun uzmanı — akış, araç döngüsü, hata/yeniden de
Prose Humanizer
Rewrites prose to remove AI writing patterns. Use when editing documentation, READMEs, PR descriptions, commit