Latest in AI
OpenRouter Workspace API: Handle Missing Settings Without Assuming They're Off
Update typed clients for OpenRouter's optional Workspace response fields, and keep unknown settings distinct from explicit null or false values.
OpenRouter's November 20 API changelog marks eight Workspace response fields as no longer required. The change affects listing, fetching, creating and updating workspaces. If your management client validates the response against an older schema, a successful request can now arrive with a body your client rejects.
The more consequential mistake is accepting the response but reading a missing logging setting as false. That can leave an internal dashboard reporting a privacy setting it did not actually verify.
Update the response contract, not just the examples
The affected fields cover three groups:
- Model and routing defaults:
default_image_model,default_provider_sort, anddefault_text_model. - Logging scope and sampling:
io_logging_api_key_idsandio_logging_sampling_rate. - Logging and broadcast flags:
is_data_discount_logging_enabled,is_observability_broadcast_enabled, andis_observability_io_logging_enabled.
The current TypeScript SDK model still declares all eight. Its inbound validator now accepts them as optional, and the model comments explain that configuration can be omitted when the caller lacks settings visibility. The workspace endpoint reference still shows a fully populated example. Use that example as one possible response, not proof all callers always see the same fields.
Upgrade or regenerate your client where necessary. If you maintain your own validator, preserve required identity fields and change the affected settings to match their individual types. Optional is not a reason to accept arbitrary values.
Keep missing, null and false separate
For an optional boolean, preserve three states: true, false and missing. A dashboard can show “enabled,” “disabled,” or “not visible” instead of turning the third state into the second.
For example, after validating a raw response, this display logic does not coerce a missing logging flag:
function loggingLabel(value: boolean | undefined) {
if (value === undefined) return "Not visible";
return value ? "Enabled" : "Disabled";
}
Nullable fields have a separate distinction. OpenRouter's versioning guide says an explicit null represents an absent value and should not be replaced by a presumed default. The SDK documents a specific interpretation for io_logging_api_key_ids: when visible, null means the scope is all keys. That does not by itself mean logging is enabled. An omitted field does not tell you the scope at all.
Check your data layer as well as your UI. Database columns with automatic false defaults can silently erase uncertainty even if the API decoder handles it correctly.
Do not turn a partial read into a settings write
The update endpoint documents a separate PATCH request body. The changed response contract is not an instruction to send all settings back with replacement values.
An admin form that edits a name should send the intended name, not a complete object assembled from a partial read. Build patches from the user's explicit changes. Keep an unavailable setting visibly unavailable rather than giving it a prefilled value that can be submitted accidentally.
If an approval workflow requires proof that input and output logging is disabled, mark the check unverified when the relevant field is absent. Use an authorized settings view to resolve the uncertainty. Do not increase a credential's access merely to stop a parser error.
Test the migration with two fixtures
Keep one full response and one copy with the eight affected fields removed. Both should parse. Verify that the partial version still identifies the workspace, but does not invent a default model or pass a logging check. Add fixtures for a visible false flag and an explicit null scope; those should remain distinct from omission.
Then exercise the same decoder through list, get, create and update response handlers. Review the stored snapshots and any outbound patches, not just the screen. An SDK upgrade can restore parsing while leaving coercion in application code untouched.
OpenRouter's versioning guide describes a single stable v1 path with no date-based pinning. The durable fix is to read only the settings actually returned and to keep verification separate from parsing.
I'm Paras. I work at the intersection of AI, engineering and distribution.
I help AI teams turn API changes and engineering details into technical writing developers can use.