Text Generation
AI Model Hub for Free: From December 1, 2024, to June 30, 2025, IONOS is offering all foundation models in the AI Model Hub for free. Create your contract today and kickstart your AI journey!
The IONOS 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 tutorial, you will learn how to generate text using foundation models through the IONOS API. This tutorial 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 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 easily access text generation-specific scripts and examples and generate the intended output:
Download this Python Notebook file to easily access text generation-specific scripts and examples and generate the intended output.
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.
Summary
In this tutorial, 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 our dedicated tutorial on text-to-image models.
Last updated
Was this helpful?