Skip to main content
If you’re migrating from OpenAI, Anthropic, Gemini, or another provider, use one stable path to dottxt.

Shared migration pattern

  1. Point your client at dottxt (baseURL + dottxt API key).
  2. Send raw JSON Schema in response_format (avoid helper methods like parse that rewrite schemas).
This keeps the request shape explicit and avoids provider SDK transformations that can silently change optionality and constraints.

OpenAI-compatible example: change two lines

Two changes:
  1. Set base_url and api_key to point at dottxt
  2. Swap the model name
Everything else, including response_format, messages, and response parsing, stays the same.

What changes when you switch

With OpenAI Structured Outputs, strict: true comes with a restricted JSON Schema subset. All object fields must be listed in required, objects must set additionalProperties: false, and some schema shapes are rejected outright. With dottxt, your schema is used as-is: See the full provider comparison for details.

Code you can delete

When your provider does not enforce the schema you actually want, you compensate with application code. Here’s what that often looks like in practice: not the API call itself, but everything around it.
With dottxt, the same task:
The validation code, the date normalization, the currency cleanup, the empty-string-to-None conversion, and the retry loop all exist because the schema wasn’t enforced. Delete the workarounds, keep the schema.

Richer schemas that now work

Once you’re on dottxt, you can use JSON Schema patterns that OpenAI’s strict mode rejects:
name is always non-empty. email matches the pattern. tags has 1–5 items. role is optional; it may or may not appear in the output. None of this works with OpenAI’s strict mode.

TypeScript

The same approach works with any OpenAI-compatible TypeScript client: