Skip to content

Commit c81e1f1

Browse files
committed
AIX: OpenRouter: protocol bits
1 parent ee788b9 commit c81e1f1

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/modules/aix/server/dispatch/chatGenerate/parsers/openai.parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,8 +535,8 @@ export function createOpenAIChatCompletionsParserNS(): ChatGenerateParseFunction
535535
}
536536

537537
// [OpenRouter, 2025-12-31] Extension for receiving Images (non-streaming)
538-
if ((message as any).images && Array.isArray((message as any).images)) {
539-
for (const imageObj of (message as any).images) {
538+
if (message.images && Array.isArray(message.images)) {
539+
for (const imageObj of message.images) {
540540
if (imageObj?.image_url?.url) {
541541
const imageUrl = imageObj.image_url.url;
542542
// Extract mime type and base64 data from data URL: "data:image/png;base64,..."

src/modules/aix/server/dispatch/wiretypes/openai.wiretypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ export namespace OpenAIWire_API_Chat_Completions {
510510
reasoning_tokens: z.number().optional(), // [Discord, 2024-04-10] reported missing
511511
// text_tokens: z.number().optional(), // [Discord, 2024-04-10] revealed as present on custom OpenAI endpoint - not using it here yet
512512
audio_tokens: z.number().optional(), // [OpenAI, 2024-10-01] audio tokens used in the completion (charged at a different rate)
513-
// image_tokens: z.number().optional(), // [OpenRouter, 2025-10-22] first seen.. sounds likely?
513+
// image_tokens: z.number().optional(), // [OpenRouter, 2026-02-06] confirmed: image tokens in image generation output
514514
accepted_prediction_tokens: z.number().optional(), // [OpenAI, 2024-11-05] Predicted Outputs
515515
rejected_prediction_tokens: z.number().optional(), // [OpenAI, 2024-11-05] Predicted Outputs
516516
}).optional() // not present in other APIs yet

src/modules/llms/server/openai/wiretypes/openrouter.wiretypes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ export const wireOpenrouterModelsListOutputSchema = z.object({
6565
'logprobs',
6666
'max_tokens',
6767
'min_p',
68+
'parallel_tool_calls',
6869
'presence_penalty',
6970
'reasoning', // Reasoning
71+
'reasoning_effort', // Legacy (prefer 'reasoning')
7072
'repetition_penalty',
7173
'response_format',
7274
'seed',
@@ -79,6 +81,7 @@ export const wireOpenrouterModelsListOutputSchema = z.object({
7981
'top_k',
8082
'top_logprobs',
8183
'top_p',
84+
'verbosity',
8285
'web_search_options', // all models have also fallback search
8386
]),
8487
z.string(), // Allow other parameters not in the enum

0 commit comments

Comments
 (0)