دليل الأسعار

أسعار OpenAI Codex: التكلفة الحقيقية لـ CLI في 2026

OpenAI Codex CLI is a free, open-source tool — but it sends every prompt to the OpenAI API, which charges per token. One image compression task burned 7,675 tokens: between 3 and 11 cents. The default model, codex-mini-latest, costs $1.50 per million input tokens and $6.00 per million output tokens. Pointing Codex at RunAPI instead cuts those rates by 50%, with no other changes to your workflow.

آخر تحديث June 23, 2026 RunAPI Editorial
نظرة عامة سريعة

كم تبلغ تكلفة OpenAI Codex؟

The Codex CLI itself is free to download and run. The cost comes from API calls: every prompt, file read, and code generation goes to the OpenAI API. The default model is codex-mini-latest, priced at $1.50/1M input tokens and $6.00/1M output tokens through OpenAI directly. A moderate coding session — roughly 8M input and 2M output tokens per month — runs about $24 with OpenAI. The same usage through RunAPI costs $12. RunAPI is OpenAI-compatible, so you change two environment variables and nothing else. Tip: run /compact during long sessions to free up context and stop burning tokens on conversation history.

Codex CLI مجاني

لا توجد رسوم اشتراك على CLI نفسه. تدفع فقط مقابل رموز API المستهلَكة خلال كل جلسة برمجة.

OpenAI مباشرةً — $1.50 / $6.00 لكل مليون رمز

يكلف إدخال codex-mini-latest $1.50/مليون رمز، والإخراج $6.00/مليون رمز عبر واجهة برمجة تطبيقات OpenAI.

RunAPI — $0.75 / $3.00 لكل مليون رمز

تقدم RunAPI النموذج نفسه بخصم 50%. اضبط متغيري بيئة ويتوجه Codex عبر RunAPI تلقائيًا.

لا قيود على الاشتراك

ادفع فقط مقابل ما تستخدمه. لا رسوم اشتراك شهري. لا حد أدنى للإنفاق. تتوقف الفواتير فور توقفك عن البرمجة.

كيفية عمل الفوترة

ما الذي يُحتسب كرمز؟

Every message Codex sends to the API includes your prompt, the full context of files it has read, any tool results, and conversation history. That combined input is tokenized (roughly 750 words per 1,000 tokens). The model's response — edited code, explanations, next steps — counts as output tokens. Both directions are billed separately. Codex caches nothing between sessions, so a fresh session re-reads the same files and bills that context again. One real example from a developer testing image compression — a single 5 MB file task burned 7,675 tokens, or roughly 3 to 11 cents. Not very cheap for one file, but most coding sessions stay well under a dollar each.

مقارنة الأسعار

أسعار codex-mini-latest: OpenAI مقابل RunAPI

الأسعار بالدولار الأمريكي لكل مليون رمز. أسعار RunAPI تعادل 50% من أسعار OpenAI الرسمية.

سيناريوهات التكلفة الشهرية

ما تكلفة الشهر النموذجي؟

مستنَد إلى codex-mini-latest بسعر $1.50/$6.00 (OpenAI) و$0.75/$3.00 (RunAPI) لكل مليون رمز.

دليل الإعداد

كيفية استخدام Codex CLI مع RunAPI

1

تثبيت Codex CLI

2

إنشاء حساب RunAPI

3

ضبط متغيرات البيئة

4

تشغيل Codex

5

التحقق من النموذج

الأسئلة الشائعة

أسئلة شائعة حول أسعار Codex

هل OpenAI Codex CLI مجاني الاستخدام؟

أداة CLI نفسها مجانية للتنزيل والتثبيت، ولا توجد رسوم اشتراك. ومع ذلك، تصل كل مطالبة يرسلها Codex إلى واجهة برمجة التطبيقات الخاصة بـ OpenAI (أو RunAPI)، التي تفرض رسومًا لكل رمز. الأداة مجانية؛ أما استدعاءات واجهة برمجة التطبيقات فليست كذلك. يدفع معظم المطورين ما بين $3 و$30 شهريًا بحسب مدى استخدامهم المكثف لها.

"Quota exceeded" — I'm already on a paid plan. Why?

Codex CLI works two ways: through a ChatGPT subscription (Plus at $20/month or Pro at $200/month) or through your own OpenAI API key with pay-per-token billing. The subscription path gives you a monthly quota — once exhausted, you see "quota exceeded" errors even on a paid plan. The API key path means you pay only for what you use, with no monthly floor. Heavy users often find the $200 Pro subscription impossible to exhaust; lighter users get better value from the pay-per-token API key path.

Which model effort level should I use to keep costs down?

Codex CLI includes three reasoning effort levels selectable with the /model command: medium, high, and extra high. Medium is the cheapest and recommended for daily use — it saves a lot of tokens and handles most tasks well. High and extra-high effort produce better results on complex tasks but burn more tokens quickly. ChatGPT Plus ($20) users should stick to medium; Pro ($200) subscribers can use high and extra-high without worrying about burning through quota.

How does RunAPI work with Codex CLI?

RunAPI is an OpenAI-compatible proxy. Codex reads the OPENAI_BASE_URL and OPENAI_API_KEY environment variables to find its API endpoint. Setting these to RunAPI values routes all Codex traffic through RunAPI instead of OpenAI. The request and response format is identical — Codex behaves the same, but you pay 50% less per token.

Do I need an OpenAI account to use Codex with RunAPI?

No. When you route Codex through RunAPI, your requests go to RunAPI's infrastructure, not OpenAI directly. You create a RunAPI account, generate an API key there, and set that key in your environment. No OpenAI account, no OpenAI API key, and no OpenAI billing are required.

Which models can I use with Codex CLI through RunAPI?

RunAPI supports codex-mini-latest as well as other LLMs including GPT-4o, Claude Sonnet, Gemini Pro, and more. You switch models with the --model flag or /model command in Codex. All RunAPI models are priced at 50% off the respective provider's list price.

Does redirecting Codex to RunAPI change how it behaves?

No. The only difference is which server processes the API request. Codex's file reading, code execution sandbox, approval modes, and MCP tool integrations all continue to work as normal. The request and response format RunAPI uses is identical to OpenAI's API, so Codex cannot tell the difference.

How do I stop burning so many tokens in a long Codex session?

Use the /compact command during long sessions — it summarizes the conversation to free up context and cuts the tokens you're burning on history. Also run /status to see your current token usage. For day-to-day work, stick to medium reasoning effort. For one-off tasks, use non-interactive mode (codex -q "your task") instead of an open session to avoid accumulating context.

ذات صلة

استكشف المزيد

اضبط متغيرَي بيئة اثنين وستعمل كل جلسة Codex عبر RunAPI بخصم 50% من أسعار OpenAI. بلا اشتراك، ولا حد أدنى للإنفاق — تدفع فقط مقابل الرموز المستخدَمة.