ORA API
Developer Portal: https://rms.ora.io/
Intro to ORA API
ORA API is an integral part of ORA's Resilient Model Services (RMS). See supported models and pricing of ORA API.
The ORA API serves as the gateway for developers to interact with RMS, providing a decentralized, verifiable, and resilient platform for AI computations.
Advantages of ORA API are the best support for the most AI models in crypto; competitive pricing and predictable onchain cost; verifiable AI inference service; OpenAI compatibility...
Integrate with ORA API
Getting Started
Before using the ORA API, developers need to:
Obtain API Key: Register for an ORA API key through developer portal for authenticating requests.
API Key format as: {NETWORK}:{KEY}
(eg. BASE:5FABC....
)
Set Up Environment: Ensure you have Python installed if you're using the SDK, or a tool like cURL for direct API calls.
More about ORA API Key Design
Smart Contract Management
All API keys are managed directly on the smart contract. This includes both the generation and deletion processes of API keys.
API Key Structure
We do not store your API keys. Instead, the API key is generated through signing a message from the smart contract. The API key has the following structure, which enables you to recover it within your local environment:
{blockchain identifier}:{base58encoding(message:signature(message, privateKey))}
Here, the message is a
bytes32
data type within the smart contract.
Key Generation and Deletion Mechanisms
Generating a new API key is analogous to creating a new address from a wallet mnemonic. By monotonically increasing the value of the message, you can obtain a new API key. As for API key deletion, it is achieved by disabling the key within the smart contract.
Use ORA API
Chat Completion
POST
https://api.ora.io/v1/chat/completions
Generate text responses from ORA API AI models.
Headers
Content-Type
application/json
Authorization
Bearer <ORA_API_KEY>
Body
model
string
Name of AI model
messages
array
Content for AI model to process
search_enabled
(optional)
bool
Bool for enabling search function that accesses web data
Example Call in shell
Example Output
Search Feature
For all chat completion models, you can use native search mode provided by ORA API.
In addition to the data without search, you get:
inference result based on real-time searched content from web
search_result
that provides source that can be used as citation in inference result
For customized search enabled feature, you can choose to use other search providers (example) without ORA API's native search, with recommended search prompt (example).
Image Generation
POST
https://api.ora.io/v1/images/generations
Generate images based on text prompts.
Headers
Content-Type
application/json
Authorization
Bearer <ORA_API_KEY>
Body
model
string
Name of AI model
prompt
string
Prompt for AI model to process
steps
integer
Number of diffusion steps AI model will take during generation
n
integer
number of images to generate based on prompt
Example Call in shell
Example Output
Text to Video Generation
POST
https://api.ora.io/v1/videos/generations
Generate videos based on text prompts.
GET
https://api.ora.io/v1/videos/result/$generation_id
Get generated videos based on output id.
Headers
Content-Type
application/json
Authorization
Bearer <ORA_API_KEY>
Body
model
string
Name of AI model
prompt
string
Prompt for AI model to process
seed
integer
Number for randomness in generation
Example in shell
Example Output
SDK Integration
ORA API is designed to be compatible with the OpenAI SDK, facilitating a smooth transition for developers already familiar with it:
Best Practices
Error Handling: Always implement error handling to manage API response errors or timeouts.
Rate Limiting: Be aware of and respect rate limits to avoid service disruptions.
Security: Never expose your API key in client-side code. Use server-side calls or secure environment variables.
Last updated
Was this helpful?