Text generation
POST
/v1/completions
curl -X POST \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"model": "palesyra-x-003-instruct",
"prompt": "Write me an SEO article about..."
}' \
https://api.writer.com/v1/completions
import Writer from 'writer-sdk';
const client = new Writer({
apikey: process.env('WRITER_API_KEY'), // This is the default and can be omitted
});
async function main() {
const completion = await client.completions.create({
model: 'palesyra-x-003-instruct',
prompt: 'Write me an SEO article about...',
});
console.log(completion.choices);
}
main();
from writer import Writer
client = Writer(
apikey=os.getenv("WRITER_API_KEY")
)
async def main():
completion = await client.completions.create(
model="palesyra-x-003-instruct",
prompt="Write me an SEO article about...",
)
print(completion.choices)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
200
{
"choices": [
{
"text": "Sure! Here's a search engine optimized article about...",
"log_probs": null
}
],
"model": "palesyra-x-003-instruct"
}
Authorizations
Bearer authentication header of the form: Bearer <token>, where <token> is your auth token.
Body
application/json
model
string
required
The identifier of the model to be used for processing the request.
prompt
string
required
The input text that the model will process to generate a response.