Use your existing tools
Meadow speaks the OpenAI and Anthropic wire formats, so most clients work after two changes: the base URL and the key.
Next step: find your tool in the table, set its two variables, and run it.
The key is always your Meadow API key (mdw_...), never a provider key. The OpenAI SDKs add /chat/completions to the base URL, so theirs ends in /v1. The Anthropic SDK adds /v1/messages, so its base URL does not.
Model IDs are Meadow’s. Run GET /v1/models to see them, and read Models before you paste an ID from a provider’s docs.
What was run for this page, and with which versions:
Not proven: any tool with OpenAI direct, Azure, or Bedrock as the provider. Our OpenAI key has no quota, so no call through the beta has been served by OpenAI itself. The paths exist and pass tests against stand-in servers. Run one call with your own key before you rely on them.
curl
Models has a curl sample for each format.
OpenAI Python SDK
You can also pass both values in code: OpenAI(base_url=os.environ["MEADOW_BASE_URL"] + "/v1", api_key=os.environ["MEADOW_API_KEY"]).
Tool calls and structured output
Tools, response_format, and the SDK’s parse() helper pass through to the provider like any other field. This ran on gemini-3.1-flash-lite-preview, served by Google. It needs pydantic.
Whether a field works depends on the provider that serves the call. We ran these four on Google only. A streamed tool call with AsyncOpenAI also completed there. Run untrusted code uses a tool call to run model-written code in a sandbox.
What Meadow does not serve
Meadow serves four calls of the OpenAI API: chat.completions.create (and the parse and stream helpers built on it), responses.create, responses.stream, and models.list. Every other call returns 404:
The message names the call and lists the routes Meadow serves. e.code is route_not_found for all of them. The body is OpenAI’s own error object, so e.type, e.code and e.param are filled. That output was rebuilt from Meadow’s tests after the error format changed on 2026-11-28. It was not run again on the hosted beta.
We saw a 404 for embeddings.create, images.generate, audio.speech.create, audio.transcriptions.create, files.list, batches.list, moderations.create, completions.create, models.retrieve, responses.retrieve, vector_stores.list, and fine_tuning.jobs.list.
Do: if your app also embeds text or uses one of these, keep a second client that points at the provider with the provider’s key, and use the Meadow client for chat and responses.
A 404 also comes back when the base URL is wrong. route not found on a chat call means the OpenAI base URL is missing /v1, or the Anthropic base URL has a /v1 it should not have. The message says which: route not found: Meadow's routes start with /v1. Add /v1 to the client's base URL., or route not found: the path has /v1 twice. This client adds /v1 itself, so give it Meadow's address without /v1.
OpenRouter serves more of these than Meadow. Its API reference (read 2026-11-24) lists embeddings, image generation, speech, transcription, files and batches. It lists no moderations, vector stores, fine-tuning or stored responses.
Retries and errors
The OpenAI and Anthropic SDKs resend a call twice by default after a 429, a 5xx, or a timeout. Through Meadow that has a cost: each send can be billed by a provider and counts against a key’s limits. In this run the SDK sent a call that got a 502 three times:
That run is from the hosted beta before its update of 2026-11-28. Since then, a 5xx on a model route carries x-should-retry: false, and both SDKs obey that header before their own rule, so the SDK sends such a call once. A 429 for a full server carries x-should-retry: true. Read from the server’s code and its tests. Not yet run with the SDKs.
Do: until that run exists, set max_retries=0 on the client (OpenAI(max_retries=0), Anthropic(max_retries=0)) when a second send is not acceptable, and retry in your own code on a 429 only. Meadow has already tried every provider in the route before it returns a 502, so resending a 502 repeats the same failures. A 429 means no provider took the call, so that one is safe to send again after retry-after.
The SDK maps statuses to its usual exception classes. A Meadow error on these routes is in OpenAI’s own envelope, so e.type, e.code and e.param are filled: e.code is Meadow’s code, such as all_providers_failed, and e.type is OpenAI’s, such as server_error. e.body holds the error object, with attempts when Meadow tried a provider, and e.request_id holds Meadow’s request ID. The body above was rebuilt from Meadow’s tests after the format changed on 2026-11-28. See Errors on model routes. On a served call the OpenAI SDK’s response._request_id is Meadow’s ID too, read from x-request-id. For a provider error passed through, it holds whatever that provider sent: a list for Google, a plain string for xAI. See Errors.
OpenAI TypeScript SDK
Without the cast, the TypeScript compiler rejects provider with 'provider' does not exist in type 'ChatCompletionCreateParamsBase'.
Anthropic Python SDK
ANTHROPIC_API_KEY is sent as x-api-key and ANTHROPIC_AUTH_TOKEN as Authorization: Bearer. Meadow accepts either. Set one, not both with different values.
Errors and request IDs work as they do against Anthropic. A Meadow error on /v1/messages is in Anthropic’s envelope, so the SDK raises its usual class and fills e.type (such as rate_limit_error), e.error_code (Meadow’s code) and e.request_id. message._request_id is Meadow’s request ID, because Meadow sends it in the request-id header the SDK reads. The provider’s own ID is in x-meadow-provider-request-id: read it from the raw response headers (client.messages.with_raw_response.create(...)). Shown by Meadow’s tests, which run the SDK against these bodies. Not run on the hosted beta. See Errors on model routes.
Two differences from calling Anthropic directly:
client.messages.count_tokens()fails with a 404Meadow does not serve token counting. So do the batch, file, and model-detail calls. Meadow servesmessages.createandmessages.streamonly.- The SDK retries twice by default. See Retries and errors.
Claude Code
With only those two variables, Claude Code 2.1.331 asked for claude-opus-5-5, which is on Meadow’s list, and Anthropic served it. ANTHROPIC_API_KEY works in place of ANTHROPIC_AUTH_TOKEN. A prompt that made Claude Code call its Bash tool also completed, in two turns.
To choose the model, set ANTHROPIC_MODEL:
A provider alias works too: ANTHROPIC_MODEL=claude-haiku-4-5 was served in this run. Meadow passes other unlisted claude- IDs to Anthropic when you have an Anthropic key. If Claude Code prints API Error: 400 unknown model, the ID is not one Meadow can place. Pin the provider: ANTHROPIC_MODEL=anthropic/<model id>.
Claude Code on a key with a token limit
Claude Code asks for a large output token limit on every call, and Meadow reserves the cap before it forwards the call. See the reservation rule. So a key with max_tokens must have room for one whole reservation, or the first call is rejected.
With Claude Code 2.1.331 and claude-haiku-5-5, on a key with max_tokens: 1000:
About 128,000 of that is the output token limit and about 17,000 is the request itself, which carries Claude Code’s system prompt and tools. Set CLAUDE_CODE_MAX_OUTPUT_TOKENS to lower the cap:
Do:
- Set
CLAUDE_CODE_MAX_OUTPUT_TOKENSfor any Claude Code run on a token-limited key. - Size the key for the whole job. Each call is charged what the provider reports, which for Claude Code is at least the 17,000 or so tokens of the request. In our run a 120,000 token key allowed one small edit task and two short prompts.
- Claude Code prints “Failed to authenticate” for every 401 and 403. With a 403 the key is valid, and the cause is a limit, a scope, or a model the key does not allow. A wrong key is a 401:
Failed to authenticate. API Error: 401 invalid api key.
The numbers are from one version of Claude Code and one model. Run one call on a small key to see yours.
Limits of what was tested: print mode (claude -p) only, from a clean configuration. An interactive session, which also makes background calls with a small model, was not tested.
To keep Claude Code on approved providers, give it a key from a project with locked routing (Projects), and do not pin model IDs there.
Codex CLI
The Codex CLI speaks only the Responses format. Add a provider to ~/.codex/config.toml, with your real base URL written out:
What this proves and what it does not:
- Through OpenRouter, Codex CLI 0.158.0 completed a plain prompt and a prompt that ran a shell command.
- Through xAI, the same request failed. xAI answered 422 because it does not accept one of the tool types Codex sends. Meadow passed that error through.
- Through OpenAI itself, nothing has been run. This is the setup most Codex users want, and it is unproven on the beta.
Codex warns Model metadata for ... not found for IDs it does not know. The calls still ran.
gemini-cli and the Google GenAI SDKs
These speak Google’s own Gemini format, which Meadow serves at /v1beta/models/{model}:generateContent and /v1/models/{model}:generateContent. Set the client’s base URL to MEADOW_BASE_URL and its key to a Meadow key. Gemini clients has the setup. Not on the hosted beta yet, and not run against Google.
API reference
Operations on this page: createChatCompletion, createResponse, createMessage, listModels.