openai · OpenAI Platform Docs
Text generation | OpenAI API
Explains how to use the OpenAI API to generate text, covering prompt construction, model parameters, and best practices for obtaining desired outputs.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Text generation | OpenAI API
Explains how to use the OpenAI API to generate text, covering prompt construction, model parameters, and best practices for obtaining desired outputs.
When To Use
Use when you need to implement text completion or chat-based generation workflows and want to optimize model responses through parameter tuning and prompt engineering.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/text-generation-openai-api-workflow-guide.md | A guide covering prompt engineering, model selection, message roles, and instruction following for text generation using the OpenAI API. | Questions about a guide covering prompt engineering, model selection, message roles, and instruction following for text generation us... |
examples/text-generation-openai-api-openai-api-text-generation-nodejs.text | A Node.js code example demonstrating how to use the OpenAI client to generate text using a model response. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to generate text using a model response. |
examples/text-generation-openai-api-openai-api-text-generation-python.text | A Python code example demonstrating how to use the OpenAI client to generate text using a model request. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the OpenAI client to generate text using a model request. |
examples/text-generation-openai-api-openai-api-text-generation-cli.text | A CLI command example demonstrating how to request text generation from the OpenAI API using a model and input prompt. | Exact payloads, commands, or snippets shown in A CLI command example demonstrating how to request text generation from the OpenAI API using a model and input prompt. |
examples/text-generation-openai-api-openai-api-text-generation-csharp.text | A C# code example demonstrating how to use the OpenAIClient to create a text generation response. | Exact payloads, commands, or snippets shown in A C# code example demonstrating how to use the OpenAIClient to create a text generation response. |
examples/text-generation-openai-api-openai-api-text-generation-java.text | A Java code example demonstrating how to use the OpenAI client to create a text generation response using a specified model and input string. | Exact payloads, commands, or snippets shown in A Java code example demonstrating how to use the OpenAI client to create a text generation response using a specified... |
examples/text-generation-openai-api-openai-api-text-generation-go.text | A Go implementation demonstrating how to use the OpenAI Go SDK to perform text generation requests. | Exact payloads, commands, or snippets shown in A Go implementation demonstrating how to use the OpenAI Go SDK to perform text generation requests. |
examples/text-generation-openai-api-openai-api-ruby-text-generation.text | A Ruby script demonstrating how to use the OpenAI client to generate text using a model request. | Exact payloads, commands, or snippets shown in A Ruby script demonstrating how to use the OpenAI client to generate text using a model request. |
examples/text-generation-openai-api-openai-api-text-generation-curl-request.text | A curl command demonstrating a text generation request to the OpenAI API using a JSON payload. | Exact payloads, commands, or snippets shown in A curl command demonstrating a text generation request to the OpenAI API using a JSON payload. |
examples/text-generation-openai-api-openai-api-text-generation-response.text | A sample JSON response object from the OpenAI API showing a message object with assistant role and text content. | Exact payloads, commands, or snippets shown in A sample JSON response object from the OpenAI API showing a message object with assistant role and text content. |
examples/text-generation-openai-api-openai-api-text-generation-nodejs-client.text | A Node.js code example demonstrating how to use the OpenAI client to generate text with specific reasoning effort and instructions. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to generate text with specific reasoning effort and... |
examples/text-generation-openai-api-openai-api-python-text-generation-reasoning.text | A Python code example demonstrating how to use the OpenAI client to generate text with specific reasoning effort settings. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the OpenAI client to generate text with specific reasoning effort sett... |
examples/text-generation-openai-api-openai-api-text-generation-curl-request-2.text | A curl command demonstrating a text generation request to the OpenAI API using a model with reasoning effort. | Exact payloads, commands, or snippets shown in A curl command demonstrating a text generation request to the OpenAI API using a model with reasoning effort. |
examples/text-generation-openai-api-openai-api-text-generation-nodejs-client-2.text | A Node.js code example demonstrating how to use the OpenAI client to generate text using a model with reasoning capabilities. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to generate text using a model with reasoning capab... |
examples/text-generation-openai-api-openai-api-text-generation-python-client.text | A Python script demonstrating how to use the OpenAI client to generate text with specific reasoning effort settings. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to use the OpenAI client to generate text with specific reasoning effort settings. |
examples/text-generation-openai-api-openai-api-text-generation-curl-request-3.text | A curl command demonstrating a text generation request to the OpenAI API using a JSON payload with model and reasoning parameters. | Exact payloads, commands, or snippets shown in A curl command demonstrating a text generation request to the OpenAI API using a JSON payload with model and reasonin... |
examples/text-generation-openai-api-openai-api-text-generation-nodejs-client-3.text | A Node.js code example demonstrating how to use the OpenAI client to create a text generation response using a specific model and prompt variables. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the OpenAI client to create a text generation response using a specif... |
examples/text-generation-openai-api-openai-api-text-generation-python-client-2.text | A Python code example demonstrating how to use the OpenAI client to generate text using a model and prompt variables. | Exact payloads, commands, or snippets shown in A Python code example demonstrating how to use the OpenAI client to generate text using a model and prompt variables. |
examples/text-generation-openai-api-openai-api-text-generation-curl-request-4.text | A curl command demonstrating a text generation request to the OpenAI API using a model and prompt variables. | Exact payloads, commands, or snippets shown in A curl command demonstrating a text generation request to the OpenAI API using a model and prompt variables. |
examples/text-generation-openai-api-openai-api-nodejs-text-generation-upload.text | A Node.js code example demonstrating how to upload a PDF file and use it as a reference within a text generation request using the OpenAI client. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload a PDF file and use it as a reference within a text generation requ... |
examples/text-generation-openai-api-openai-api-text-generation-pdf-reference-pyth.text | A Python script demonstrating how to upload a PDF file and use it as a reference variable within a text generation request using the OpenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a PDF file and use it as a reference variable within a text generation re... |
examples/text-generation-openai-api-openai-api-text-generation-curl-request-5.text | A curl command demonstrating a text generation request to the OpenAI API using a model and a file ID reference. | Exact payloads, commands, or snippets shown in A curl command demonstrating a text generation request to the OpenAI API using a model and a file ID reference. |
What This Skill Covers
- With the OpenAI API, you can use a large language model to generate text from a prompt, as you might using ChatGPT. Models can generate almost any kind of te...
- Main sections:
Prompt engineering,Choosing models and APIs,Message roles and instruction following,Reusable prompts,Next steps.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.openai.com/api/docs/guides/text
