OpenRouter Rust SDK
openrouter-rs
is a third-party Rust SDK that helps you interact with the OpenRouter API. It wraps various endpoints of the OpenRouter API, making it easier to use in Rust projects. By taking advantage of Rust's strengths like type safety, memory safety, and concurrency without data races, openrouter-rs
ensures a solid and reliable integration with the OpenRouter API.
Current Status
This SDK is currently being used in my own project and has not been fully tested. If you encounter any issues while using it, please open an issue, and I will address it as soon as possible.
Features
- Create API keys
- Retrieve current API key information
- Delete exposed API keys
- Send chat completion requests
- Send text completion requests
- Create Coinbase charge requests
- Retrieve total credits
- Retrieve generation request metadata
- List all available models
- List endpoints for a specific model
Planned Features
- Streaming support for chat and text completion requests
Installation
To add openrouter-rs
to your project, include it in your Cargo.toml
file:
[]
= "0.1.0"
Usage Example
Here is a simple example demonstrating how to use the openrouter-rs
library:
use ;
async
Examples
I put together a bunch of example programs in the examples
directory to help you get started with openrouter-rs
. Each example is a standalone executable that shows off a specific feature of the SDK. You can run these examples to see how to use the SDK in different scenarios.
Running Examples
To run an example, use the following command:
Replace <example_name>
with the name of the example you want to run. For example, to run the create_api_key
example, use the following command:
Risk Disclaimer
Please note that openrouter-rs
is a third-party SDK and is not officially affiliated with or endorsed by OpenRouter. Use this SDK at your own risk. The maintainers of this SDK are not responsible for any issues or damages that may arise from using this SDK. Ensure that you understand the terms and conditions of the OpenRouter API and comply with them while using this SDK.
Contributing
Contributions are welcome! Please fork this repository and submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.