Skip to content

feat(providers): add SOKKAN as a JSON-configured OpenAI-compatible provider - #44091

Open
nicolas-micaud wants to merge 1 commit into
BerriAI:mainfrom
nicolas-micaud:add-sokkan-provider
Open

nicolas-micaud wants to merge 1 commit into
BerriAI:mainfrom
nicolas-micaud:add-sokkan-provider

Conversation

@nicolas-micaud

Copy link
Copy Markdown

TLDR

Problem this solves:

  • sokkan/<model> is rejected as an unknown provider
  • SOKKAN's prices and limits are not in the cost map
  • SOKKAN is missing from the Admin UI add-model form

How it solves it:

  • Registers sokkan as a JSON-configured OpenAI-compatible provider (SOKKAN_API_KEY, SOKKAN_API_BASE, default https://api.sokkan.ch/v1)
  • Adds sokkan/openai/gpt-oss-20b and sokkan/qwen/qwen3-coder-30b-a3b-instruct with the prices and limits published by the provider's /v1/models endpoint
  • Lists SOKKAN in /public/providers/fields and 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 every sokkan/ model.

LITELLM_LOCAL_MODEL_COST_MAP=True pytest tests/unit/llms/openai_like/
154 passed

@CLAassistant

CLAassistant commented Oct 1, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Adds a new OpenAI-compatible provider to the system.

The PR appears safe to merge; the identified gaps are non-blocking weaknesses in the new provider tests.

Findings

  1. P2 Missing models escape coverage ▶
  2. P2 Prices check themselves ▶
  3. P2 Chat request remains untested ▶

Summary

Adds SOKKAN as a JSON-configured OpenAI-compatible chat provider, with two model price entries, endpoint metadata, and Admin UI creation fields. Provider resolution and catalog tests are included, but the new tests do not independently verify the advertised prices or exercise a chat request.

Reviews (1) · Last reviewed commit: "feat(providers): add SOKKAN as a JSON-co..."

Comment on lines +44 to +45
def test_sokkan_models_registered():
assert SOKKAN_MODELS, "no sokkan/ model in the cost map"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 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!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +60 to +61
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Prices check themselves

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +11 to +21
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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Chat request remains untested

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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@codspeed

codspeed Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing nicolas-micaud:add-sokkan-provider (fbd2e7d) with main (086d76a)

Open in CodSpeed

…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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants