Skip to main content
Together AI uses API keys to authenticate requests. Keys are scoped to projects, meaning a key only has access to the resources within its project.

Create an API key

Create independent API keys for separate use cases, systems, or workloads. For example, one for production, one for development, one for CI/CD, and one for inference.
1

Open the project

Navigate to the project you want to create a key for.
2

Open API key settings

Go to the project’s API keys settings.
3

Create the key

Select Create API Key and enter a name. To make the key expire automatically, select Set an expiration date and choose a preset or custom date. Then select Create.
4

Copy the key

Copy the key immediately. It won’t be shown again.
New API keys are displayed only once at creation. Save them in a secure location, such as a secrets manager, immediately. If you lose a key, you’ll need to create a new one.

Best practices

  • Name your keys descriptively (for example, prod-inference, ci-pipeline, dev-local) so you can identify and rotate them.
  • Set expiration dates for keys used in temporary or testing contexts. Select Set an expiration date when creating a key, or Set expiration in the three-dot menu next to an existing key. To keep a key that’s scheduled to expire, select Cancel expiration from the same menu.
  • Rotate keys regularly and revoke any that are no longer in use.
  • Never commit keys to source control. Use environment variables or a secrets manager.
  • Treat keys as secrets. Anyone holding a key has full access to its project’s resources and can spend your credit balance, which auto-recharge tops back up. If you suspect a key has leaked, revoke it immediately and create a new one.

Set as an environment variable

To use the Together Python or TypeScript SDKs, set your key as an environment variable in your shell:
Or add it to a .env file in your project directory:
.env

Authenticate a request

Include your API key in the Authorization header of every API request:

Project key scoping

API keys are scoped to projects:
  • A key created in project A can only access resources in project A.
  • Keys persist even if the collaborator who created them is removed from the project.
  • Both project admins and member-role collaborators can create and revoke keys.
This means you can safely share a project API key with a CI/CD pipeline or external collaborator without giving them access to resources in other projects.
Keys created before multi-project support was enabled are scoped to your organization’s default project.

Playground

The Together AI playground recognizes all API keys associated with your account. When you use the playground, it shows available models across all your keys and projects.

Cost analytics and usage

Use API key IDs to segment usage and cost by key and workload. The api_key_id field is supported for inference and code interpreter requests, so you can track which keys are driving spend in your project’s cost analytics.

Limitations

No per-key usage limits: You can’t cap spend or rate-limit individual API keys. Usage limits apply at the organization level.

Vercel integration

When you connect a Vercel project from Integrations settings, each linked Vercel project gets its own dedicated API key. Together creates the key in your organization’s default project and sets it as the TOGETHER_API_KEY environment variable in the Vercel project. Manage or revoke these keys from the default project’s API keys settings, like any other key. Disconnecting a Vercel project removes the environment variable from Vercel but doesn’t revoke the key.
This is the Together console Vercel integration. For the npm AI SDK provider, see Vercel AI SDK.

Legacy API keys

Your organization may have a legacy API key scoped to its default project. It appears in that project’s API keys settings with a Deprecated badge. Legacy keys are deprecated, and you should avoid using them in production. These keys can’t be scoped to a specific project or workload, and can’t be revoked (only regenerated if compromised). Use project-scoped API keys instead.

Regenerate a legacy key

If a legacy key is compromised, any project admin or editor can rotate it. In the project’s API keys settings, open the three-dot menu on the key’s row, select Regenerate legacy key, and confirm.
Regenerating a legacy key invalidates the current key immediately, and the new key is shown only once. Copy it right away and update every application that used the old key.

Projects

Understand how API keys are scoped to projects.

Roles and permissions

See who can create and manage API keys.