Last active
May 9, 2026 04:14
-
-
Save up1/f1ce8169b306da8adf20639ebe807c6d to your computer and use it in GitHub Desktop.
OpenAI CLI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $brew install openai/tools/openai | |
| $openai -v | |
| openai version 1.1.2 | |
| //MAC or Linux | |
| $export OPENAI_API_KEY=<your key> | |
| // Windows | |
| $set OPENAI_API_KEY=<your key> | |
| // Chat | |
| $openai responses create --input "สีเหลือง" --model gpt-5.5 | |
| // Output ในรูปแบบ JSON format | |
| { | |
| "id": "resp_0021713dbfcbf0870069feb175af4481909edf52958e43ea2e", | |
| "object": "response", | |
| "created_at": 1778299253, | |
| "status": "completed", | |
| "background": false, | |
| "billing": { | |
| "payer": "developer" | |
| }, | |
| "completed_at": 1778299257, | |
| "error": null, | |
| "frequency_penalty": 0.0, | |
| "incomplete_details": null, | |
| "instructions": null, | |
| "max_output_tokens": null, | |
| "max_tool_calls": null, | |
| "model": "gpt-5.5-2026-04-23", | |
| "moderation": null, | |
| "output": [ | |
| { | |
| "id": "rs_0021713dbfcbf0870069feb1769ad48190a8ef370adae9ff4e", | |
| "type": "reasoning", | |
| "summary": [] | |
| }, | |
| { | |
| "id": "msg_0021713dbfcbf0870069feb178c4e88190b472b95294c2fd2b", | |
| "type": "message", | |
| "status": "completed", | |
| "content": [ | |
| { | |
| "type": "output_text", | |
| "annotations": [], | |
| "logprobs": [], | |
| "text": "\u0e2a\u0e35\u0e40\u0e2b\u0e25\u0e37\u0e2d\u0e07 = **Yellow** \n\u0e23\u0e2b\u0e31\u0e2a\u0e2a\u0e35\u0e1e\u0e37\u0e49\u0e19\u0e10\u0e32\u0e19: **#FFFF00**" | |
| } | |
| ], | |
| "phase": "final_answer", | |
| "role": "assistant" | |
| } | |
| ], | |
| "parallel_tool_calls": true, | |
| "presence_penalty": 0.0, | |
| "previous_response_id": null, | |
| "prompt_cache_key": null, | |
| "prompt_cache_retention": "24h", | |
| "reasoning": { | |
| "effort": "medium", | |
| "summary": null | |
| }, | |
| "safety_identifier": null, | |
| "service_tier": "default", | |
| "store": true, | |
| "temperature": 1.0, | |
| "text": { | |
| "format": { | |
| "type": "text" | |
| }, | |
| "verbosity": "medium" | |
| }, | |
| "tool_choice": "auto", | |
| "tools": [], | |
| "top_logprobs": 0, | |
| "top_p": 0.98, | |
| "truncation": "disabled", | |
| "usage": { | |
| "input_tokens": 9, | |
| "input_tokens_details": { | |
| "cached_tokens": 0 | |
| }, | |
| "output_tokens": 121, | |
| "output_tokens_details": { | |
| "reasoning_tokens": 96 | |
| }, | |
| "total_tokens": 130 | |
| }, | |
| "user": null, | |
| "metadata": {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $cat service_error.log | openai chat \ | |
| --system "Analyze service risks in logs file" \ | |
| > analysis_result.txt | |
| $find logs/ -name "*.log" \ | |
| | xargs cat \ | |
| | openai chat --system "Summarize critical error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment