Important
Sunset notice — the hosted Cairo Coder service will shut down on July 31, 2026.
The public API at api.cairo-coder.com and the cairo-coder.com website will be permanently discontinued at the end of July 2026. Please migrate any integrations that rely on the hosted API before this date.
Cairo Coder remains fully open source. You can keep using it by self-hosting this repository — see the Quick Start below. Thank you to everyone who used and supported the hosted service.
The most powerful open-source CairoLang generator.
The hosted service operated by Kasar Labs is being sunset and will shut down on July 31, 2026. New API keys are no longer recommended for production use. To continue using Cairo Coder after this date, self-host it using the instructions below.
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.
