<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Reggie on Medium]]></title>
        <description><![CDATA[Stories by Reggie on Medium]]></description>
        <link>https://medium.com/@reginold.lu?source=rss-994fe744d7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7nN84meWPPL5daPB4N45rA.jpeg</url>
            <title>Stories by Reggie on Medium</title>
            <link>https://medium.com/@reginold.lu?source=rss-994fe744d7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 21:20:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@reginold.lu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Run OpenAI Codex with SambaNova MiniMax 2.5]]></title>
            <link>https://medium.com/@reginold.lu/run-codex-with-sambanova-minimax-2-5-fastest-inference-low-cost-full-visibility-with-litellm-b42888ce54f5?source=rss-994fe744d7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b42888ce54f5</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[fast-inference]]></category>
            <category><![CDATA[sambanova]]></category>
            <category><![CDATA[llm-applications]]></category>
            <dc:creator><![CDATA[Reggie]]></dc:creator>
            <pubDate>Mon, 02 Mar 2026 09:37:30 GMT</pubDate>
            <atom:updated>2026-06-18T07:08:34.859Z</atom:updated>
            <content:encoded><![CDATA[<h3>Run OpenAI Codex with SambaNova MiniMax 2.5 — Fastest Inference, Low Cost, Full Visibility with LiteLLM</h3><p><em>2026/03/02: This tutorial explains how to set up Codex CLI with SambaNova’s MiniMax-M2.5 model, configure token pricing, and use LiteLLM to save prompts and completions to a PostgreSQL database.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j8ngAsnnORp4ULQ5FUNXyg.jpeg" /></figure><p>Minimax 2.5 delivers faster reasoning, stronger code synthesis, and more reliable multi-step execution compared to standard coding models. Its improved context handling and structured output consistency reduce debugging time and increase development velocity. For infrastructure-heavy, API-driven workflows, Minimax 2.5 provides stable, scalable performance ideal for production-grade engineering environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RXfHKqsVR-AVxny18R4oLQ.png" /><figcaption>Openrouter</figcaption></figure><iframe src="https://cdn.embedly.com/widgets/media.html?type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=twitter&amp;url=https%3A//x.com/steipete/status/2010761076598849759%3Fref_src%3Dtwsrc%255Etfw%257Ctwcamp%255Etweetembed%257Ctwterm%255E2010761076598849759%257Ctwgr%255Ec97b5a8f8bd40ec986945e49d15b4303890fd54e%257Ctwcon%255Es1_%26ref_url%3Dhttps%253A%252F%252Fsambanova.ai%252Fblog%252Fbuild-real-world-productivity-agents-on-sambacloud-with-minimax-2-5&amp;image=" width="500" height="281" frameborder="0" scrolling="no"><a href="https://medium.com/media/1401ddcdeec1ecfd19b297758f91a04a/href">https://medium.com/media/1401ddcdeec1ecfd19b297758f91a04a/href</a></iframe><h3><strong>What You’ll Achieve</strong></h3><p>By following this guide, you will:</p><p>1. <strong>Run Codex with SambaNova’s MiniMax-M2.5 model</strong>— Enjoy fast inference and low token pricing compared to OpenAI or Anthropic models</p><p>2. <strong>Integrate with LiteLLM</strong> — Automatically log all prompts, completions, and costs to a PostgreSQL database for full visibility into your LLM usage</p><h3><strong>Prerequisites</strong></h3><ol><li>Docker &amp; Docker Compose</li><li>SambaNova API key (get one at <a href="https://cloud.sambanova.ai/dashboard">Sambanova Cloud</a>)</li><li>A machine running macOS or Linux</li></ol><h3><strong>Step 1: Install Codex CLI</strong></h3><pre>npm i -g @openai/codex@0.57.0</pre><p><strong>&gt; Note:</strong> We recommend version 0.57.0 for stable compatibility with Minimax-2.5.</p><p>Reference: <a href="https://platform.minimax.io/docs/coding-plan/codex-cli">MiniMax Codex CLI Documentation</a></p><h3><strong>Step 2: Clone the Project</strong></h3><pre>https://github.com/reggie-lu/codex-sambanova-minimax<br>cd codex-sambanova-minimax</pre><h3><strong>Step 3: Set Environment Variables</strong></h3><p>Create or update your <strong>.env</strong> file with your API keys:</p><pre>export SAMBANOVA_API_KEY=&quot;your-sambanova-api-key&quot;<br>export LITELLM_MASTER_KEY=&quot;12345&quot; (For instance, you can set your own preference)<br>export CODEX_LITELLM_KEY=&quot;12345&quot;</pre><p>&gt; <strong>Tip:</strong> The master key is used to authenticate requests to the LiteLLM proxy. Set `CODEX_LITELLM_KEY` for Codex to authenticate.</p><h3><strong>Step 4: Configure Token Pricing and Database</strong></h3><p>Edit <em>proxy_config.yaml</em> to set your token prices and database settings:</p><pre>model_list:<br>  - model_name: MiniMax-M2.5<br>    litellm_params:<br>      model: openai/MiniMax-M2.5<br>      api_key: os.environ/SAMBANOVA_API_KEY<br>      api_base: https://api.sambanova.ai/v1<br>    model_info:<br>      input_cost_per_token: 0.0000003<br>      output_cost_per_token: 0.0000012<br>      tpm: 1000000<br>      rpm: 100<br><br>general_settings:<br>  master_key: os.environ/LITELLM_MASTER_KEY<br>  store_model_in_db: true<br>  store_prompts_in_spend_logs: true</pre><blockquote><strong>Why openai/MiniMax-M2.5 instead of sambanova/MiniMax-M2.5?</strong></blockquote><blockquote>You might notice we use openai/MiniMax-M2.5 as the model name instead of sambanova/MiniMax-M2.5. Here’s why:</blockquote><blockquote>1. <strong>OpenAI-Compatible Format</strong>— By using the openai/ prefix, LiteLLM routes the request through its OpenAI-compatible interface, which provides better compatibility with Codex’s tool calling capabilities.</blockquote><blockquote>2. <strong>Same Backend</strong> — Despite the openai/ prefix, the actual API call still goes to SambaNova’s endpoint (`https://api.sambanova.ai/v1`), so you still get SambaNova’s fast inference and low pricing.</blockquote><p><strong>Database Settings (general_settings)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6PCxTLAgT1TsYHUB7VJKGg.png" /></figure><p><em>These database settings enable:</em></p><ul><li><strong>Request logging</strong> — Every prompt and completion is stored</li><li><strong>Cost tracking</strong> — Automatic calculation of spend by model, user, and time period</li><li><strong>Analytics </strong>— View usage patterns through the LiteLLM UI</li></ul><p><em>The pricing above reflects MiniMax-M2.5’s rates:</em></p><ul><li><strong>Input:</strong> $0.30 per 1M tokens</li><li><strong>Output:</strong> $1.20 per 1M tokens</li></ul><p>&gt; <strong>Important:</strong> If you modify <em>proxy_config.yaml</em>, run <em>docker compose restart litellm</em> to apply the changes.</p><h3><strong>Step 5: Start LiteLLM and PostgreSQL</strong></h3><pre>docker compose up --build</pre><p>This starts two services:</p><ul><li><strong>LiteLLM Proxy</strong> on port 4000</li><li><strong>PostgreSQL</strong> on port 5433 (internal port 5432)</li></ul><h3><strong>Step 6: Configure Codex to Use LiteLLM</strong></h3><p>Create or update <em>~/.codex/config.toml</em> with the following configuration:</p><pre># Recall that in TOML, root keys must be listed before tables.<br>model = &quot;MiniMax-M2.5&quot;<br>model_provider = &quot;litellm&quot;<br>model_reasoning_effort = &quot;high&quot;<br>approval_policy = &quot;on-request&quot;<br>sandbox_mode = &quot;workspace-write&quot;<br>personality = &quot;pragmatic&quot;<br><br>[model_providers.litellm]<br>name = &quot;LiteLLM Local&quot;<br>base_url = &quot;http://localhost:4000/v1&quot;<br>env_key = &quot;CODEX_LITELLM_KEY&quot;<br>wire_api = &quot;chat&quot;<br>query_params = {&quot;temperature&quot; = &quot;1&quot;, &quot;do_sample&quot; = &quot;true&quot;}<br><br>[sandbox_workspace_write]<br>network_access = true<br><br>[analytics]<br>enabled = false<br><br>[projects.&quot;/Your_path/work&quot;]<br>trust_level = &quot;trusted&quot;<br><br>web_search = &quot;live&quot;</pre><p>&gt; <strong>Reference:</strong> For a complete list of all Codex <em>config.toml</em> options, see the [<a href="https://developers.openai.com/codex/config-sample">OpenAI Codex Configuration Documentation</a>]</p><blockquote><strong>Why <em>wire_api = “chat”</em>?</strong></blockquote><blockquote>We use wire_api = “chat” instead of wire_api = “responses” because:</blockquote><blockquote>1. <strong>LiteLLM’s primary interface</strong> — LiteLLM exposes /v1/chat/completions as its main endpoint, which expects the chat completions format</blockquote><blockquote>2. <strong>Better compatibility</strong> — The chat format is the modern standard for LLM interactions and is universally supported by all providers</blockquote><blockquote>3. <strong>Full feature support</strong>— Features like streaming, tools/function calling work better with the chat completions format</blockquote><blockquote>4. <strong>SambaNova/MiniMax optimized</strong> — The MiniMax-M2.5 model on SambaNova is optimized for the chat completions format</blockquote><p><strong>Now Codex will route requests through LiteLLM to SambaNova’s MiniMax-M2.5 model!</strong></p><p>In your terminal:</p><pre>codex</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vkeAS26REYurJI_17BT2TQ.png" /></figure><h3><strong>Step 7: View Logs and Data</strong></h3><p><strong>Option A: LiteLLM UI</strong></p><p>Access <a href="http://localhost:4000/">http://localhost:4000</a> and log in with your <em>LITELLM_MASTER_KEY</em> to:</p><ul><li>View request logs — See all prompts and completions</li><li>Monitor spending — Track costs by model and time period</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2o7XMHIY7d48oUzIla3Cug.png" /><figcaption>View request logs with prompt and response</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmtA_ZtwTA2HciZSKszzUA.png" /><figcaption>cost</figcaption></figure><p><strong>Option B: Direct PostgreSQL Access</strong></p><p>If you prefer to query the database directly with SQL, connect to PostgreSQL:</p><pre>docker compose exec postgres psql -U litellm -d litellm</pre><p>Useful SQL queries:</p><pre>-- View recent requests (note: use double quotes for table name)<br>SELECT * FROM &quot;LiteLLM_SpendLogs&quot; ORDER BY &quot;startTime&quot; DESC LIMIT 10;<br><br>-- Check spend by model<br>SELECT model, SUM(spend) as total_spend <br>FROM &quot;LiteLLM_SpendLogs&quot; <br>GROUP BY model;<br><br>-- View specific model requests<br>SELECT * FROM &quot;LiteLLM_SpendLogs&quot; <br>WHERE model = &#39;MiniMax-M2.5&#39; <br>ORDER BY &quot;startTime&quot; DESC <br>LIMIT 5;<br><br>-- View token usage by model<br>SELECT <br>  model,<br>  SUM(prompt_tokens) as total_prompt_tokens,<br>  SUM(completion_tokens) as total_completion_tokens,<br>  SUM(total_tokens) as total_tokens<br>FROM &quot;LiteLLM_SpendLogs&quot; <br>GROUP BY model;<br><br>-- View all columns available<br>SELECT column_name FROM information_schema.columns <br>WHERE table_name = &#39;LiteLLM_SpendLogs&#39;;</pre><h3><strong>Troubleshooting</strong></h3><p>See <a href="https://github.com/reginold/codex-sambanova-minimax/blob/main/log.md">log.md</a>(in the repo) for detailed issue resolutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*3pDFVIhXA_acR_ckLOLmNg.png" /></figure><h3><strong>Summary</strong></h3><p>You now have:</p><ul><li>Codex CLI installed (v0.57.0)</li><li>Codex CLI integrated with SambaNova’s MiniMax-M2.5</li><li>Token pricing configured for accurate cost tracking</li><li>LiteLLM proxy for unified API access</li><li>LiteLLM UI for viewing all prompts, completions, and costs</li><li>PostgreSQL database storing all request data</li><li>Direct SQL access for custom queries</li></ul><p>This setup gives you full visibility into your LLM usage while leveraging SambaNova’s <em>MiniMax-M2.5 </em>high-performance inference.</p><h3><strong>References</strong></h3><ul><li><a href="https://developers.openai.com/codex/config-sample">OpenAI Codex Configuration</a></li></ul><p><em>Have questions or run into issues? Drop a comment below!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*QOBlV39ZILw0pJOYeg3JvQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b42888ce54f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>