
GPT-2 text generation
Pricing
Pay per usage

GPT-2 text generation
This actor uses the GPT-2 language model to generate text.
0.0 (0)
Pricing
Pay per usage
3
Monthly users
18
Runs succeeded
>99%
Last modified
2 years ago
You can access the GPT-2 text generation programmatically from your own applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, you’ll need an Apify account and your API token, found in Integrations settings in Apify Console.
1{
2 "openapi": "3.0.1",
3 "info": {
4 "version": "0.0",
5 "x-build-id": "rYbQ1AZ9WCxxYFO5C"
6 },
7 "servers": [
8 {
9 "url": "https://api.apify.com/v2"
10 }
11 ],
12 "paths": {
13 "/acts/jirimoravcik~gpt2-text-generation/run-sync-get-dataset-items": {
14 "post": {
15 "operationId": "run-sync-get-dataset-items-jirimoravcik-gpt2-text-generation",
16 "x-openai-isConsequential": false,
17 "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
18 "tags": [
19 "Run Actor"
20 ],
21 "requestBody": {
22 "required": true,
23 "content": {
24 "application/json": {
25 "schema": {
26 "$ref": "#/components/schemas/inputSchema"
27 }
28 }
29 }
30 },
31 "parameters": [
32 {
33 "name": "token",
34 "in": "query",
35 "required": true,
36 "schema": {
37 "type": "string"
38 },
39 "description": "Enter your Apify token here"
40 }
41 ],
42 "responses": {
43 "200": {
44 "description": "OK"
45 }
46 }
47 }
48 },
49 "/acts/jirimoravcik~gpt2-text-generation/runs": {
50 "post": {
51 "operationId": "runs-sync-jirimoravcik-gpt2-text-generation",
52 "x-openai-isConsequential": false,
53 "summary": "Executes an Actor and returns information about the initiated run in response.",
54 "tags": [
55 "Run Actor"
56 ],
57 "requestBody": {
58 "required": true,
59 "content": {
60 "application/json": {
61 "schema": {
62 "$ref": "#/components/schemas/inputSchema"
63 }
64 }
65 }
66 },
67 "parameters": [
68 {
69 "name": "token",
70 "in": "query",
71 "required": true,
72 "schema": {
73 "type": "string"
74 },
75 "description": "Enter your Apify token here"
76 }
77 ],
78 "responses": {
79 "200": {
80 "description": "OK",
81 "content": {
82 "application/json": {
83 "schema": {
84 "$ref": "#/components/schemas/runsResponseSchema"
85 }
86 }
87 }
88 }
89 }
90 }
91 },
92 "/acts/jirimoravcik~gpt2-text-generation/run-sync": {
93 "post": {
94 "operationId": "run-sync-jirimoravcik-gpt2-text-generation",
95 "x-openai-isConsequential": false,
96 "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
97 "tags": [
98 "Run Actor"
99 ],
100 "requestBody": {
101 "required": true,
102 "content": {
103 "application/json": {
104 "schema": {
105 "$ref": "#/components/schemas/inputSchema"
106 }
107 }
108 }
109 },
110 "parameters": [
111 {
112 "name": "token",
113 "in": "query",
114 "required": true,
115 "schema": {
116 "type": "string"
117 },
118 "description": "Enter your Apify token here"
119 }
120 ],
121 "responses": {
122 "200": {
123 "description": "OK"
124 }
125 }
126 }
127 }
128 },
129 "components": {
130 "schemas": {
131 "inputSchema": {
132 "type": "object",
133 "required": [
134 "prompt",
135 "max_length"
136 ],
137 "properties": {
138 "prompt": {
139 "title": "Initial prompt",
140 "type": "string",
141 "description": "The initial prompt used as basis for text generation",
142 "default": "My name is Apify and I like to"
143 },
144 "max_length": {
145 "title": "Maximum sequence length",
146 "type": "integer",
147 "description": "The maximum length of the generated sequence",
148 "default": 30
149 }
150 }
151 },
152 "runsResponseSchema": {
153 "type": "object",
154 "properties": {
155 "data": {
156 "type": "object",
157 "properties": {
158 "id": {
159 "type": "string"
160 },
161 "actId": {
162 "type": "string"
163 },
164 "userId": {
165 "type": "string"
166 },
167 "startedAt": {
168 "type": "string",
169 "format": "date-time",
170 "example": "2025-01-08T00:00:00.000Z"
171 },
172 "finishedAt": {
173 "type": "string",
174 "format": "date-time",
175 "example": "2025-01-08T00:00:00.000Z"
176 },
177 "status": {
178 "type": "string",
179 "example": "READY"
180 },
181 "meta": {
182 "type": "object",
183 "properties": {
184 "origin": {
185 "type": "string",
186 "example": "API"
187 },
188 "userAgent": {
189 "type": "string"
190 }
191 }
192 },
193 "stats": {
194 "type": "object",
195 "properties": {
196 "inputBodyLen": {
197 "type": "integer",
198 "example": 2000
199 },
200 "rebootCount": {
201 "type": "integer",
202 "example": 0
203 },
204 "restartCount": {
205 "type": "integer",
206 "example": 0
207 },
208 "resurrectCount": {
209 "type": "integer",
210 "example": 0
211 },
212 "computeUnits": {
213 "type": "integer",
214 "example": 0
215 }
216 }
217 },
218 "options": {
219 "type": "object",
220 "properties": {
221 "build": {
222 "type": "string",
223 "example": "latest"
224 },
225 "timeoutSecs": {
226 "type": "integer",
227 "example": 300
228 },
229 "memoryMbytes": {
230 "type": "integer",
231 "example": 1024
232 },
233 "diskMbytes": {
234 "type": "integer",
235 "example": 2048
236 }
237 }
238 },
239 "buildId": {
240 "type": "string"
241 },
242 "defaultKeyValueStoreId": {
243 "type": "string"
244 },
245 "defaultDatasetId": {
246 "type": "string"
247 },
248 "defaultRequestQueueId": {
249 "type": "string"
250 },
251 "buildNumber": {
252 "type": "string",
253 "example": "1.0.0"
254 },
255 "containerUrl": {
256 "type": "string"
257 },
258 "usage": {
259 "type": "object",
260 "properties": {
261 "ACTOR_COMPUTE_UNITS": {
262 "type": "integer",
263 "example": 0
264 },
265 "DATASET_READS": {
266 "type": "integer",
267 "example": 0
268 },
269 "DATASET_WRITES": {
270 "type": "integer",
271 "example": 0
272 },
273 "KEY_VALUE_STORE_READS": {
274 "type": "integer",
275 "example": 0
276 },
277 "KEY_VALUE_STORE_WRITES": {
278 "type": "integer",
279 "example": 1
280 },
281 "KEY_VALUE_STORE_LISTS": {
282 "type": "integer",
283 "example": 0
284 },
285 "REQUEST_QUEUE_READS": {
286 "type": "integer",
287 "example": 0
288 },
289 "REQUEST_QUEUE_WRITES": {
290 "type": "integer",
291 "example": 0
292 },
293 "DATA_TRANSFER_INTERNAL_GBYTES": {
294 "type": "integer",
295 "example": 0
296 },
297 "DATA_TRANSFER_EXTERNAL_GBYTES": {
298 "type": "integer",
299 "example": 0
300 },
301 "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
302 "type": "integer",
303 "example": 0
304 },
305 "PROXY_SERPS": {
306 "type": "integer",
307 "example": 0
308 }
309 }
310 },
311 "usageTotalUsd": {
312 "type": "number",
313 "example": 0.00005
314 },
315 "usageUsd": {
316 "type": "object",
317 "properties": {
318 "ACTOR_COMPUTE_UNITS": {
319 "type": "integer",
320 "example": 0
321 },
322 "DATASET_READS": {
323 "type": "integer",
324 "example": 0
325 },
326 "DATASET_WRITES": {
327 "type": "integer",
328 "example": 0
329 },
330 "KEY_VALUE_STORE_READS": {
331 "type": "integer",
332 "example": 0
333 },
334 "KEY_VALUE_STORE_WRITES": {
335 "type": "number",
336 "example": 0.00005
337 },
338 "KEY_VALUE_STORE_LISTS": {
339 "type": "integer",
340 "example": 0
341 },
342 "REQUEST_QUEUE_READS": {
343 "type": "integer",
344 "example": 0
345 },
346 "REQUEST_QUEUE_WRITES": {
347 "type": "integer",
348 "example": 0
349 },
350 "DATA_TRANSFER_INTERNAL_GBYTES": {
351 "type": "integer",
352 "example": 0
353 },
354 "DATA_TRANSFER_EXTERNAL_GBYTES": {
355 "type": "integer",
356 "example": 0
357 },
358 "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
359 "type": "integer",
360 "example": 0
361 },
362 "PROXY_SERPS": {
363 "type": "integer",
364 "example": 0
365 }
366 }
367 }
368 }
369 }
370 }
371 }
372 }
373 }
374}
GPT-2 text generation OpenAPI definition
OpenAPI is a standard for designing and describing RESTful APIs, allowing developers to define API structure, endpoints, and data formats in a machine-readable way. It simplifies API development, integration, and documentation.
OpenAPI is effective when used with AI agents and GPTs by standardizing how these systems interact with various APIs, for reliable integrations and efficient communication.
By defining machine-readable API specifications, OpenAPI allows AI models like GPTs to understand and use varied data sources, improving accuracy. This accelerates development, reduces errors, and provides context-aware responses, making OpenAPI a core component for AI applications.
You can download the OpenAPI definitions for GPT-2 text generation from the options below:
If you’d like to learn more about how OpenAPI powers GPTs, read our blog post.
You can also check out our other API clients:
Pricing
Pricing model
Pay per usageThis Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage.