<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es" -->

---
title: OpenAI Codex with Ollama · Ollama Blog | daily.dev
description: Open-weight models like gpt-oss:20b and gpt-oss:120b can now run with OpenAI's Codex CLI through Ollama. Setup involves installing Codex CLI, launching it with...
canonical: https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: OpenAI Codex with Ollama · Ollama Blog | daily.dev
og:description: Open-weight models like gpt-oss:20b and gpt-oss:120b can now run with OpenAI's Codex CLI through Ollama. Setup involves installing Codex CLI, launching it with...
og:url: https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es
og:image: https://api.daily.dev/og/posts/3ZDP6f3es.png
og:image:alt: OpenAI Codex with Ollama · Ollama Blog
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI Codex with Ollama · Ollama Blog

**[Ollama](https://daily.dev/sources/ollama)** · 1 min read · 0 upvotes · 0 comments

## Summary

Open-weight models like gpt-oss:20b and gpt-oss:120b can now run with OpenAI's Codex CLI through Ollama. Setup involves installing Codex CLI, launching it with the --oss flag, and optionally switching models with -m. A context window of at least 32K tokens is recommended, and Ollama Cloud models are also supported via a -cloud model suffix.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://ollama.com/blog/codex>

## Questions this post answers

### How do I run OpenAI Codex CLI with local open-weight models instead of OpenAI's hosted models?

Install the Codex CLI with npm install -g @openai/codex, then start it with the --oss flag, which by default uses the local gpt-oss:20b model through Ollama. Switch models with the -m flag, for example codex --oss -m gpt-oss:120b. A context window of at least 32K tokens is recommended for reliable operation.

_daily.dev surfaces integration guides like this for developers wiring local models into coding agents._

### Can I use Ollama Cloud models with the Codex CLI --oss flag?

Yes, all models available on Ollama Cloud work with the Codex CLI. Run them by appending -cloud to the model name, for example codex --oss -m gpt-oss:120b-cloud, which routes inference to Ollama's cloud infrastructure instead of a local machine.

_Developers comparing local versus cloud inference options track setups like this on daily.dev._

## Similar posts on daily.dev

- [I run my local LLMs inside the ChatGPT desktop app now, and it took one free open-source tool to do it](https://daily.dev/posts/i-run-my-local-llms-inside-the-chatgpt-desktop-app-now-and-it-took-one-free-open-source-tool-to-do--3ovk4nou0) · XDA Developers · 0 upvotes · 1 comments
- [Cline \+ Ollama: A fully local AI coding agent](https://daily.dev/posts/cline-ollama-a-fully-local-ai-coding-agent-y7br6omis) · LogRocket · 1 upvotes · 0 comments
- [How to Run Claude Code for Free with Local and Cloud Models from Ollama](https://daily.dev/posts/how-to-run-claude-code-for-free-with-local-and-cloud-models-from-ollama-rj95dfqat) · Towards Data Science · 4 upvotes · 0 comments
- [What Ollama Launch Is and How to Use It for Local and Cloud Coding Tools](https://daily.dev/posts/what-ollama-launch-is-and-how-to-use-it-for-local-and-cloud-coding-tools-sjbbfkxy1) · C\# Corner · 1 upvotes · 0 comments

---

Tags: [#cli](https://daily.dev/tags/cli), [#local-ai](https://daily.dev/tags/local-ai), [#ollama](https://daily.dev/tags/ollama), [#openai-codex](https://daily.dev/tags/openai-codex)

[View this post on daily.dev](https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"OpenAI Codex with Ollama · Ollama Blog","url":"https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es"},"datePublished":"2026-08-23T12:20:50.636Z","dateModified":"2026-08-23T12:45:25.243Z","description":"Open-weight models like gpt-oss:20b and gpt-oss:120b can now run with OpenAI's Codex CLI through Ollama. Setup involves installing Codex CLI, launching it with...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/03fb1a10ef158f8986c9778334c2af42?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/03fb1a10ef158f8986c9778334c2af42?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Ollama","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Ollama","logo":"https://media.daily.dev/image/upload/s--dRYYkBCj--/f_auto,q_auto/v1787487632/logos/ollama-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/ollama"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"cli,local-ai,ollama,openai-codex","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Ollama","item":"https://daily.dev/sources/ollama"},{"@type":"ListItem","position":3,"name":"OpenAI Codex with Ollama · Ollama Blog"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/openai-codex-with-ollama-ollama-blog-3zdp6f3es#faq","mainEntity":[{"@type":"Question","name":"How do I run OpenAI Codex CLI with local open-weight models instead of OpenAI's hosted models?","acceptedAnswer":{"@type":"Answer","text":"Install the Codex CLI with npm install -g @openai/codex, then start it with the --oss flag, which by default uses the local gpt-oss:20b model through Ollama. Switch models with the -m flag, for example codex --oss -m gpt-oss:120b. A context window of at least 32K tokens is recommended for reliable operation. daily.dev surfaces integration guides like this for developers wiring local models into coding agents."}},{"@type":"Question","name":"Can I use Ollama Cloud models with the Codex CLI --oss flag?","acceptedAnswer":{"@type":"Answer","text":"Yes, all models available on Ollama Cloud work with the Codex CLI. Run them by appending -cloud to the model name, for example codex --oss -m gpt-oss:120b-cloud, which routes inference to Ollama's cloud infrastructure instead of a local machine. Developers comparing local versus cloud inference options track setups like this on daily.dev."}}]}
```

