Repository navigation
feat(providers): add SOKKAN as a JSON-configured OpenAI-compatible provider - #44091
nicolas-micaud wants to merge 1 commit into
Conversation
|
| def test_sokkan_models_registered(): | ||
| assert SOKKAN_MODELS, "no sokkan/ model in the cost map" |
There was a problem hiding this comment.
Missing models escape coverage
The test cases come from the loaded price map, but this assertion only requires one SOKKAN model. If either of the two advertised models is omitted or renamed, its cost and capability checks silently disappear. Assert both expected model IDs explicitly.
Knowledge Base Used: Provider adapters and capabilities
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Addressed in fbd2e7d: the test now asserts the exact set of SOKKAN model IDs (test_sokkan_cost_map_lists_exactly_the_expected_models), so a missing or renamed model fails.
| assert prompt_cost == pytest.approx(model_info["input_cost_per_token"] * 1_000_000) | ||
| assert completion_cost == pytest.approx(model_info["output_cost_per_token"] * 1_000_000) |
There was a problem hiding this comment.
cost_per_token and the expected values both read the loaded price map. An incorrect SOKKAN rate would pass these assertions while producing incorrect billing. Check each model against an independently stated expected rate.
Knowledge Base Used: Provider adapters and capabilities
There was a problem hiding this comment.
Addressed in fbd2e7d: expected rates are stated independently in EXPECTED_SOKKAN_MODELS (taken from https://api.sokkan.ch/v1/models), not read back from the cost map.
| model, provider, api_key, api_base = get_llm_provider( | ||
| model="sokkan/qwen/qwen3-coder-30b-a3b-instruct", | ||
| custom_llm_provider=None, | ||
| api_base=None, | ||
| api_key=None, | ||
| ) | ||
|
|
||
| assert model == "qwen/qwen3-coder-30b-a3b-instruct" | ||
| assert provider == "sokkan" | ||
| assert api_key == "sokkan-test-key" | ||
| assert api_base == "https://api.sokkan.ch/v1" |
There was a problem hiding this comment.
These tests verify credential and model resolution but never send a chat-completions request. A regression in the request URL, bearer header, or slash-containing model ID could therefore go unnoticed. Add a mocked request test that checks what is actually sent.
Knowledge Base Used: Provider adapters and capabilities
There was a problem hiding this comment.
Addressed in fbd2e7d: test_sokkan_chat_completion_request mocks the upstream with respx and checks the URL, the bearer header, and the slash-containing model ID in the request body.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ovider Registers `sokkan` (SOKKAN_API_KEY / SOKKAN_API_BASE, https://api.sokkan.ch/v1), Swiss-hosted zero-retention inference, with gpt-oss-20b and Qwen3-Coder-30B-A3B-Instruct in the cost map, the endpoint support matrix and the proxy add-model form. Tests check both models against independently stated rates and send a mocked chat-completions request.
9da4f10 to
fbd2e7d
Compare
TLDR
Problem this solves:
sokkan/<model>is rejected as an unknown providerHow it solves it:
sokkanas a JSON-configured OpenAI-compatible provider (SOKKAN_API_KEY,SOKKAN_API_BASE, defaulthttps://api.sokkan.ch/v1)sokkan/openai/gpt-oss-20bandsokkan/qwen/qwen3-coder-30b-a3b-instructwith the prices and limits published by the provider's/v1/modelsendpoint/public/providers/fieldsand the endpoint support matrix (chat completions only)SOKKAN is an inference API operated by NINABOT Sàrl (Geneva, Switzerland): inference served in Switzerland, zero retention (prompts and completions never logged or stored, never used for training). Terms and DPA: https://sokkan.ch/en/api/ and https://sokkan.ch/en/api/dpa/
Tests
tests/unit/llms/openai_like/test_sokkan_provider.py: provider resolution, explicit credentials override, cost map and capabilities for everysokkan/model.