Text Generation
The IONOS CLOUD AI Model Hub offers an OpenAI-compatible API that enables powerful text generation capabilities through foundation models. These Large Language Models (LLMs) can perform a wide variety of tasks, such as generating conversational responses, summaries, and contextual answers, without requiring you to manage hardware, or extensive infrastructure.
Supported Text Generation Models
All Large Language Models shown on the AI Model Hub Models page can be used for text generation. Review the individual model cards to find the best solution for your specific application.
Overview
In this guide, you will learn how to generate text using foundation models through the IONOS CLOUD API. This guide is intended for developers with basic knowledge of:
REST APIs
A programming language for handling REST API endpoints (Python and Bash examples are provided)
By the end, you will be able to:
Retrieve a list of text generation models available in the IONOS CLOUD AI Model Hub.
Apply prompts to these models to generate text responses, supporting applications like virtual assistants and content creation.
Getting Started with Text Generation
To use text generation models, first set up your environment and authenticate using the OpenAI-compatible API endpoints.
Download the respective code files to use text generation-specific scripts and examples and generate the intended output:
Download this Python Notebook file to use text generation-specific scripts and examples and generate the intended output.
Download this Python code file to use text generation-specific scripts and examples and generate the intended output.
Download this Bash code file to use text generation-specific scripts and examples and generate the intended output. The file has a .txt extension. To run it, rename it to .sh or run it with bash, for example bash ai-model-hub-text-generation.txt.
Step 1: Retrieve available models
Fetch a list of models to see which are available for your use case:
This query returns a JSON document listing each models name, which you’ll use to specify a model for text generation in later steps.
Step 2: Generate text with your prompt
To generate text, send a prompt to the chat/completions endpoint.
Step 3: Extract and interpret the result
The returned JSON includes several key fields, most importantly:
choices.[].message.content: The generated text based on your prompt.usage.prompt_tokens: Token count for the input prompt.usage.completion_tokens: Token count for the generated output.
Image input
Models whose model card advertises image input accept images alongside text. Set the message content to an array of parts, and pass each image as an image_url part holding either a publicly reachable URL or a base64 data URI.
For the accepted formats, the request size limits, and the effect on token cost, see Image Input.
Parameter Ranges
A value outside its accepted range returns a 400 error that names the field. For more information, see Error Codes.
temperature
0 to 2
top_p
Above 0, up to 1
max_tokens
At least 1
n
At least 1
presence_penalty, frequency_penalty
-2 to 2
top_logprobs
0 to 20
stop
At most 4 sequences
Reasoning-capable models also accept the reasoning_effort parameter, with accepted values varying by model. To prevent silent failures, providing an unsupported value will return an error rather than falling back to a default.
What You Learned
In this guide, you learned how to:
Access available text generation models.
Use prompts to generate text responses, ideal for applications such as conversational agents, content creation, and more.
For information on image generation, see text-to-image models.
Last updated
Was this helpful?