Learn about Shuttle’s OpenAI resource annotation.
shuttle-openai
to the dependencies for your service by running cargo add shuttle-openai
.
This resource will be provided by adding the shuttle_openai::OpenAI
attribute to your Shuttle main
decorated function.
It returns an async_openai::Client<OpenAIConfig>
for you to interact with OpenAI’s services.
Parameter | Type | Description |
---|---|---|
api_key | str | The API key for OpenAI authentication |
api_base | Option<str> | To use a API base url different from default OPENAI_API_BASE |
org_id | Option<str> | To use a different organization id other than default |
project_id | Option<str> | Non default project id |
Secrets.toml
file.
Secrets.toml
file: