forked from retoor/devplacepy
Send per-app provider attribution titles from one gateway app registry
Add openai_gateway/apps.py as the single list of internal gateway apps and send X-OpenRouter-Title (plus legacy X-Title and HTTP-Referer) per app to every upstream. Label the Devii agent, bots, modifier, quiz grading, SEO metadata, community and sync callers. Shorten two app references that exceeded the 30 character limit and were recorded as default. Also includes the pending Muse Code, route health and Responses work. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -385,6 +385,25 @@ def test_response_object_to_chat_completion():
|
||||
}
|
||||
|
||||
|
||||
def test_response_object_usage_details_pass_through():
|
||||
comp, _ = responses_object_to_chat_completion(
|
||||
{
|
||||
"id": "r",
|
||||
"output": [],
|
||||
"usage": {
|
||||
"input_tokens": 10,
|
||||
"output_tokens": 4,
|
||||
"total_tokens": 14,
|
||||
"input_tokens_details": {"cached_tokens": 6},
|
||||
"output_tokens_details": {"reasoning_tokens": 2},
|
||||
},
|
||||
}
|
||||
)
|
||||
assert comp["usage"]["prompt_tokens"] == 10
|
||||
assert comp["usage"]["prompt_tokens_details"] == {"cached_tokens": 6}
|
||||
assert comp["usage"]["completion_tokens_details"] == {"reasoning_tokens": 2}
|
||||
|
||||
|
||||
def test_response_object_finish_reasons():
|
||||
comp, _ = responses_object_to_chat_completion(
|
||||
{
|
||||
@@ -451,6 +470,9 @@ def test_responses_failure_and_error_shapes():
|
||||
assert responses_error_object({"error": {"message": "m", "code": "c"}}) == {
|
||||
"error": {"message": "m", "code": "c"}
|
||||
}
|
||||
assert responses_error_object(
|
||||
{"error": {"message": "m", "type": "t", "code": "c", "param": "p"}}
|
||||
) == {"error": {"message": "m", "type": "t", "code": "c", "param": "p"}}
|
||||
assert responses_error_object({"a": 1}) is None
|
||||
|
||||
|
||||
@@ -475,7 +497,9 @@ def test_stream_responses_to_chat_text_and_done():
|
||||
}
|
||||
)
|
||||
assert done[0]["choices"][0]["finish_reason"] == "stop"
|
||||
assert done[0]["usage"]["prompt_tokens"] == 1
|
||||
assert "usage" not in done[0]
|
||||
assert done[1]["choices"] == []
|
||||
assert done[1]["usage"]["prompt_tokens"] == 1
|
||||
|
||||
|
||||
def test_stream_responses_to_chat_tool_calls():
|
||||
|
||||
Reference in New Issue
Block a user