• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
yawnxyz

yawnxyz

chat

Public
Like
chat
Home
Code
7
backend
2
chat
1
chatter
frontend
3
public
deno.json
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
/
x
/
yawnxyz
/
chat
/
branch
/
main
/
version
/
102
/
code
/
backend
/
providers
/
FIX-IMAGE-DETAIL.md
/
backend
/
providers
/
FIX-IMAGE-DETAIL.md
Code
/
/
x
/
yawnxyz
/
chat
/
branch
/
main
/
version
/
102
/
code
/
backend
/
providers
/
FIX-IMAGE-DETAIL.md
/
backend
/
providers
/
FIX-IMAGE-DETAIL.md
Search
…
Viewing readonly version of main branch: v102
View latest version
FIX-IMAGE-DETAIL.md

Fix: image_detail Parameter Error

Issue

GPT-OSS models were receiving image_detail parameter even though they don't support it, causing:

{ "id": "1766681048491-1", "status": "error", "error": "property 'image_detail' is unsupported" }

Root Cause

The code was applying transformations to ALL parameters and then checking if the model supports them. However, if imageDetail was set in the options (perhaps from a previous model selection or default settings), it would be included in the transformation and potentially sent to models that don't support it.

Solution

The fix ensures that parameters are only added to the request if the model explicitly supports them:

// Transform parameters for this specific model const transformedParams = transformParametersForAPI(model, { reasoningEffort: options?.reasoningEffort, imageDetail: options?.imageDetail, webSearch: options?.webSearch, codeExecution: options?.codeExecution, }); // Add parameters ONLY if model supports them if (transformedParams.reasoningEffort && modelSupportsParameter(model, 'reasoningEffort')) { requestBody.reasoning_effort = transformedParams.reasoningEffort; } // Image detail ONLY for vision models if (transformedParams.imageDetail && modelSupportsParameter(model, 'imageDetail')) { requestBody.image_detail = transformedParams.imageDetail; }

Model Configuration

Only Llama 4 Vision models have imageDetail parameter:

✅ Support imageDetail:

  • meta-llama/llama-4-maverick-17b-128e-instruct
  • meta-llama/llama-4-scout-17b-16e-instruct

❌ DON'T support imageDetail:

  • openai/gpt-oss-120b
  • openai/gpt-oss-20b
  • llama-3.3-70b-versatile
  • qwen/qwen3-32b
  • All other non-vision models

How It Works

The modelSupportsParameter() function checks if a parameter exists in the model's configuration:

function modelSupportsParameter(modelId: string, parameterKey: string): boolean { const config = getModelConfig(modelId); if (!config) return false; return config.parameters.some(p => p.key === parameterKey); }

Example Flow:

GPT-OSS Model (no imageDetail):

1. User options include imageDetail: 'auto'
2. Transform: imageDetail: 'auto' (no mapping needed)
3. Check: modelSupportsParameter('openai/gpt-oss-120b', 'imageDetail') → false
4. Result: image_detail NOT added to request ✓

Llama 4 Vision Model (has imageDetail):

1. User options include imageDetail: 'auto'
2. Transform: imageDetail: 'auto'
3. Check: modelSupportsParameter('meta-llama/llama-4-maverick-17b-128e-instruct', 'imageDetail') → true
4. Result: image_detail: 'auto' added to request ✓

Benefits

  1. No More Unsupported Parameter Errors: Parameters only sent when supported
  2. Type-Safe Configuration: Model configs define what's supported
  3. No Code Changes Needed: Works automatically for all models
  4. Clear Separation: Vision parameters vs thinking parameters vs base parameters

Files Changed

  1. backend/providers/groq.ts
    • Fixed parameter checking logic
    • Added clear comments explaining when each parameter is used
    • Applied same pattern to both complete() and stream() methods

Testing

Run verification:

deno run backend/providers/test-parameter-validation.ts

All tests pass ✅

Related Issues Fixed

This same pattern fixes:

  • ✅ reasoning_effort mapping (Qwen: medium → default)
  • ✅ image_detail support check (only vision models)
  • ✅ web_search support check (only compound/thinking models)
  • ✅ code_execution support check (only compound/thinking models)

The parameter validation system now handles all model-specific quirks declaratively through the model configuration.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.