Skip to navigation

Store or replace a vendor credential

Stores the credential for one provider, replacing any credential stored for it before. Meadow first makes one cheap read call to the vendor to check the credential. A credential the vendor rejects is not saved and the call returns 400. If the vendor cannot be reached the call returns 502, and you can retry.

credentials depends on the provider:

ProviderFields
anthropic, openai, google, xai, openrouter, fireworks, deepseekapi_key
azureapi_key, endpoint, deployments, and optionally api_version and deployment_types
bedrockaccess_key_id, secret_access_key, region, and optionally session_token and inference_profile; or api_key, region, and optionally inference_profile
vertexservice_account_json, project, region
daytonaapi_key, and optionally organization_id
modaltoken_id, token_secret, and optionally environment

Rules:

  • A field that is not in the table returns 400.
  • azure: endpoint is the bare https origin of your Azure OpenAI resource. deployments maps a Meadow model id to your deployment name and must not be empty. It decides which unpinned models route to Azure. A model id written azure/<deployment> is sent to that deployment as written. Leave api_version out to use Azure’s v1 API, which takes no api-version. Send it to use the dated API. One credential holds one resource and one deployment per model. deployment_types maps a deployment name to Azure’s deployment type code (GlobalStandard, DataZoneStandard, Standard, GlobalProvisionedManaged, DataZoneProvisionedManaged, ProvisionedManaged, GlobalBatch, DataZoneBatch, DeveloperTier). Calls are priced only on a GlobalStandard deployment; another type, or none, leaves the call with no cost.
  • bedrock: an IAM user access key, or a Bedrock API key in api_key (not both). region is a standard AWS region name such as us-east-1. Send session_token with temporary credentials from STS. With api_key, Meadow calls Bedrock’s Anthropic Messages route (/anthropic/v1/messages) and does not check the key with AWS before storing it. inference_profile is global (the default), us, eu or none, and decides where AWS may process a call: see Bedrock under Models. us needs a us- region and eu an eu- region, or the call returns 400.
  • vertex: service_account_json is the service account key, as a JSON object or as a string holding it. project is the project whose Vertex AI serves the calls. region is global, the multi-regions us or eu, or one region such as us-east5. The token_uri inside the key is ignored. The service account needs aiplatform.endpoints.predict on project (the Vertex AI User role has it), or the call returns 400.
  • The check at store time does not prove that a model call will work. Azure’s check lists models and Bedrock’s asks AWS who the key is. Both pass for an account that may not invoke models. Make one small call after you store a credential.
  • openrouter: store an inference key. A management key returns 400.
  • fireworks: the check is GET https://api.fireworks.ai/v1/accounts. deepseek: the check is GET https://api.deepseek.com/models.
  • anthropic: a Claude Code login token is accepted as api_key.
  • project_ids limits the credential to those projects. Left out or null means every project. Always send it for a credential that should be scoped. An id that does not exist returns 404.
  • After a Modal credential is replaced or deleted, the old token can stay in use for up to 5 minutes.

Scope: admin.

curl -sS -X PUT "$MEADOW_BASE_URL/v1/provider-keys/anthropic" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"credentials":{"api_key":"'"$ANTHROPIC_API_KEY"'"}}'

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Path parameters

providerenumRequired
The provider the credential belongs to.

Request

At most 1 MiB.
credentialsmap from strings to anyRequired

The vendor credential. Its fields depend on the provider.

  • anthropic, openai, google, xai, openrouter, fireworks, deepseek: {api_key}.
  • azure: {api_key, endpoint, deployments}, and optionally api_version and deployment_types (deployment name to Azure’s deployment type code, such as GlobalStandard; only a GlobalStandard deployment is priced). endpoint is the bare resource origin, such as https://<resource>.openai.azure.com. deployments maps a Meadow model id to your deployment name. It decides which unpinned models route to Azure. azure/<deployment> sends an unmapped name as written. Without api_version Meadow calls Azure’s v1 API (/openai/v1/chat/completions, /openai/v1/responses) with the deployment name as model. With api_version it calls the dated API (/openai/deployments/<deployment>/chat/completions and /openai/responses, both with ?api-version=). One key holds one resource.
  • bedrock: {access_key_id, secret_access_key, region}, and optionally session_token and inference_profile. An IAM access key, signed with SigV4. region is a standard AWS region name. session_token is for temporary credentials. Or {api_key, region} with an optional inference_profile: a Bedrock API key, sent in x-api-key to Bedrock’s Anthropic Messages route. A credential holds one of the two, not both. inference_profile is one of global (the default), us, eu or none. It sets the prefix of the Bedrock model id for models Meadow picks: global.anthropic.<model>, us.anthropic.<model>, eu.anthropic.<model>, or anthropic.<model> with no profile. us needs a us- region (not us-gov-) and eu needs an eu- region, or the write returns 400. A pinned id such as bedrock/us.anthropic.<model> is always sent as written.
  • vertex: {service_account_json, project, region}. project is the project whose Vertex AI serves the calls. It may differ from the service account’s own project when the account has aiplatform.endpoints.predict there. region is global, the multi-regions us or eu, or a single region such as us-east5. The token_uri inside service_account_json is ignored.
  • daytona: {api_key}, and optionally organization_id.
  • modal: {token_id, token_secret}, and optionally environment.

Any other field returns 400.

Each credential is checked when it is stored: one read call for the API key providers and Azure (its model list), STS GetCallerIdentity for bedrock, and for vertex a token exchange plus a check that the account has aiplatform.endpoints.predict on project. A stored bedrock or azure credential can still be refused at call time by an account that may not invoke models.

project_idslist of strings or nullOptional
Limit the credential to these projects. Null or left out means every project.

Response headers

x-request-idstringOptional

Meadow’s id for this request, req_ and 24 hex characters. Every response carries it, including errors, streams and unknown routes. Every error in the Error schema repeats it as request_id. Quote it when you report a problem.

Response

Checked against the vendor and stored.
providerenum

The name of a vendor. Model providers and sandbox providers share one list. Model providers: anthropic, openai, google, xai, azure, bedrock, vertex, openrouter, fireworks, deepseek. Sandbox providers: daytona, modal.

created_atdatetime
When a credential for this provider was first stored. Replacing it does not change this.
last4stringOptional

The last four characters of the stored key (for modal, of the token id).

project_idslist of strings or nullOptional
The projects that may use the credential. Null means every project.
verified_atdatetime or nullOptional
When Meadow last checked the credential against the vendor.
sandbox_healthobjectOptional

What Meadow remembers about recent sandbox creates on this provider with this account’s key. Present for daytona and modal only. It is a circuit breaker. closed: the provider is tried in its usual place. open: it failed lately, so a create with another provider in its route tries the other one first, until retry_at. half_open: one create is trying it again, and that create’s result closes it or opens it again. A provider opens after 3 failed creates in a row within 10 minutes (timeout or vendor error), for 60 seconds, or after one quota, capacity or rate limit answer, for 30 seconds. A rejected key (401 or 403) does not count. An order the caller or the project set moves an open provider only on a hard signal: a quota or capacity answer, or the 3 failures in a row. A route with one provider is never reordered. Storing the key again clears it.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error