docs / guides / openai-sdk-drop-in

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

What doesn't (yet)