The Clavue platform provides a robust API layer that allows developers to integrate AI capabilities directly into their applications or workflows. This quickstart guides you through the essential steps of accessing the Membership API, focusing on authentication and basic chat interactions.
By following this guide, you will generate your unique API key, understand the OpenAI-compatible endpoint structure, and execute your first chat completion request. This approach ensures that you can leverage Clavue's powerful model ecosystem with minimal friction.
Prerequisites
- A valid Clavue account with active membership
- Basic familiarity with curl or HTTP requests
- An API key generated from the Clavue dashboard
Steps
- 01
Generate Your API Key
First, log in to the Clavue platform dashboard. Navigate to the Account or Settings section, then locate the API Keys management area. Click "Create New Key" and assign a descriptive name to it. Copy the generated key immediately, as it will only be shown once. This key acts as your credential for all API requests.
- 02
Verify Available Models
Before sending chat requests, it is helpful to see which models are available. You can list them by calling the models endpoint. Use the following curl command to fetch the list of supported models:
- 03
Execute a Chat Completion
With your key and a model ID, you can now send a request. The Clavue API is compatible with the OpenAI
/v1/chat/completionsendpoint. Use the following example to send a simple message: - 04
Handle Responses and Errors
The API returns a JSON object containing the model's response. If you encounter an error, check the HTTP status code. Common issues include
401 Unauthorized(invalid key) or429 Too Many Requests(rate limit exceeded). Review the official documentation for detailed error codes and rate limit policies.
Rate Limits and Performance
Clavue implements rate limits to ensure fair usage across the platform. These limits vary based on your membership tier. If you exceed the limit, you will receive a 429 error. For high-volume applications, consider implementing exponential backoff in your retry logic.
Security Best Practices
Never expose your API key in public repositories or client-side code. Use environment variables to store your key securely. Rotate your keys periodically if you suspect they have been compromised.
Tips
- Use the `curl -v` flag to see detailed request headers when debugging authentication issues.
- Check the official Clavue documentation for the latest model availability and pricing tiers.
- Always validate the JSON response structure in your application code before processing data.
FAQ
How do I reset my API key?
You can generate a new key from the API Keys management section in your account settings. Old keys remain active until you delete them.
Is the API compatible with other OpenAI libraries?
Yes, the endpoint structure is OpenAI-compatible. You can often use standard OpenAI SDKs by changing the base URL to the Clavue API endpoint.
What happens if I hit the rate limit?
You will receive a 429 Too Many Requests error. You should wait for the specified retry-after period before sending another request.
Can I use the API with imux?
Yes, imux can be configured to use Clavue's API endpoints for enhanced agent capabilities and remote model access.