API reference

API reference · BYOK

Attach a provider credential

POST/api/provider-keysSigned in session

Inference then bills to your provider account while Antimatter keeps routing, metering, and dashboards. Antimatter charges no credits for a BYOK request and marks the response x-antimatter-byok: 1. A key is used only for the models this deployment serves through that provider directly (GET says which, as servedHere), never by an agent's key, and a BYOK answer is never cached. Saving a second key for a provider revokes the first.

Request body

application/json, required

Request body fields
FieldTypeWhat it is
providerrequiredstringOne of "openrouter", "openai", "anthropic", "google", "deepseek", "xai", "mistral", "groq", "cerebras", "together", "fireworks".
keyrequiredstring
labelstring

Example

{
  "provider": "openrouter",
  "key": "string",
  "label": "string"
}

Answer 201

Stored.

Fields of the 201 answer
FieldTypeWhat it is
providerKeyProviderKey
providerKey.idinteger
providerKey.providerstringOne of "openrouter", "openai", "anthropic", "google", "deepseek", "xai", "mistral", "groq", "cerebras", "together", "fireworks".
providerKey.labelstring or null
providerKey.createdAtinteger
providerKey.lastUsedAtinteger or null
providerKey.revokedAtinteger or null

Errors

  • 400OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter