Skip to main content

Code Llama

Meta's code-specialized Llama models — open-source code generation, completion, and infill for 500+ languages

LLM FrameworksFree

Code Llama is Meta's family of open-source code-specialized language models built on top of Llama 2. Available in 7B, 13B, 34B, and 70B parameter sizes, Code Llama supports code generation, completion, infilling, and instruction following across 500+ programming languages. It includes specialized variants — Code Llama Python for Python-heavy workloads and Code Llama Instruct for chat-based code assistance. Free to use commercially under the Llama 2 Community License.

Key specs
70,000,000,000 Model parameters (largest) source
as of 2026-03-27

What we know

PricingFreefrom our original listing, not yet re-checked

Why it matters

  • Open-source and self-hostable — run code AI on private codebases without sending code to external APIs; critical for proprietary or regulated environments.
  • Free commercial use under the Llama 2 Community License — eliminate per-token API costs at scale by hosting on your own GPU infrastructure.
  • Code infilling capability fills in code between two existing blocks — useful for completing functions in context, not just generating from prompts.
  • 100K token context window on larger models — process entire files, full functions, and multi-module context in a single inference call.

Key capabilities

  • Code generation: Generate code from natural language descriptions in 500+ languages.
  • Code completion: Autocomplete partial code; integrate with LSP-compatible editors.
  • Infilling: Fill-in-the-middle (FIM) — generate code between a prefix and suffix context block.
  • Instruction following: Code Llama Instruct variant handles chat-style "write me a function that…" prompts.
  • Python specialization: Code Llama Python variant shows stronger benchmark performance on Python tasks.
  • Debugging: Explain bugs, suggest fixes, and identify issues in provided code snippets.
  • Code explanation: Describe what code does; generate documentation from code.
  • Multiple sizes: 7B (fast, local CPU-feasible), 13B, 34B, 70B — choose speed vs quality tradeoff.

Technical notes

  • Model sizes: 7B, 13B, 34B, 70B parameters
  • Variants: Code Llama (base), Code Llama Python, Code Llama Instruct
  • Context window: 4K tokens base; 100K for long-context versions
  • Languages: Python, C++, Java, PHP, TypeScript, C#, Bash, 500+ total
  • Base model: Built on Llama 2
  • License: Llama 2 Community License (free commercial use for most)
  • Download: HuggingFace — meta-llama/CodeLlama-*
  • Inference: Ollama, llama.cpp, vLLM, Together AI, Replicate
  • GPU requirement: 7B: 8GB VRAM; 13B: 16GB; 34B: 40GB+; 70B: 80GB+
  • Released: August 2023 (initial); January 2024 (Code Llama 70B)

Usage example

# Via Ollama (local inference)
# ollama pull codellama:34b
import ollama

response = ollama.chat(model='codellama:34b', messages=[
    {'role': 'user', 'content': 'Write a Python function to parse a JSON config file with error handling.'}
])
print(response['message']['content'])
# Via Together AI (hosted API — OpenAI-compatible)
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_TOGETHER_API_KEY",
    base_url="https://api.together.xyz/v1"
)

response = client.chat.completions.create(
    model="togethercomputer/CodeLlama-34b-Instruct",
    messages=[{"role": "user", "content": "Explain this Python code: def fib(n): return n if n <= 1 else fib(n-1) + fib(n-2)"}]
)

Ideal for

  • Teams with private codebases who need self-hosted code AI without data leaving their environment.
  • Organizations running high-volume code generation who want to eliminate per-token API costs.
  • Researchers and developers fine-tuning a code model on domain-specific languages or internal codebases.
  • Edge/embedded deployments where Code Llama 7B runs on consumer GPUs or quantized on CPU.

Not ideal for

  • Teams wanting a fully managed, zero-infrastructure code assistant — use GitHub Copilot or Cursor instead.
  • Cutting-edge reasoning or complex multi-step code architecture — GPT or Claude typically outperform Code Llama on complex tasks.
  • Non-technical users who need a chat interface rather than model weights.

See also

  • StarCoder — BigCode/HuggingFace open code model; 600+ languages; alternative to Code Llama.
  • Tabby — Self-hosted coding assistant server that can run Code Llama and StarCoder models.
  • Ollama — Local model runner; ollama pull codellama for instant local Code Llama setup.

FAQ

What is Code Llama?

Code Llama is a family of open-source large language models from Meta, specialized for code generation and understanding. Built on Llama 2, it comes in 7B, 13B, 34B, and 70B parameter sizes, each available in three variants: base Code Llama (general code completion), Code Llama Python (fine-tuned on Python-heavy data), and Code Llama Instruct (fine-tuned for natural language instructions and chat). It supports code generation, completion, infilling (filling in code between existing lines), and debugging.

Is Code Llama free to use commercially?

Code Llama is available under the Llama 2 Community License, which permits commercial use for most companies. Organizations with more than 700 million monthly active users must request a separate license from Meta. For the vast majority of teams and companies, Code Llama is free to use, self-host, and fine-tune — with no per-token API costs if you run it on your own infrastructure.

What programming languages does Code Llama support?

Code Llama supports 500+ programming languages, with strongest performance in Python, C++, Java, PHP, TypeScript/JavaScript, C#, and Bash. The Code Llama Python variant was additionally trained on a Python-heavy dataset, making it stronger for Python-specific tasks like data science code, Jupyter notebooks, and Python library usage. It also understands configuration formats, markup languages, and SQL.

How does Code Llama compare to GPT or GitHub Copilot?

On coding benchmarks like HumanEval, Code Llama 70B came close to the leading commercial models of its time for Python code generation. For most common coding tasks — function writing, debugging, code explanation — Code Llama 34B+ is competitive with commercial models. The key differentiator is self-hostability: Code Llama runs on your own GPU with no data leaving your environment. Commercial models (Copilot, GPT) typically outperform Code Llama 7B-13B on complex reasoning tasks.

Alternatives

Is your tool an alternative to Code Llama? Sponsor this spot for 30 days, marked Sponsored.

Integrations

None listed.

Built on

For the team behind Code Llama

Growth plan: from $399 a month

SEO, AI search (how ChatGPT, Perplexity and Google describe Code Llama), UX, CRO and support from one account manager, with a monthly report. Includes a Featured launch on db.fyi. Starts with a free audit.

Founding offer: $299 a month for your first 3 months, plus a free case study.

Get a free audit

Listed 2026-02-28 · updated 2026-11-12