← Back to daily report

get-started.md

Changed on 2026-02-11 10:56:44 EST

+23 lines added
-14 lines removed
Visual Diff
# Get started with Claude¶

Make your first API call to Claude and build a simple web search assistant¶

---¶

## Prerequisites¶

- An Anthropic [Console account](/)¶
- An [API key](/settings/keys)¶

## Call the API¶

<Tabs>¶
<Tab title="cURL">¶
<Steps>¶
<Step title="Set your API key">¶
Get your API key at the [Claude Console](/settings/keys) and set it as an environment variable:¶

```bash¶
export ANTHROPIC_API_KEY='your-api-key-here'¶
```¶
</Step>¶

<Step title="Make your first API call">¶
Run this command to create a simple web search assistant:¶

```bash¶
curl https://api.anthropic.com/v1/messages \¶
-H "Content-Type: application/json" \¶
-H "x-api-key: $ANTHROPIC_API_KEY" \¶
-H "anthropic-version: 2023-06-01" \¶
-d '{¶
"model": "claude-opus-4-6",¶
"max_tokens": 1000,¶
"messages": [¶
{¶
"role": "user",

"content": "What should I search for to find the latest developments in renewable energy?"¶
}¶
]¶
}'¶
```¶

**Example output:**¶
```json¶
{¶
"id": "msg_01HCDu5LRGeP2o7s2xGmxyx8",¶
"type": "message",

"role": "assistant",¶
"content": [¶
{¶
"type": "text",¶
"text": "Here are some effective search strategies to find the latest renewable energy developments:\n\n## Search Terms to Use:\n- \"renewable energy news 2024\"\n- \"clean energy breakthrough\"\n- \"solar/wind/battery technology advances\"\n- \"green energy innovations\"\n- \"climate tech developments\"\n- \"energy storage solutions\"\n\n## Best Sources to Check:\n\n**News & Industry Sites:**\n- Renewable Energy World\n- GreenTech Media (now Wood Mackenzie)\n- Energy Storage News\n- CleanTechnica\n- PV Magazine (for solar)\n- WindPower Engineering & Development..."¶
}¶
],¶
"model": "claude-opus-4-6",¶
"stop_reason": "end_turn",¶
"usage": {¶
"input_tokens": 21,¶
"output_tokens": 305¶
}¶
}¶
```¶
</Step>¶
</Steps>¶
</Tab>¶

<Tab title="Python">¶
<Steps>¶
<Step title="Set your API key">¶
Get your API key from the [Claude Console](/settings/keys) and set it as an environment variable:¶

```bash¶
export ANTHROPIC_API_KEY='your-api-key-here'¶
```¶
</Step>¶

<Step title="Install the SDK">¶
Install the Anthropic Python SDK:¶

```bash¶
pip install anthropic¶
```¶
</Step>¶

<Step title="Create your code">¶
Save this as `quickstart.py`:¶

```python¶
import anthropic¶

client = anthropic.Anthropic()¶

message = client.messages.create(¶
model="claude-opus-4-6",¶
max_tokens=1000,¶
messages=[¶
{¶
"role": "user",¶
"content": "What should I search for to find the latest developments in renewable energy?"
,
}¶
]
,
)¶
print(message.content)¶
```¶
</Step>¶

<Step title="Run your code">¶
```bash¶
python quickstart.py¶
```¶

**Example output:**¶
```python¶
[
TextBlock(
TextBlock(¶
text='Here are some effective search strategies for finding the latest renewable energy developments:\n\n**Search Terms to Use:**\n- "renewable energy news 2024"\n- "clean energy breakthroughs"\n- "solar/wind/battery technology advances"\n- "energy storage innovations"\n- "green hydrogen developments"\n- "renewable energy policy updates"\n\n**Reliable Sources to Check:**\n- **News & Analysis:** Reuters Energy, Bloomberg New Energy Finance, Greentech Media, Energy Storage News\n- **Industry Publications:** Renewable Energy World, PV Magazine, Wind Power Engineering\n- **Research Organizations:** International Energy Agency (IEA), National Renewable Energy Laboratory (NREL)\n- **Government Sources:** Department of Energy websites, EPA clean energy updates\n\n**Specific Topics to Explore:**\n- Perovskite and next-gen solar cells\n- Offshore wind expansion\n- Grid-scale battery storage\n- Green hydrogen production\n- Carbon capture technologies\n- Smart grid innovations\n- Energy policy changes and incentives...',
type='"text')",¶
)¶
]¶
```¶
</Step>¶
</Steps>¶
</Tab>¶

<Tab title="TypeScript">¶
<Steps>¶
<Step title="Set your API key">¶
Get your API key from the [Claude Console](/settings/keys) and set it as an environment variable:¶

```bash¶
export ANTHROPIC_API_KEY='your-api-key-here'¶
```¶
</Step>¶

<Step title="Install the SDK">¶
Install the Anthropic TypeScript SDK:¶

```bash¶
npm install @anthropic-ai/sdk¶
```¶
</Step>¶

<Step title="Create your code">¶
Save this as `quickstart.ts`:¶

