Skip to main content
POST
/
models
/
v2
/
openai-community
/
gpt2
text-generation
curl --request POST \
  --url https://api.bytez.com/models/v2/openai-community/gpt2 \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "text": "Once upon a time there was a beautiful home where",
  "stream": true,
  "params": {
    "min_length": 10,
    "max_length": 100,
    "temperature": 0.7
  }
}
'
{
  "error": "<string>",
  "output": "Once upon a time there was a beautiful home where a woman, who, after a long journey, had been able to return to her family..."
}

Authorizations

Authorization
string
header
required

Set Authorization header to BYTEZ_KEY 'Authorization: YOUR_BYTEZ_KEY_HERE'

Body

application/json

Schema for text-generation models

text
string
required

The input text prompt to generate text from.

Example:

"Once upon a time there was a beautiful home where"

stream
boolean

Enable text streaming.

params
object

Model-specific parameters.

Response

Successful text-generation response.

error
string | null
required

Null on success; otherwise an error message.

output
string
required

The generated text completion.

Example:

"Once upon a time there was a beautiful home where a woman, who, after a long journey, had been able to return to her family..."