Customers
Your customers in the calling key's environment, each named by your own id for it (external_id), and the provider keys they bring.
Every other resource names its customer by that id, as customer.
| Operation | Method | SDK |
|---|---|---|
| Get a customer | GET | hixel.customers.get |
| Create or update a customer | PUT | hixel.customers.upsert |
| List customers | GET | hixel.customers.list |
| Create a customer | POST | hixel.customers.create |
| Block a customer | POST | hixel.customers.block |
| Unblock a customer | POST | hixel.customers.unblock |
| Store a customer's provider key | PUT | hixel.customers.putProviderKey |
| Remove a customer's provider key | DELETE | hixel.customers.removeProviderKey |
| List a customer's provider keys | GET | hixel.customers.listProviderKeys |
| Count customers | GET | hixel.customerCounts.get |
Get a customer#
The customer your id names; customer_not_found when the environment has none.
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.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
Response 200: Customer
| Field | Type | Description |
|---|---|---|
id required | string | The platform's id of the customer (cus_…); every path takes your external_id. |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
external_id required | string | Your id for the customer, unique within the environment: what x-hixel-customer names and what every path takes. |
name required | string | null | A display name; null for none. |
status required | "active" | "blocked" | active, or blocked: every request naming the customer is refused. |
allowed_models required | array of string | null | Model names and prefix/* patterns a request may use; null allows every model the level above allows. |
metadata required | object | Your own JSON, kept as given. |
limits required | SubjectLimits | null | Rate and spend limits replacing the environment's customer limits; null when the environment's apply. |
limits.rate required | object | |
limits.rate.requests_per_minute required | integer | null | |
limits.rate.tokens_per_minute required | integer | null | |
limits.rate.max_concurrent required | integer | null | |
limits.spend required | array of object | |
limits.spend[].id required | SpendLimitId | |
limits.spend[].window required | "day" | "week" | "month" | "total" | |
limits.spend[].limit_micros required | UnsignedMicros | |
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.environment_required: a 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 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
customer_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, 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/customers/org_42" \
-H "Authorization: Bearer $HIXEL_API_KEY"const customer = await hixel.customers.get("org_42");Create or update a customer#
Creates the customer external_id with the fields given (201), or changes the fields given of the existing one (200). A request naming an unknown customer at the gateway creates it too, so calling this first is optional. external_id is 1 to 256 characters of visible ASCII, not . or ...
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
Request body: UpsertCustomerBody
| Field | Type | Description |
|---|---|---|
name | string | null | A display name; null removes it. |
allowed_models | array of string | null | Model names and prefix/* patterns the customer may use, within what the environment allows; null allows every model the environment allows. |
metadata | object | Your own JSON, kept as given; replaces the customer's metadata. |
limits | object | null | Rate and spend limits ({"rate": {…}, "spend": […]}, as limits reads) replacing the environment's customer limits; null returns the customer to them. A field out of bounds is invalid_request naming its path in param. |
Response 200, 201: Customer
200: The customer existed and was changed. 201: The customer was created.
| Field | Type | Description |
|---|---|---|
id required | string | The platform's id of the customer (cus_…); every path takes your external_id. |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
external_id required | string | Your id for the customer, unique within the environment: what x-hixel-customer names and what every path takes. |
name required | string | null | A display name; null for none. |
status required | "active" | "blocked" | active, or blocked: every request naming the customer is refused. |
allowed_models required | array of string | null | Model names and prefix/* patterns a request may use; null allows every model the level above allows. |
metadata required | object | Your own JSON, kept as given. |
limits required | SubjectLimits | null | Rate and spend limits replacing the environment's customer limits; null when the environment's apply. |
limits.rate required | object | |
limits.rate.requests_per_minute required | integer | null | |
limits.rate.tokens_per_minute required | integer | null | |
limits.rate.max_concurrent required | integer | null | |
limits.spend required | array of object | |
limits.spend[].id required | SpendLimitId | |
limits.spend[].window required | "day" | "week" | "month" | "total" | |
limits.spend[].limit_micros required | UnsignedMicros | |
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: a 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 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.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, an archived one, or another than the environment key's own. - 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/customers/org_42" \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Inc."
}'const customer = await hixel.customers.upsert("org_42", {
name: "Acme Inc.",
});List customers#
A page of the environment's customers, oldest first. The filters combine; pass the same ones with each page's cursor.
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.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cursor | query | string | The next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it. |
limit | query | integer | How many items the page holds: an integer from 1 to 100; 50 when left out. |
external_id_prefix | query | string | Only customers whose external_id starts with this, byte for byte. |
name | query | string | Only customers whose name contains this, ignoring case. |
status | query | "active" | "blocked" | Only customers with this status. |
has_own_limits | query | boolean | true: only customers with limits of their own, which replace the environment's; false: only those the environment's limits apply to. |
has_own_allowed_models | query | boolean | true: only customers with allowed models of their own; false: only those allowed every model the environment allows. |
Response 200: CustomerList
| Field | Type | Description |
|---|---|---|
data required | array of Customer | |
data[].id required | string | The platform's id of the customer (cus_…); every path takes your external_id. |
data[].organization_id required | string | The id of your organization (org_…). |
data[].project_id required | string | The id of a project (proj_…). |
data[].environment_id required | string | The id of an environment (env_…). |
data[].external_id required | string | Your id for the customer, unique within the environment: what x-hixel-customer names and what every path takes. |
data[].name required | string | null | A display name; null for none. |
data[].status required | "active" | "blocked" | active, or blocked: every request naming the customer is refused. |
data[].allowed_models required | array of string | null | Model names and prefix/* patterns a request may use; null allows every model the level above allows. |
data[].metadata required | object | Your own JSON, kept as given. |
data[].limits required | SubjectLimits | null | Rate and spend limits replacing the environment's customer limits; null when the environment's apply. |
data[].limits.rate required | object | |
data[].limits.spend required | array of object | |
data[].created_at required | string (date-time) | |
data[].updated_at required | string (date-time) | |
next_cursor required | string | null | Pass back as cursor for the next page; null on the last page. |
Errors
- 400
invalid_parameter: The request is malformed or fails validation;paramnames the field.invalid_cursor: The cursor is not one this list gave.environment_required: a project key was sent withoutx-hixel-environment.invalid_query: 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 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/customers" \
-H "Authorization: Bearer $HIXEL_API_KEY"for await (const item of hixel.customers.list()) {
console.log(item);
}Create a customer#
Creates the customer external_id with the fields given, and only creates: an environment that already has a customer by this id answers customer_exists and changes nothing. PUT /v1/customers/{external_id} creates or changes.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Request body: CreateCustomerBody
| Field | Type | Description |
|---|---|---|
external_id required | string | Your id for the customer: 1 to 256 characters of visible ASCII, not . or .., compared byte for byte. |
name | string | null | A display name; null removes it. |
allowed_models | array of string | null | Model names and prefix/* patterns the customer may use, within what the environment allows; null allows every model the environment allows. |
metadata | object | Your own JSON, kept as given; replaces the customer's metadata. |
limits | object | null | Rate and spend limits ({"rate": {…}, "spend": […]}, as limits reads) replacing the environment's customer limits; null returns the customer to them. A field out of bounds is invalid_request naming its path in param. |
Response 201: Customer
| Field | Type | Description |
|---|---|---|
id required | string | The platform's id of the customer (cus_…); every path takes your external_id. |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
external_id required | string | Your id for the customer, unique within the environment: what x-hixel-customer names and what every path takes. |
name required | string | null | A display name; null for none. |
status required | "active" | "blocked" | active, or blocked: every request naming the customer is refused. |
allowed_models required | array of string | null | Model names and prefix/* patterns a request may use; null allows every model the level above allows. |
metadata required | object | Your own JSON, kept as given. |
limits required | SubjectLimits | null | Rate and spend limits replacing the environment's customer limits; null when the environment's apply. |
limits.rate required | object | |
limits.rate.requests_per_minute required | integer | null | |
limits.rate.tokens_per_minute required | integer | null | |
limits.rate.max_concurrent required | integer | null | |
limits.spend required | array of object | |
limits.spend[].id required | SpendLimitId | |
limits.spend[].window required | "day" | "week" | "month" | "total" | |
limits.spend[].limit_micros required | UnsignedMicros | |
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: a project key was sent withoutx-hixel-environment.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 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.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, an archived one, or another than the environment key's own. - 409
project_archived: This project is archived.environment_archived: This environment is archived.customer_exists: This environment already has a customer with this id.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/customers" \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_id": "org_42"
}'const customer = await hixel.customers.create({
external_id: "org_42",
});Block a customer#
Every request naming the customer is refused until it is unblocked.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
Response 200: Customer
| Field | Type | Description |
|---|---|---|
id required | string | The platform's id of the customer (cus_…); every path takes your external_id. |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
external_id required | string | Your id for the customer, unique within the environment: what x-hixel-customer names and what every path takes. |
name required | string | null | A display name; null for none. |
status required | "active" | "blocked" | active, or blocked: every request naming the customer is refused. |
allowed_models required | array of string | null | Model names and prefix/* patterns a request may use; null allows every model the level above allows. |
metadata required | object | Your own JSON, kept as given. |
limits required | SubjectLimits | null | Rate and spend limits replacing the environment's customer limits; null when the environment's apply. |
limits.rate required | object | |
limits.rate.requests_per_minute required | integer | null | |
limits.rate.tokens_per_minute required | integer | null | |
limits.rate.max_concurrent required | integer | null | |
limits.spend required | array of object | |
limits.spend[].id required | SpendLimitId | |
limits.spend[].window required | "day" | "week" | "month" | "total" | |
limits.spend[].limit_micros required | UnsignedMicros | |
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: a 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 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.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
customer_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, an archived one, or another than the environment key's own.
- 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/customers/org_42/block" \
-H "Authorization: Bearer $HIXEL_API_KEY"const customer = await hixel.customers.block("org_42");Unblock a customer#
The customer's requests are let through again.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
Response 200: Customer
| Field | Type | Description |
|---|---|---|
id required | string | The platform's id of the customer (cus_…); every path takes your external_id. |
organization_id required | string | The id of your organization (org_…). |
project_id required | string | The id of a project (proj_…). |
environment_id required | string | The id of an environment (env_…). |
external_id required | string | Your id for the customer, unique within the environment: what x-hixel-customer names and what every path takes. |
name required | string | null | A display name; null for none. |
status required | "active" | "blocked" | active, or blocked: every request naming the customer is refused. |
allowed_models required | array of string | null | Model names and prefix/* patterns a request may use; null allows every model the level above allows. |
metadata required | object | Your own JSON, kept as given. |
limits required | SubjectLimits | null | Rate and spend limits replacing the environment's customer limits; null when the environment's apply. |
limits.rate required | object | |
limits.rate.requests_per_minute required | integer | null | |
limits.rate.tokens_per_minute required | integer | null | |
limits.rate.max_concurrent required | integer | null | |
limits.spend required | array of object | |
limits.spend[].id required | SpendLimitId | |
limits.spend[].window required | "day" | "week" | "month" | "total" | |
limits.spend[].limit_micros required | UnsignedMicros | |
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: a 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 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.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
customer_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, an archived one, or another than the environment key's own.
- 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/customers/org_42/unblock" \
-H "Authorization: Bearer $HIXEL_API_KEY"const customer = await hixel.customers.unblock("org_42");Store a customer's provider key#
Stores your customer's own key for provider (bring your own key), replacing the one it had. Requests the customer makes to that provider then run on its key, and are not paid from its wallet. The key is encrypted at rest and never returned by any read. Only when the environment lets customers bring keys for this provider.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
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: ProviderKey
| Field | Type | Description |
|---|---|---|
id required | string | The id of a provider key a customer brought (pcred_…). |
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. |
created_at required | string (date-time) | |
updated_at required | string (date-time) | |
customer required | string | Your id for the customer (its external_id), as every path takes it. |
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: a 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 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.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
customer_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, an archived one, or another than the environment key's own.
- 409
project_archived: This project is archived.environment_archived: This environment is archived.byok_disabled: This environment does not let customers bring their own provider keys.byok_provider_not_allowed: This environment does not let customers bring keys for this provider.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/customers/org_42/provider_keys/openai" \
-H "Authorization: Bearer $HIXEL_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"api_key": "sk-…"
}'const providerKey = await hixel.customers.putProviderKey("org_42", "openai", {
api_key: "sk-…",
});Remove a customer's provider key#
Deletes the customer's key for provider; its requests to that provider are paid as any other again. Answers 204 with no body.
Takes an environment key with the management scope, or a project key with the admin role, naming the environment in x-hixel-environment. Accepts an Idempotency-Key header: a retry with the same key runs once.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
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: a 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 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.role_not_allowed: the project key'smemberrole does not allow this; it takesadmin.
- 404
customer_not_found,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, an archived one, or another than the environment key's own.
- 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/customers/org_42/provider_keys/openai" \
-H "Authorization: Bearer $HIXEL_API_KEY"await hixel.customers.removeProviderKey("org_42", "openai");List a customer's provider keys#
A page of the provider keys the customer brought, oldest first, at most one per 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.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
external_id required | path | string | Your id for the customer. |
cursor | query | string | The next_cursor of the previous page, to read the next one; left out for the first page. Pass the same filters with it. |
limit | query | integer | How many items the page holds: an integer from 1 to 100; 50 when left out. |
Response 200: ProviderKeyList
| Field | Type | Description |
|---|---|---|
data required | array of ProviderKey | |
data[].id required | string | The id of a provider key a customer brought (pcred_…). |
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[].created_at required | string (date-time) | |
data[].updated_at required | string (date-time) | |
data[].customer required | string | Your id for the customer (its external_id), as every path takes it. |
next_cursor required | string | null | Pass back as cursor for the next page; null on the last page. |
Errors
- 400
invalid_request: The request is malformed or fails validation;paramnames the field.invalid_cursor: The cursor is not one this list gave.environment_required: a project key was sent withoutx-hixel-environment.invalid_params,invalid_query: 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 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
customer_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, 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/customers/org_42/provider_keys" \
-H "Authorization: Bearer $HIXEL_API_KEY"for await (const item of hixel.customers.listProviderKeys("org_42")) {
console.log(item);
}Count customers#
How many customers the environment has: in all, blocked, with limits of their own and with allowed models of their own; each the number the list would give with that one filter.
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: CustomerCounts
| Field | Type | Description |
|---|---|---|
total required | integer | |
blocked required | integer | |
with_own_limits required | integer | |
with_own_allowed_models required | integer |
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/customer_counts" \
-H "Authorization: Bearer $HIXEL_API_KEY"const customerCounts = await hixel.customerCounts.get();