```typescript¶
import Anthropic from "@anthropic-ai/sdk";¶

async function main() {¶
const anthropic = new Anthropic();¶

const msg = await anthropic.messages.create({¶
model: "claude-opus-4-6",¶
max_tokens: 1000,¶
messages: [¶
{¶
role: "user",¶
content: "What should I search for to find the latest developments in renewable energy?"¶
}¶
]¶
});¶
console.log(msg);¶
}¶

main().catch(console.error);¶
```¶
</Step>¶

<Step title="Run your code">¶
```bash¶
npx tsx quickstart.ts¶
```¶

**Example output:**¶

```javascript¶
{¶
id: 'msg_01ThFHzad6Bh4TpQ6cHux9t8',¶
type: 'message',¶
role: 'assistant',¶
model: 'claude-opus-4-6',¶
content: [¶
{¶
type: 'text',¶
text: 'Here are some effective search strategies to find the latest renewable energy developments:\n\n' +¶
'## Search Terms to Use:\n' +¶
'- "renewable energy news 2024"\n' +¶
'- "clean energy breakthroughs"\n' +¶
'- "solar wind technology advances"\n' +¶
'- "energy storage innovations"\n' +¶
'- "green hydrogen developments"\n' +¶
'- "offshore wind projects"\n' +¶
'- "battery technology renewable"\n\n' +¶
'## Best Sources to Check:\n\n' +¶
'**News & Industry Sites:**\n' +¶
'- Renewable Energy World\n' +¶
'- CleanTechnica\n' +¶
'- GreenTech Media (now Wood Mackenzie)\n' +¶
'- Energy Storage News\n' +¶
'- PV Magazine (for solar)...'¶
}¶
],¶
stop_reason: 'end_turn',¶
usage: {¶
input_tokens: 21,¶
output_tokens: 302¶
}¶
}¶
```¶
</Step>¶
</Steps>¶
</Tab>¶

<Tab title="Java">¶
<Steps>¶
<Step title="Set your API key">¶
Get your API key from the [Claude Console](/settings/keys) and set it as an environment variable:¶

```bash¶
export ANTHROPIC_API_KEY='your-api-key-here'¶
```¶
</Step>¶

