Files
cleveragents-core/features/openrouter_provider.feature

41 lines
2.9 KiB
Gherkin

Feature: OpenRouter provider adapter coverage
As a maintainer validating OpenRouter integrations
I want Behave scenarios for the OpenRouter chat provider
So that constructor guards and header propagation stay regression tested
@unit @providers @openrouter
Scenario: OpenRouter provider instantiates ChatOpenAI with provided credentials
Given I have sample provider domain inputs
When I create an OpenRouter chat provider with API key "sk-openrouter-unit" and model "anthropic/claude-sonnet-4-20250514"
And I request plan generation from the OpenRouter provider
Then the OpenRouter provider should construct ChatOpenAI with api key "sk-openrouter-unit", model "anthropic/claude-sonnet-4-20250514", and base url "https://openrouter.ai/api/v1"
And the OpenRouter provider metadata should report name "openrouter" and model "anthropic/claude-sonnet-4-20250514"
@unit @providers @openrouter
Scenario: OpenRouter provider forwards extra kwargs and reports token usage
Given I have sample provider domain inputs
And the plan generation graph returns a generated change for "app/openrouter_provider.py"
And the OpenRouter provider token estimator returns 512 tokens
And I set the OpenRouter provider extra kwargs "temperature=0.15,max_tokens=2048"
When I create an OpenRouter chat provider with API key "sk-openrouter-unit" and model "anthropic/claude-sonnet-4-20250514"
And I request plan generation from the OpenRouter provider
Then the OpenRouter provider should construct ChatOpenAI with api key "sk-openrouter-unit", model "anthropic/claude-sonnet-4-20250514", and base url "https://openrouter.ai/api/v1"
And the OpenRouter provider should include kwargs "temperature=0.15,max_tokens=2048" in the ChatOpenAI call
And the OpenRouter provider response should include 1 generated change for "app/openrouter_provider.py"
And the OpenRouter provider response token count should equal 512
@unit @providers @openrouter
Scenario: OpenRouter provider attaches organization headers when provided
Given I have sample provider domain inputs
And I set the OpenRouter provider default headers "X-Trace-ID=trace-openrouter"
And I set the OpenRouter provider organization "cleveragents.dev"
When I create an OpenRouter chat provider with API key "sk-openrouter-unit" and model "anthropic/claude-sonnet-4-20250514"
And I request plan generation from the OpenRouter provider
Then the OpenRouter provider should include headers "X-Trace-ID=trace-openrouter,HTTP-Referer=cleveragents.dev,X-Title=cleveragents.dev" in the ChatOpenAI call
@unit @providers @openrouter
Scenario: OpenRouter provider rejects missing API key
Given I have sample provider domain inputs
When I attempt to create an OpenRouter chat provider without an API key
Then the OpenRouter provider creation should fail with error "OpenRouter API key is required"