API keys
Gram API keys are used to authenticate requests to the Gram API and can be used with MCP server configurations or Gram SDKs. There are two types of API keys: Consumer keys and Producer keys.
Consumer keys
Section titled “Consumer keys”Consumer keys are for accessing Gram servers with managed authentication. Use these when connecting MCP clients to Gram servers or when you need to query data from existing toolsets.
Producer keys
Section titled “Producer keys”Producer keys are for accessing Gram platform capabilities, like spec updates and toolset management. Use these when you need to programmatically create or modify toolsets, upload OpenAPI documents, or trigger deployments.
Creating an API key
Section titled “Creating an API key”To generate a Gram API key, navigate to the Settings page of the Gram dashboard and click on the New API Key button. Select the appropriate scope based on whether you need Consumer or Producer access.
Copy the API key and follow your MCP client’s instructions to add the configuration to your client.
If you’re using the Gram SDKs, pass the API key as an environment variable to authenticate requests programmatically.
import asyncioimport osfrom agents import Agent, Runner, set_default_openai_keyfrom gram_ai.openai_agents import GramOpenAIAgents
key = os.getenv("GRAM_API_KEY")
gram = GramOpenAIAgents(api_key=key)
set_default_openai_key(os.getenv("OPENAI_API_KEY"))
# ...