OpenAI SDK drop-in
Change one line in any project that uses the OpenAI SDK and it now routes through Soriku. Your local models become available, your existing prompts keep working.
The change
Set the base URL to http://localhost:8765/api/v1. That's it. The rest of the SDK behaves identically. Soriku accepts the same request schema and returns the same response shape.
Before and after
# before
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
# after
client = OpenAI(
base_url="http://localhost:8765/api/v1",
api_key="soriku-local"
)
Model names
Use model='auto' to let Soriku route. Or use the original model names: gpt-4o still works if you have an OpenAI key registered, claude-sonnet-4-6 works with Anthropic, qwen2.5-coder:7b for local Ollama. Soriku resolves the prefix automatically.
What works
- Chat completions, streaming and non-streaming
- Embeddings via
/api/v1/embeddings - Function/tool calling (Soriku passes through to the chosen model)
- Response format JSON mode where the underlying model supports it
What doesn't (yet)
- Image generation endpoints (use the provider directly)
- Assistants v2 API (use Soriku's agent personas instead)
- OpenAI-specific moderation endpoint