OpenAI Compatible API Setup Tutorial
Overview
Sokuji supports any OpenAI Realtime API-compatible endpoint, allowing you to use third-party or self-hosted services for real-time speech translation. This gives you flexibility to choose alternative providers or run your own inference server.
Important: Realtime API Compatibility Required
The provider must support OpenAI's Realtime API WebSocket protocol, not just the standard Chat Completions API. Only endpoints that implement the Realtime API will work with Sokuji.
1Choose a Compatible Provider
Select a service that supports the OpenAI Realtime API WebSocket protocol. Important: Very few providers currently support the Realtime API — most OpenAI-compatible services only support the Chat Completions API, which is not sufficient. Always verify that your provider explicitly supports the Realtime API before proceeding.
2Get Your API Endpoint and Key
Obtain the API endpoint URL and API key from your chosen provider. The endpoint URL is typically in the format https://your-provider.com or http://localhost:8080 for self-hosted services.
3Select OpenAI Compatible API in Sokuji
Open Sokuji and navigate to the Settings panel. Select "OpenAI Compatible API" as your AI provider from the provider dropdown.
4Enter Your Configuration
Paste your custom API endpoint URL into the "API Endpoint" field. Enter your API key in the "API Key" field. If your provider doesn't require an API key (e.g., local services), you may leave it empty or enter a placeholder value.
5Select Model and Voice
Choose the model and voice settings that your provider supports. The available options depend on your specific provider. Common models include gpt-4o-realtime-preview or provider-specific model names.
6Test the Connection
Start a translation session to verify everything is working. Click the Start Session button, speak into your microphone, and check that the connection establishes successfully and audio is being translated.
Additional Information
What is OpenAI Compatible API?
OpenAI Compatible API is a generic provider option that allows Sokuji to connect to any service implementing the OpenAI Realtime API protocol:
- Use any OpenAI-compatible endpoint with a custom base URL
- Supports both cloud-hosted and self-hosted services
- Flexibility to switch between different backend providers
- Useful for private deployments, cost optimization, or regional compliance
About Provider Compatibility
Most OpenAI-compatible services only support the Chat Completions API. The Realtime API (WebSocket-based, with audio streaming) is a different protocol and very few providers support it:
- Azure OpenAI Service: Supports the Realtime API with OpenAI models hosted on Microsoft Azure
- Always check your provider's documentation for explicit Realtime API support
- Services like OpenRouter, Together AI, etc. typically do NOT support the Realtime API
- Some proxy services (e.g., CometAPI) may offer Realtime API compatibility — verify before use
- Self-hosted solutions must implement the full Realtime API WebSocket protocol
Configuration Tips
- Endpoint URL should not include a trailing slash (e.g., use https://api.example.com not https://api.example.com/)
- For local services, use http://localhost:<port> as the endpoint
- Some providers may require specific headers or authentication methods
- If using a proxy service, ensure it forwards WebSocket connections correctly
Troubleshooting
Common Issues
Connection Refused: Verify the endpoint URL is correct and the service is running. For local services, check that the server is started and listening on the expected port.
Authentication Error: Double-check your API key. Some providers require specific key formats. Ensure your account has access to the Realtime API.
Model Not Found: The model name may differ from OpenAI's default models. Check your provider's documentation for available model names.
WebSocket Connection Failed: Ensure your provider supports WebSocket connections for the Realtime API. Standard HTTP-only endpoints (Chat Completions) will not work.
Checking Provider Compatibility
- Verify your provider explicitly supports the OpenAI Realtime API protocol
- Check that WebSocket connections are supported (not just REST API)
- Confirm the provider supports audio input/output streaming
- Test the endpoint URL directly with a WebSocket client if possible
- Review the provider's documentation for any specific configuration requirements
Need More Help? Refer to the OpenAI Realtime API documentation for protocol details, or visit our GitHub repository for community support.