The most powerful open-source CairoLang generator.
Cairo Coder is free to use up to a certain limit, hosted by Kasar Labs. You can use it either as an MCP that enhances your agentic tools, or as a standalone API. Get an API Key now.
Cairo Coder is an intelligent code generation service that makes writing Cairo smart contracts and programs faster and easier. It uses an advanced, optimizable Retrieval-Augmented Generation (RAG) pipeline built with DSPy to understand Cairo's syntax, patterns, and best practices.
- Cairo Code Generation: Transforms natural language requests into functional Cairo code
- DSPy RAG Architecture: Structured and optimizable RAG pipeline for accurate code generation
- OpenAI Compatible API: Drop-in replacement for OpenAI API format
- Multi-LLM Support: Works with OpenAI, Anthropic, Google Gemini, and other providers
- Source-Informed Generation: Code generated from up-to-date Cairo documentation
- MCP Support: Integration with agentic tools via cairo-coder-mcp
# Clone and configure
git clone https://github.com/KasarLabs/cairo-coder.git
cd cairo-coder
cp .env.example .env
# Edit .env with your API keys
# First time: populate vector database
docker compose up postgres ingester --build
# Run the service
docker compose up postgres backend --buildThe API is available at http://localhost:3001/v1/chat/completions.
curl -X POST http://localhost:3001/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "cairo-coder",
"messages": [
{"role": "user", "content": "How do I implement a counter contract in Cairo?"}
]
}'| Document | Description |
|---|---|
| API Reference | HTTP endpoints, request/response formats, streaming |
| Architecture | System design, RAG pipeline, project structure |
| CLAUDE.md | Agent instructions for development |
# Start database
docker compose up postgres
# Setup Python backend
cd python
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
# Run ingester (first time)
cd ../ingesters
bun install
bun run generate-embeddings:yes
# Start server
cd ../python
uv run cairo-coder --dev# Python tests
cd python
uv run pytest
# Ingester tests
cd ingesters
bun testcairo-coder/
├── python/ # Python backend (FastAPI + DSPy RAG)
├── ingesters/ # TypeScript documentation ingester
├── docs/ # Documentation
└── docker-compose.yml
This project is based on Starknet Agent, an open-source AI search engine for the Starknet ecosystem.
We welcome contributions! Whether you're fixing bugs, improving documentation, or adding new features, your help is appreciated.
MIT License - see LICENSE for details.
