mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
AIX: OpenRouter: protocol bits
This commit is contained in:
@@ -535,8 +535,8 @@ export function createOpenAIChatCompletionsParserNS(): ChatGenerateParseFunction
|
||||
}
|
||||
|
||||
// [OpenRouter, 2025-12-31] Extension for receiving Images (non-streaming)
|
||||
if ((message as any).images && Array.isArray((message as any).images)) {
|
||||
for (const imageObj of (message as any).images) {
|
||||
if (message.images && Array.isArray(message.images)) {
|
||||
for (const imageObj of message.images) {
|
||||
if (imageObj?.image_url?.url) {
|
||||
const imageUrl = imageObj.image_url.url;
|
||||
// Extract mime type and base64 data from data URL: "data:image/png;base64,..."
|
||||
|
||||
@@ -510,7 +510,7 @@ export namespace OpenAIWire_API_Chat_Completions {
|
||||
reasoning_tokens: z.number().optional(), // [Discord, 2024-04-10] reported missing
|
||||
// text_tokens: z.number().optional(), // [Discord, 2024-04-10] revealed as present on custom OpenAI endpoint - not using it here yet
|
||||
audio_tokens: z.number().optional(), // [OpenAI, 2024-10-01] audio tokens used in the completion (charged at a different rate)
|
||||
// image_tokens: z.number().optional(), // [OpenRouter, 2025-10-22] first seen.. sounds likely?
|
||||
// image_tokens: z.number().optional(), // [OpenRouter, 2026-02-06] confirmed: image tokens in image generation output
|
||||
accepted_prediction_tokens: z.number().optional(), // [OpenAI, 2024-11-05] Predicted Outputs
|
||||
rejected_prediction_tokens: z.number().optional(), // [OpenAI, 2024-11-05] Predicted Outputs
|
||||
}).optional() // not present in other APIs yet
|
||||
|
||||
@@ -65,8 +65,10 @@ export const wireOpenrouterModelsListOutputSchema = z.object({
|
||||
'logprobs',
|
||||
'max_tokens',
|
||||
'min_p',
|
||||
'parallel_tool_calls',
|
||||
'presence_penalty',
|
||||
'reasoning', // Reasoning
|
||||
'reasoning_effort', // Legacy (prefer 'reasoning')
|
||||
'repetition_penalty',
|
||||
'response_format',
|
||||
'seed',
|
||||
@@ -79,6 +81,7 @@ export const wireOpenrouterModelsListOutputSchema = z.object({
|
||||
'top_k',
|
||||
'top_logprobs',
|
||||
'top_p',
|
||||
'verbosity',
|
||||
'web_search_options', // all models have also fallback search
|
||||
]),
|
||||
z.string(), // Allow other parameters not in the enum
|
||||
|
||||
Reference in New Issue
Block a user