<Step title="Install the SDK">¶
Add the Anthropic Java SDK to your project. First find the current version on [Maven Central](https://central.sonatype.com/artifact/com.anthropic/anthropic-java).¶

**Gradle:**¶
```groovy¶
implementation("com.anthropic:anthropic-java:1.0.0")¶
```¶

**Maven:**¶
```xml¶
<dependency>¶
<groupId>com.anthropic</groupId>¶
<artifactId>anthropic-java</artifactId>¶
<version>1.0.0</version>¶
</dependency>¶
```¶
</Step>¶

<Step title="Create your code">¶
Save this as `QuickStart.java`:¶

```java¶
import com.anthropic.client.AnthropicClient;¶
import com.anthropic.client.okhttp.AnthropicOkHttpClient;¶
import com.anthropic.models.messages.Message;¶
import com.anthropic.models.messages.MessageCreateParams;¶

public class QuickStart {¶

public static void main(String[] args) {¶
AnthropicClient client = AnthropicOkHttpClient.fromEnv();¶

MessageCreateParams params = MessageCreateParams.builder()¶
.model("claude-opus-4-6")¶
.maxTokens(1000)¶
.addUserMessage(
"What should I search for to find the latest developments in renewable energy?")
)¶
.build();¶

Message message = client.messages().create(params);¶
System.out.println(message.content());¶
}¶
}¶
```¶
</Step>¶

<Step title="Run your code">¶
```bash¶
javac QuickStart.java¶
java QuickStart¶
```¶

**Example output:**¶
```java¶
[ContentBlock{text=TextBlock{text=Here are some effective search strategies to find the latest renewable energy developments:¶

## Search Terms to Use:¶
- "renewable energy news 2024"¶
- "clean energy breakthroughs"

- "solar/wind/battery technology advances"¶
- "energy storage innovations"¶
- "green hydrogen developments"¶
- "renewable energy policy updates"¶

## Best Sources to Check:¶
- **News & Analysis:** Reuters Energy, Bloomberg New Energy Finance, Greentech Media¶
- **Industry Publications:** Renewable Energy World, PV Magazine, Wind Power Engineering¶
- **Research Organizations:** International Energy Agency (IEA), National Renewable Energy Laboratory (NREL)¶
- **Government Sources:** Department of Energy websites, EPA clean energy updates¶

## Specific Topics to Explore:¶
- Perovskite and next-gen solar cells¶
- Offshore wind expansion¶
- Grid-scale battery storage¶
- Green hydrogen production..., type=text}}]¶
```¶
</Step>¶
</Steps>¶
</Tab>¶
</Tabs>¶

## Next steps¶

Now that you have made your first Claude API request, it's time to explore what else is possible:¶

<CardGroup cols={3}>¶
<Card title="Working with Messages" icon="messages" href="/docs/en/build-with-claude/working-with-messages">¶
Learn common patterns for the Messages API.¶
</Card>¶
<Card title="Features Overview" icon="brain" href="/docs/en/api/overview">¶
Explore Claude's advanced features and capabilities.¶
</Card>¶
<Card title="Client SDKs" icon="code-brackets" href="/docs/en/api/client-sdks">¶
Discover Anthropic client libraries.¶
</Card>¶
<Card title="Claude Cookbook" icon="chef-hat" href="https://platform.claude.com/cookbooks">¶
Learn with interactive Jupyter notebooks.¶
</Card>¶
</CardGroup>

Unified Diff

--- a/get-started.md
+++ b/get-started.md
@@ -35,7 +35,7 @@
             "max_tokens": 1000,
             "messages": [
               {
-                "role": "user", 
+                "role": "user",
                 "content": "What should I search for to find the latest developments in renewable energy?"
               }
             ]
@@ -46,7 +46,7 @@
         ```json
         {
           "id": "msg_01HCDu5LRGeP2o7s2xGmxyx8",
-          "type": "message", 
+          "type": "message",
           "role": "assistant",
           "content": [
             {
@@ -98,9 +98,9 @@
             messages=[
                 {
                     "role": "user",
-                    "content": "What should I search for to find the latest developments in renewable energy?"
+                    "content": "What should I search for to find the latest developments in renewable energy?",
                 }
-            ]
+            ],
         )
         print(message.content)
         ```
@@ -113,7 +113,12 @@
 
         **Example output:**
         ```python
-        [TextBlock(text='Here are some effective search strategies for finding the latest renewable energy developments:\n\n**Search Terms to Use:**\n- "renewable energy news 2024"\n- "clean energy breakthroughs"\n- "solar/wind/battery technology advances"\n- "energy storage innovations"\n- "green hydrogen developments"\n- "renewable energy policy updates"\n\n**Reliable Sources to Check:**\n- **News & Analysis:** Reuters Energy, Bloomberg New Energy Finance, Greentech Media, Energy Storage News\n- **Industry Publications:** Renewable Energy World, PV Magazine, Wind Power Engineering\n- **Research Organizations:** International Energy Agency (IEA), National Renewable Energy Laboratory (NREL)\n- **Government Sources:** Department of Energy websites, EPA clean energy updates\n\n**Specific Topics to Explore:**\n- Perovskite and next-gen solar cells\n- Offshore wind expansion\n- Grid-scale battery storage\n- Green hydrogen production\n- Carbon capture technologies\n- Smart grid innovations\n- Energy policy changes and incentives...', type='text')]
+        [
+            TextBlock(
+                text='Here are some effective search strategies for finding the latest renewable energy developments:\n\n**Search Terms to Use:**\n- "renewable energy news 2024"\n- "clean energy breakthroughs"\n- "solar/wind/battery technology advances"\n- "energy storage innovations"\n- "green hydrogen developments"\n- "renewable energy policy updates"\n\n**Reliable Sources to Check:**\n- **News & Analysis:** Reuters Energy, Bloomberg New Energy Finance, Greentech Media, Energy Storage News\n- **Industry Publications:** Renewable Energy World, PV Magazine, Wind Power Engineering\n- **Research Organizations:** International Energy Agency (IEA), National Renewable Energy Laboratory (NREL)\n- **Government Sources:** Department of Energy websites, EPA clean energy updates\n\n**Specific Topics to Explore:**\n- Perovskite and next-gen solar cells\n- Offshore wind expansion\n- Grid-scale battery storage\n- Green hydrogen production\n- Carbon capture technologies\n- Smart grid innovations\n- Energy policy changes and incentives...',
+                type="text",
+            )
+        ]
         ```
       </Step>
     </Steps>
@@ -169,6 +174,7 @@
         ```
 
         **Example output:**
+        
         ```javascript
         {
           id: 'msg_01ThFHzad6Bh4TpQ6cHux9t8',
@@ -245,18 +251,21 @@
         import com.anthropic.models.messages.MessageCreateParams;
 
         public class QuickStart {
-            public static void main(String[] args) {
-                AnthropicClient client = AnthropicOkHttpClient.fromEnv();
-
-                MessageCreateParams params = MessageCreateParams.builder()
-                        .model("claude-opus-4-6")
-                        .maxTokens(1000)
-                        .addUserMessage("What should I search for to find the latest developments in renewable energy?")
-                        .build();
-
-                Message message = client.messages().create(params);
-                System.out.println(message.content());
-            }
+
+          public static void main(String[] args) {
+            AnthropicClient client = AnthropicOkHttpClient.fromEnv();
+
+            MessageCreateParams params = MessageCreateParams.builder()
+              .model("claude-opus-4-6")
+              .maxTokens(1000)
+              .addUserMessage(
+                "What should I search for to find the latest developments in renewable energy?"
+              )
+              .build();
+
+            Message message = client.messages().create(params);
+            System.out.println(message.content());
+          }
         }
         ```
       </Step>
@@ -273,7 +282,7 @@
 
         ## Search Terms to Use:
         - "renewable energy news 2024"
-        - "clean energy breakthroughs"  
+        - "clean energy breakthroughs"
         - "solar/wind/battery technology advances"
         - "energy storage innovations"
         - "green hydrogen developments"