Set up the Reflection API in this project
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
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.
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.