Skip to main content
This quickstart takes you from an API key to your first request to the Reflection API.

Set up the Reflection API in this project

Open in Cursor
1

Create an API key

Sign in to the Reflection platform, open API Keys, and create a key for your project. The full key is shown once, right after you create it, so copy it now.Store it in an environment variable:
See Authentication for details.
2

Install an SDK (optional)

These examples use the OpenAI-compatible endpoint, https://api.reflection.ai/openai/v1, so they work with the official OpenAI SDKs. You can also call the API with any HTTP client. See OpenAI compatibility for what is supported.
3

Make a request

Save the Python example as quickstart.py and run python quickstart.py. The TypeScript example uses top-level await, so save it as quickstart.mts and run npx tsx quickstart.mts, or use it in any ES module project.The response is a chat completion. The answer is in choices[0].message.content:
Response
If your code prints the model’s answer, your API key and client are set up correctly.
To try prompts and parameters without writing code, use the Playground in the Reflection platform. It can also generate code for the request you build.

Next steps

Models

List the models available to you.

Text generation

Messages, roles, and generation parameters.

Streaming

Show output as it is generated.

Errors

Handle failures and retries.
Last modified on October 16, 2026