Provider keys
Your own provider keys for the environment.
requests to a provider's models run on your key for it, and the provider bills you directly.
| Operation | Method | SDK |
|---|---|---|
| List your provider keys | GET | hixel.providerKeys.list |
| Store a provider key | PUT | hixel.providerKeys.put |
| Remove a provider key | DELETE | hixel.providerKeys.remove |
| Check a provider key | POST | hixel.providerKeys.check |
List your provider keys#
Every provider key you connected to the environment, at most one per provider, by provider: never the keys.
Takes an environment key with the management scope, or a project key with the member role or higher, naming the environment in x-hixel-environment.
Response 200: EnvironmentProviderKeyList
| Field | Type | Description |
|---|---|---|
data required | array of EnvironmentProviderKey | |
data[].id required | string | The id of a provider key a customer brought (pcred_…). |
data[].environment_id required | string | The id of an environment (env_…). |
data[].provider required | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | An upstream model vendor: what a route names and what a customer can bring its own key for. bedrock is Amazon Bedrock and vertex Google Vertex AI, which serve other vendors' models under their own authentication. |
data[].form required | "api_key" | "aws_access_keys" | "service_account" | What the key holds: a static key (api_key, also a Bedrock API key), Bedrock access keys (aws_access_keys), or a Vertex service account's key file (service_account). |
data[].last_four required | string | The last four characters of the key, of an AWS access key id (never of its secret), or of a service account's key id (empty when the key file has none). |
data[].label required | string | null | A service account's email, to tell keys apart; null for every other form. |
data[].base_url required | string | null | Where the key is sent instead of the provider's default endpoint; null for the default. |
data[].last_check required | object | The last check of the key with its provider. |
data[].last_check.status required | "valid" | "rejected" | "failed" | "unchecked" | valid: the provider accepted the key. rejected: it refused it (401 or 403). failed: the provider could not be reached or answered otherwise. unchecked: the platform has no check for this provider. |
data[].last_check.http_status required | integer | null | The provider's HTTP status; null when no answer came or nothing was asked. |
data[].last_check.checked_at required | string (date-time) | |
data[].created_at required | string (date-time) | |
data[].updated_at required | string (date-time) |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.environment_required: a project key was sent withoutx-hixel-environment.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the key was revoked or expired while the request ran, or an environment's key lost themanagementscope.management_scope_required: the environment's key does not have themanagementscope.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, an archived one, or another than the environment key's own. - 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.
curl "https://api.hixel.dev/v1/provider_keys" \
-H "Authorization: Bearer $HIXEL_API_KEY"const environmentProviderKeyList = await hixel.providerKeys.list();Store a provider key#
Stores your key for provider, replacing the one the environment had, and publishes it to the gateway: requests to that provider's models then run on it. The key is checked with the provider first (last_check); a key the check finds wrong is stored all the same. It is encrypted at rest and never returned by any read. Takes a project key with the admin role and x-hixel-environment.
Takes a project key with the admin role, naming the environment in x-hixel-environment; an environment's own key may not. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
provider required | path | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | The provider the key is for. |
Request body: PutProviderKeyBody
| Field | Type | Description |
|---|---|---|
api_key required | string | The provider key; never echoed, logged or returned by any read. For bedrock, AWS access keys as JSON text ({"access_key_id","secret_access_key","session_token"?}) or a Bedrock API key; for vertex, the service account's JSON key file as Google issues it. |
base_url | string | Where to send the key instead of the provider's default endpoint: https:// on a public host name. Required for azure and custom. |
Response 200: EnvironmentProviderKey
| Field | Type | Description |
|---|---|---|
id required | string | The id of a provider key a customer brought (pcred_…). |
environment_id required | string | The id of an environment (env_…). |
provider required | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | An upstream model vendor: what a route names and what a customer can bring its own key for. bedrock is Amazon Bedrock and vertex Google Vertex AI, which serve other vendors' models under their own authentication. |
form required | "api_key" | "aws_access_keys" | "service_account" | What the key holds: a static key (api_key, also a Bedrock API key), Bedrock access keys (aws_access_keys), or a Vertex service account's key file (service_account). |
last_four required | string | The last four characters of the key, of an AWS access key id (never of its secret), or of a service account's key id (empty when the key file has none). |
label required | string | null | A service account's email, to tell keys apart; null for every other form. |
base_url required | string | null | Where the key is sent instead of the provider's default endpoint; null for the default. |
last_check required | object | The last check of the key with its provider. |
last_check.status required | "valid" | "rejected" | "failed" | "unchecked" | valid: the provider accepted the key. rejected: it refused it (401 or 403). failed: the provider could not be reached or answered otherwise. unchecked: the platform has no check for this provider. |
last_check.http_status required | integer | null | The provider's HTTP status; null when no answer came or nothing was asked. |
last_check.checked_at required | string (date-time) | |
created_at required | string (date-time) | |
updated_at required | string (date-time) |
Errors
- 400
invalid_parameter: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: the project key was sent withoutx-hixel-environment.invalid_params,invalid_payload,malformed_body,body_too_large: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the project key was revoked or expired while the request ran.project_key_required: an environment's key was sent; this endpoint takes a project key.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
environment_not_found:x-hixel-environmentnames an environment outside the project key's project, or an archived one. - 409
project_archived: This project is archived.environment_archived: This environment is archived.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X PUT "https://api.hixel.dev/v1/provider_keys/openai" \
-H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
-H "x-hixel-environment: env_123" \
-H "Content-Type: application/json" \
-d '{
"api_key": "sk-…"
}'const environmentProviderKey = await hixel.environment("env_123").providerKeys.put("openai", {
api_key: "sk-…",
});Remove a provider key#
Deletes your key for provider. Requests to that provider's models are then refused (provider_key_missing) unless the platform's keys are allowed for the environment. Answers 204 with no body.
Takes a project key with the admin role, naming the environment in x-hixel-environment; an environment's own key may not. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
provider required | path | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | The provider the key is for. |
Response 204
No body.
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: the project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the project key was revoked or expired while the request ran.project_key_required: an environment's key was sent; this endpoint takes a project key.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
provider_key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, or an archived one.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X DELETE "https://api.hixel.dev/v1/provider_keys/openai" \
-H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
-H "x-hixel-environment: env_123"await hixel.environment("env_123").providerKeys.remove("openai");Check a provider key#
Checks your stored key for provider with the provider again, with the cheapest call it answers (listing models), and records the result in last_check.
Takes a project key with the admin role, naming the environment in x-hixel-environment; an environment's own key may not. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
provider required | path | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | The provider the key is for. |
Response 200: EnvironmentProviderKey
| Field | Type | Description |
|---|---|---|
id required | string | The id of a provider key a customer brought (pcred_…). |
environment_id required | string | The id of an environment (env_…). |
provider required | "openai" | "anthropic" | "azure" | "google" | "groq" | "mistral" | … | An upstream model vendor: what a route names and what a customer can bring its own key for. bedrock is Amazon Bedrock and vertex Google Vertex AI, which serve other vendors' models under their own authentication. |
form required | "api_key" | "aws_access_keys" | "service_account" | What the key holds: a static key (api_key, also a Bedrock API key), Bedrock access keys (aws_access_keys), or a Vertex service account's key file (service_account). |
last_four required | string | The last four characters of the key, of an AWS access key id (never of its secret), or of a service account's key id (empty when the key file has none). |
label required | string | null | A service account's email, to tell keys apart; null for every other form. |
base_url required | string | null | Where the key is sent instead of the provider's default endpoint; null for the default. |
last_check required | object | The last check of the key with its provider. |
last_check.status required | "valid" | "rejected" | "failed" | "unchecked" | valid: the provider accepted the key. rejected: it refused it (401 or 403). failed: the provider could not be reached or answered otherwise. unchecked: the platform has no check for this provider. |
last_check.http_status required | integer | null | The provider's HTTP status; null when no answer came or nothing was asked. |
last_check.checked_at required | string (date-time) | |
created_at required | string (date-time) | |
updated_at required | string (date-time) |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_idempotency_key: anIdempotency-Keyis 1 to 255 characters of visible ASCII.environment_required: the project key was sent withoutx-hixel-environment.invalid_params: the request's path, query or body does not match its schema, or the body is not JSON or is over 1 MiB.
- 401
api_key_required,invalid_api_key,expired_api_key: no key was sent; the key is unknown or revoked, or its project or environment is archived; or it has expired. - 403
key_inactive: the project key was revoked or expired while the request ran.project_key_required: an environment's key was sent; this endpoint takes a project key.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
provider_key_not_found: The resource does not exist in the key's environment; a resource outside it reads the same.environment_not_found:x-hixel-environmentnames an environment outside the project key's project, or an archived one.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.idempotency_key_reused,idempotency_key_in_use: the key was used for another request (method, path or body), or the first request with it is still running.
- 500
internal: an unexpected failure on the platform's side (internal_error); the details are logged, never returned. - 503
database_unavailable: A dependency, such as the database or Stripe, cannot be reached; retry later.database_unavailable: the stored response to the key could not be read or written; retry later.
curl -X POST "https://api.hixel.dev/v1/provider_keys/openai/check" \
-H "Authorization: Bearer $HIXEL_PROJECT_KEY" \
-H "x-hixel-environment: env_123"const environmentProviderKey = await hixel.environment("env_123").providerKeys.check("openai");